[cosmetics] remove whitespace
authorvdrfan <vdrfan-nospam-@xbmc.org>
Sat, 2 Jun 2012 09:02:16 +0000 (11:02 +0200)
committervdrfan <vdrfan-nospam-@xbmc.org>
Sat, 2 Jun 2012 09:14:32 +0000 (11:14 +0200)
xbmc/interfaces/python/xbmcmodule/xbmcvfsmodule.cpp

index 1c853c0..576d3a4 100644 (file)
@@ -43,7 +43,7 @@ using namespace PYXBMC;
 #ifdef __cplusplus
 extern "C" {
 #endif
-  
+
   namespace xbmcvfs
   {
     /*****************************************************************
@@ -53,14 +53,14 @@ extern "C" {
       PyObject_HEAD
       CFile* pFile;
     } File;
-   
+
     PyDoc_STRVAR(file__doc__,
       "File class.\n"
       "\n"
-      "'w' - opt open for write\n"           
+      "'w' - opt open for write\n"
       "example:\n"
       " f = xbmcvfs.File(file, ['w'])\n");
-    
+
     PyObject* File_New(PyTypeObject *type, PyObject *args, PyObject *kwds)
     {
       PyObject *f_line;
@@ -76,19 +76,19 @@ extern "C" {
       File *self = (File *)type->tp_alloc(type, 0);
       if (!self)
         return NULL;
-      
+
       CStdString strSource;
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1))
         return NULL;
-      
+
       self->pFile = new CFile();
       if (strncmp(cLine, "w", 1) == 0)
       {
         CPyThreadState pyState;
         self->pFile->OpenForWrite(strSource,true);
-        pyState.Restore();                          
+        pyState.Restore();
       }
-      else 
+      else
       {
         CPyThreadState pyState;
         self->pFile->Open(strSource, READ_NO_CACHE);
@@ -96,17 +96,17 @@ extern "C" {
       }
       return (PyObject*)self;
     }
-    
+
     void File_Dealloc(File* self)
     {
       CPyThreadState pyState;
       delete self->pFile;
       pyState.Restore();
-      
+
       self->pFile = NULL;
       self->ob_type->tp_free((PyObject*)self);
-    }    
-    
+    }
+
     // copy() method
     PyDoc_STRVAR(copy__doc__,
       "copy(source, destination) -- Copy file to destination, returns true/false.\n"
@@ -116,7 +116,7 @@ extern "C" {
       "\n"
       "example:\n"
       " - success = xbmcvfs.copy(source, destination)\n");
-    
+
     PyObject* vfs_copy(PyObject *self, PyObject *args)
     {
       PyObject *f_line;
@@ -132,14 +132,14 @@ extern "C" {
       CStdString strSource;
       CStdString strDestnation;
       bool bResult = true;
-      
+
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1)) return NULL;
       if (!PyXBMCGetUnicodeString(strDestnation, d_line, 1)) return NULL;
 
       CPyThreadState pyState;
       bResult = CFile::Cache(strSource, strDestnation);
       pyState.Restore();
-      
+
       return Py_BuildValue((char*)"b", bResult);
     }
     PyDoc_STRVAR(delete__doc__,
@@ -149,7 +149,7 @@ extern "C" {
       "\n"
       "example:\n"
       " - xbmcvfs.delete(file)\n");
-    
+
     // delete a file
     PyObject* vfs_delete(File *self, PyObject *args, PyObject *kwds)
     {
@@ -163,16 +163,16 @@ extern "C" {
       }
       CStdString strSource;
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1)) return NULL;
-      
+
       CPyThreadState pyState;
       self->pFile->Delete(strSource);
       pyState.Restore();
-      
+
       Py_INCREF(Py_None);
       return Py_None;
-      
+
     }
-    
+
     PyDoc_STRVAR(rename__doc__,
       "rename(file, newFileName) -- Rename file, returns true/false.\n"
       "\n"
@@ -181,7 +181,7 @@ extern "C" {
       "\n"
       "example:\n"
       " - success = xbmcvfs.rename(file, newFileName)\n");
-    
+
     // rename a file
     PyObject* vfs_rename(File *self, PyObject *args, PyObject *kwds)
     {
@@ -199,16 +199,16 @@ extern "C" {
       CStdString strDestnation;
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1)) return NULL;
       if (!PyXBMCGetUnicodeString(strDestnation, d_line, 1)) return NULL;
-      
+
       bool bResult;
 
       CPyThreadState pyState;
       bResult = self->pFile->Rename(strSource,strDestnation);
       pyState.Restore();
-      
+
       return Py_BuildValue((char*)"b", bResult);
-      
-    }  
+
+    }
 
     PyDoc_STRVAR(exists__doc__,
       "exists(path) -- Check if file exists, returns true/false.\n"
@@ -217,7 +217,7 @@ extern "C" {
       "\n"
       "example:\n"
       " - success = xbmcvfs.exists(path)\n");
-   
+
     // check for a file or folder existance, mimics Pythons os.path.exists()
     PyObject* vfs_exists(File *self, PyObject *args, PyObject *kwds)
     {
@@ -231,15 +231,15 @@ extern "C" {
       }
       CStdString strSource;
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1)) return NULL;
-     
+
       bool bResult;
-     
+
       CPyThreadState pyState;
       bResult = self->pFile->Exists(strSource, false);
       pyState.Restore();
 
       return Py_BuildValue((char*)"b", bResult);
-    }      
+    }
 
     PyDoc_STRVAR(mkdir__doc__,
       "mkdir(path) -- Create a folder.\n"
@@ -261,15 +261,15 @@ extern "C" {
       }
       CStdString strSource;
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1)) return NULL;
-     
+
       bool bResult;
-     
+
       CPyThreadState pyState;
       bResult = CDirectory::Create(strSource);
       pyState.Restore();
 
       return Py_BuildValue((char*)"b", bResult);
-    }      
+    }
 
     PyDoc_STRVAR(mkdirs__doc__,
       "mkdirs(path) -- Create folder(s) - it will create all folders in the path.\n"
@@ -292,14 +292,14 @@ extern "C" {
       CStdString strSource;
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1))
         return NULL;
-      
+
       CPyThreadState pyState;
       bool bResult = CUtil::CreateDirectoryEx(strSource);
       pyState.Restore();
-      
+
       return Py_BuildValue((char*)"b", bResult);
-    } 
-    
+    }
+
     PyDoc_STRVAR(rmdir__doc__,
       "rmdir(path) -- Remove a folder.\n"
       "\n"
@@ -322,7 +322,7 @@ extern "C" {
       }
       CStdString strSource;
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1)) return NULL;
-     
+
       bool bResult;
       if (bForce)
       {
@@ -330,7 +330,7 @@ extern "C" {
         bResult = CFileUtils::DeleteItem(strSource, bForce);
         pyState.Restore();
       }
-      else 
+      else
       {
         CPyThreadState pyState;
         bResult = CDirectory::Remove(strSource);
@@ -338,8 +338,8 @@ extern "C" {
       }
 
       return Py_BuildValue((char*)"b", bResult);
-    }      
-    
+    }
+
     PyDoc_STRVAR(listdir__doc__,
       "listdir(path) -- lists content of a folder.\n"
       "\n"
@@ -362,19 +362,19 @@ extern "C" {
       CFileItemList items;
       if (!PyXBMCGetUnicodeString(strSource, f_line, 1))
         return NULL;
-      
+
       CPyThreadState pyState;
       CDirectory::GetDirectory(strSource, items);
       pyState.Restore();
-      
+
       PyObject *fileList = PyList_New(0);
       PyObject *folderList = PyList_New(0);
       for (int i=0; i < items.Size(); i++)
-      {  
+      {
         CStdString itemPath = items[i]->GetPath();
         PyObject *obj;
         if (URIUtils::HasSlashAtEnd(itemPath)) // folder
-        {  
+        {
           URIUtils::RemoveSlashAtEnd(itemPath);
           CStdString strFileName = URIUtils::GetFileName(itemPath);
           obj = Py_BuildValue((char*)"s", strFileName.c_str());
@@ -389,8 +389,8 @@ extern "C" {
         Py_DECREF(obj); //we have to do this as PyList_Append is known to leak
       }
       return Py_BuildValue((char*)"O,O", folderList, fileList);
-    }  
-    
+    }
+
     // define c functions to be used in python here
     PyMethodDef xbmcvfsMethods[] = {
       {(char*)"copy", (PyCFunction)vfs_copy, METH_VARARGS, copy__doc__},
@@ -412,7 +412,7 @@ extern "C" {
       " f = xbmcvfs.File(file)\n"
       " b = f.read()\n"
       " f.close()\n");
-    
+
     // read a file
     PyObject* File_read(File *self, PyObject *args)
     {
@@ -425,7 +425,7 @@ extern "C" {
       char* buffer = new char[readBytes + 1];
       PyObject* ret = NULL;
       if (buffer)
-      {  
+      {
         unsigned int bytesRead;
         CPyThreadState pyState;
         bytesRead = self->pFile->Read(buffer, readBytes);
@@ -446,7 +446,7 @@ extern "C" {
       " f = xbmcvfs.File(file, 'w', True)\n"
       " result = f.write(buffer)\n"
       " f.close()\n");
-    
+
     // read a file
     PyObject* File_write(File *self, PyObject *args)
     {
@@ -457,10 +457,10 @@ extern "C" {
       CPyThreadState pyState;
       bool bResult = self->pFile->Write( (void*) pBuffer, std::strlen( pBuffer ) + 1 );
       pyState.Restore();
-      
+
       return Py_BuildValue((char*)"b", bResult);
     }
-    
+
     PyDoc_STRVAR(size__doc__,
       "size()\n"
       "\n"
@@ -468,7 +468,7 @@ extern "C" {
       " f = xbmcvfs.File(file)\n"
       " s = f.size()\n"
       " f.close()\n");
-    
+
     // size of a file
     PyObject* File_size(File *self, PyObject *args)
     {
@@ -476,10 +476,10 @@ extern "C" {
       CPyThreadState pyState;
       size = self->pFile->GetLength();
       pyState.Restore();
-      
+
       return Py_BuildValue((char*)"L", size);
     }
-    
+
     PyDoc_STRVAR(seek__doc__,
       "seek()\n"
       "\n"
@@ -489,7 +489,7 @@ extern "C" {
       " f = xbmcvfs.File(file)\n"
       " result = f.seek(8129, 0)\n"
       " f.close()\n");
-    
+
     // seek a file
     PyObject* File_seek(File *self, PyObject *args)
     {
@@ -497,28 +497,28 @@ extern "C" {
       int iWhence;
       if (!PyArg_ParseTuple(args, (char*)"Li", &seekBytes, &iWhence ))
         return NULL;
-      
+
       CPyThreadState pyState;
       int64_t bResult = self->pFile->Seek(seekBytes,iWhence);
       pyState.Restore();
-      
+
       return Py_BuildValue((char*)"L", bResult);
     }
-    
+
     PyDoc_STRVAR(close__doc__,
       "close()\n"
       "\n"
       "example:\n"
       " f = xbmcvfs.File(file)\n"
       " f.close()\n");
-    
+
     // close a file
     PyObject* File_close(File *self, PyObject *args, PyObject *kwds)
     {
       CPyThreadState pyState;
       self->pFile->Close();
       pyState.Restore();
-      
+
       Py_INCREF(Py_None);
       return Py_None;
     }
@@ -527,7 +527,7 @@ extern "C" {
      * end of methods and python objects
      * initxbmc(void);
      *****************************************************************/
-    
+
     /*************************************************************
      * Meta data for the xbmcvfs.File class
      *************************************************************/
@@ -539,13 +539,13 @@ extern "C" {
       {(char*)"close", (PyCFunction)File_close, METH_NOARGS, close__doc__},
       {NULL, NULL, 0, NULL}
     };
-    
+
     PyTypeObject File_Type;
-    
+
     void initFile_Type()
     {
       PyXBMCInitializeTypeObject(&File_Type);
-      
+
       File_Type.tp_name = (char*)"xbmcvfs.File";
       File_Type.tp_basicsize = sizeof(File);
       File_Type.tp_dealloc = (destructor)File_Dealloc;
@@ -555,14 +555,14 @@ extern "C" {
       File_Type.tp_base = 0;
       File_Type.tp_new = File_New;
     }
-    
+
     PyMODINIT_FUNC
     DeinitVFSModule()
     {
       // no need to Py_DECREF our objects (see InitXBMCMVFSModule()) as they were created only
       // so that they could be added to the module, which steals a reference.
     }
-    
+
     PyMODINIT_FUNC
     InitVFSModule()
     {
@@ -570,17 +570,17 @@ extern "C" {
       PyObject* pXbmcvfsModule;
       pXbmcvfsModule = Py_InitModule((char*)"xbmcvfs", xbmcvfsMethods);
       if (pXbmcvfsModule == NULL) return;
-     
+
       PyModule_AddObject(pXbmcvfsModule, (char*)"File", (PyObject*)&File_Type);
-      
+
       // constants
       PyModule_AddStringConstant(pXbmcvfsModule, (char*)"__author__", (char*)PY_XBMC_AUTHOR);
       PyModule_AddStringConstant(pXbmcvfsModule, (char*)"__date__", (char*)"25 May 2012");
       PyModule_AddStringConstant(pXbmcvfsModule, (char*)"__version__", (char*)"1.4");
       PyModule_AddStringConstant(pXbmcvfsModule, (char*)"__credits__", (char*)PY_XBMC_CREDITS);
       PyModule_AddStringConstant(pXbmcvfsModule, (char*)"__platform__", (char*)PY_XBMC_PLATFORM);
-    }    
-    
+    }
+
     PyMODINIT_FUNC
     InitVFSTypes(bool bInitTypes)
     {
@@ -588,7 +588,7 @@ extern "C" {
       if (PyType_Ready(&File_Type)) return;
     }
   }
-  
+
 #ifdef __cplusplus
 }
 #endif