Made the EFI compressor/decompressor wrapper built
authorjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 28 Apr 2008 03:53:00 +0000 (03:53 +0000)
committerjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 28 Apr 2008 03:53:00 +0000 (03:53 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1182 7335b38e-4728-0410-8992-fb3ffe349368

Source/C/PyEfiCompressor/EfiCompressor.c
Source/C/PyEfiCompressor/setup.py

index 39569e4..e32478d 100644 (file)
@@ -8,23 +8,21 @@ STATIC
 PyObject*\r
 UefiDecompress(\r
   PyObject    *Self,\r
-  PyObject    *Args,\r
-  PyObject    *Keywords\r
+  PyObject    *Args\r
   ) \r
 {\r
   PyTypeObject  *SrcData;\r
   UINT32        SrcDataSize;\r
   UINT32        DstDataSize;\r
-  UINT          Status;\r
+  UINTN         Status;\r
   UINT8         *SrcBuf;\r
   UINT8         *DstBuf;\r
   UINT8         *TmpBuf;\r
   Py_ssize_t    SegNum;\r
   Py_ssize_t    Index;\r
 \r
-  Status = PyArg_ParseTupleAndKeywords(\r
+  Status = PyArg_ParseTuple(\r
             Args,\r
-            Keywords,\r
             "0ii",\r
             &SrcData,\r
             &SrcDataSize,\r
@@ -48,13 +46,13 @@ UefiDecompress(
     goto ERROR;\r
   }\r
 \r
-  SegNum = SrcData->tp_as_buffer->bf_getsegcount(SrcData, NULL);\r
-  TmpBuf = SrcBuf\r
+  SegNum = SrcData->tp_as_buffer->bf_getsegcount((PyObject *)SrcData, NULL);\r
+  TmpBuf = SrcBuf;\r
   for (Index = 0; Index < SegNum; ++Index) {\r
     VOID *BufSeg;\r
     Py_ssize_t Len;\r
 \r
-    Len = SrcData->tp_as_buffer->bf_getreadbuffer(SrcData, Index, &BufSeg);\r
+    Len = SrcData->tp_as_buffer->bf_getreadbuffer((PyObject *)SrcData, Index, &BufSeg);\r
     if (Len < 0) {\r
       goto ERROR;\r
     }\r
@@ -85,23 +83,21 @@ STATIC
 PyObject*\r
 FrameworkDecompress(\r
   PyObject    *Self,\r
-  PyObject    *Args,\r
-  PyObject    *Keywords\r
+  PyObject    *Args\r
   )\r
 {\r
   PyTypeObject  *SrcData;\r
   UINT32        SrcDataSize;\r
   UINT32        DstDataSize;\r
-  UINT          Status;\r
+  UINTN         Status;\r
   UINT8         *SrcBuf;\r
   UINT8         *DstBuf;\r
   UINT8         *TmpBuf;\r
   Py_ssize_t    SegNum;\r
   Py_ssize_t    Index;\r
 \r
-  Status = PyArg_ParseTupleAndKeywords(\r
+  Status = PyArg_ParseTuple(\r
             Args,\r
-            Keywords,\r
             "0ii",\r
             &SrcData,\r
             &SrcDataSize,\r
@@ -125,13 +121,13 @@ FrameworkDecompress(
     goto ERROR;\r
   }\r
 \r
-  SegNum = SrcData->tp_as_buffer->bf_getsegcount(SrcData, NULL);\r
-  TmpBuf = SrcBuf\r
+  SegNum = SrcData->tp_as_buffer->bf_getsegcount((PyObject *)SrcData, NULL);\r
+  TmpBuf = SrcBuf;\r
   for (Index = 0; Index < SegNum; ++Index) {\r
     VOID *BufSeg;\r
     Py_ssize_t Len;\r
 \r
-    Len = SrcData->tp_as_buffer->bf_getreadbuffer(SrcData, Index, &BufSeg);\r
+    Len = SrcData->tp_as_buffer->bf_getreadbuffer((PyObject *)SrcData, Index, &BufSeg);\r
     if (Len < 0) {\r
       goto ERROR;\r
     }\r
@@ -161,8 +157,7 @@ STATIC
 PyObject*\r
 UefiCompress(\r
   PyObject    *Self,\r
-  PyObject    *Args,\r
-  PyObject    *Keywords\r
+  PyObject    *Args\r
   ) \r
 {\r
   return NULL;\r
@@ -173,26 +168,25 @@ STATIC
 PyObject*\r
 FrameworkCompress(\r
   PyObject    *Self,\r
-  PyObject    *Args,\r
-  PyObject    *Keywords\r
+  PyObject    *Args\r
   )\r
 {\r
   return NULL;\r
 }\r
 \r
-STATIC CHAR DecompressDocs[] = "Decompress(): Decompress data using UEFI standard algorithm\n";\r
-STATIC CHAR CompressDocs[] = "Compress(): Compress data using UEFI standard algorithm\n";\r
+STATIC INT8 DecompressDocs[] = "Decompress(): Decompress data using UEFI standard algorithm\n";\r
+STATIC INT8 CompressDocs[] = "Compress(): Compress data using UEFI standard algorithm\n";\r
 \r
 STATIC PyMethodDef EfiCompressor_Funcs[] = {\r
-  {"UefiDecompress", (PyCFunction)UefiDecompress, METH_KEYWORDS, DecompressDocs},\r
-  {"UefiCompress", (PyCFunction)UefiCompress, METH_KEYWORDS, DecompressDocs},\r
-  {"FrameworkDecompress", (PyCFunction)FrameworkDecompress, METH_KEYWORDS, DecompressDocs},\r
-  {"FrameworkCompress", (PyCFunction)FrameworkCompress, METH_KEYWORDS, DecompressDocs},\r
+  {"UefiDecompress", (PyCFunction)UefiDecompress, METH_VARARGS, DecompressDocs},\r
+  {"UefiCompress", (PyCFunction)UefiCompress, METH_VARARGS, DecompressDocs},\r
+  {"FrameworkDecompress", (PyCFunction)FrameworkDecompress, METH_VARARGS, DecompressDocs},\r
+  {"FrameworkCompress", (PyCFunction)FrameworkCompress, METH_VARARGS, DecompressDocs},\r
   {NULL, NULL, 0, NULL}\r
 };\r
 \r
 PyMODINIT_FUNC\r
-InitEfiCompressor(VOID) {\r
+initEfiCompressor(VOID) {\r
   Py_InitModule3("EfiCompressor", EfiCompressor_Funcs, "EFI Compression Algorithm Extension Module");\r
 }\r
 \r
index 45af8b1..27f898d 100644 (file)
@@ -33,14 +33,18 @@ setup(
                 ],\r
             include_dirs=[\r
                 os.path.join(BaseToolsDir, 'Source', 'C', 'Include'),\r
+                os.path.join(BaseToolsDir, 'Source', 'C', 'Include', 'Ia32'),\r
                 os.path.join(BaseToolsDir, 'Source', 'C', 'Common')\r
                 ],\r
             library_dirs=[\r
                 os.path.join(os.environ['BASE_TOOLS_PATH'], 'Lib', 'Win32')\r
                 ],\r
             libraries=[\r
-                'Common.lib'\r
+                'Common'\r
                 ],\r
+            extra_link_args=[\r
+                "/NODEFAULTLIB:LIBCMTD"\r
+                ]\r
             )\r
         ],\r
   )\r