While trying to building on Max OS against revision 3128,
I see I missed one of Nil's comments. The attached patch
uses the strings.h and stdlib.h and fixes the // comment.
It compiles on Ubuntu, XP and Mac OS 10.



Nils Larsch wrote:
Douglas E. Engert wrote:
...
------------------------------------------------------------------------

Index: src/libopensc/compression.c
...
+#include "internal.h"
+#ifdef HAVE_ZLIB_H
+#include "compression.h"
+
+#include <zlib.h>
+#include <memory.h>
+#include <malloc.h>

:s/memory.h/string.h/g
:s/malloc.h/stdlib.h/g

+#include "errors.h"
+
+static int zerr_to_opensc(int err) {
+    switch(err) {
+    case Z_OK:
+    case Z_STREAM_END:
+        return SC_SUCCESS;
+    case Z_UNKNOWN:
+        return SC_ERROR_UNKNOWN;
+    case Z_BUF_ERROR:
+    case Z_MEM_ERROR:
+        return SC_ERROR_MEMORY_FAILURE;
+    case Z_VERSION_ERROR:
+    case Z_DATA_ERROR:
+    case Z_STREAM_ERROR:
+    //case Z_NEED_DICT:

no c++ style comments please (some older compilers don't like them)

Index: src/libopensc/compression.h
...
+#ifndef COMPRESSION_H
+#define COMPRESSION_H
+
+#include "opensc.h"
+#include "types.h"
+
+#define COMPRESSION_AUTO    0
+#define COMPRESSION_ZLIB    1
+#define COMPRESSION_GZIP    2
+#define COMPRESSION_UNKNOWN (-1)
+
+int do_decompress_alloc(u8** out, size_t* outLen, const u8* in, size_t inLen, int method); +int do_decompress(u8* out, size_t* outLen, const u8* in, size_t inLen, int method);
+
+#endif

well, using the name do_decompress for an exported symbol will almost certainly
cause conflicts in larger projects using compression. I  *really* think it
would be better to give them a "sc_" prefix (the same is true for the constants
defined in this file).
Btw: a bit of doxygen docu would be nice.

+


------------------------------------------------------------------------

Index: src/libopensc/p15card-helper.c
...
+#include "p15card-helper.h"
+#include <opensc/opensc.h>
+#include <opensc/types.h>
+#include <opensc/log.h>
+#include <opensc/pkcs15.h>
+#include <memory.h>
+#include <malloc.h>

see above comment

...
+
+int initialize_objects(sc_pkcs15_card_t *p15card, p15data_items* items);
+int initialize_certificates(sc_pkcs15_card_t *p15card, p15data_items* items);
+int initialize_pins(sc_pkcs15_card_t *p15card, p15data_items *items);
+int initialize_private_keys(sc_pkcs15_card_t *p15card, p15data_items *items); +int initialize_public_keys(sc_pkcs15_card_t *p15card, p15data_items *items);
+int initialize_all(sc_pkcs15_card_t *p15card, p15data_items *items);

again some very unfotunate names (note: the fact that opensc doesn't export
this header file doesn't mean that the object isn't visible in the library) ...

Nils



--

 Douglas E. Engert  <[EMAIL PROTECTED]>
 Argonne National Laboratory
 9700 South Cass Avenue
 Argonne, Illinois  60439
 (630) 252-5444
Index: src/libopensc/compression.c
===================================================================
--- src/libopensc/compression.c	(revision 3128)
+++ src/libopensc/compression.c	(working copy)
@@ -22,8 +22,8 @@
 #include "compression.h"
 
 #include <zlib.h>
-#include <memory.h>
-#include <malloc.h>
+#include <string.h>
+#include <stdlib.h>
 #include "errors.h"
 
 static int zerr_to_opensc(int err) {
@@ -39,7 +39,7 @@
 	case Z_VERSION_ERROR:
 	case Z_DATA_ERROR:
 	case Z_STREAM_ERROR:
-	//case Z_NEED_DICT:
+	/* case Z_NEED_DICT: */
 	default:
 		return SC_ERROR_INTERNAL;
 	}
Index: src/libopensc/p15card-helper.c
===================================================================
--- src/libopensc/p15card-helper.c	(revision 3128)
+++ src/libopensc/p15card-helper.c	(working copy)
@@ -23,8 +23,8 @@
 #include <opensc/types.h>
 #include <opensc/log.h>
 #include <opensc/pkcs15.h>
-#include <memory.h>
-#include <malloc.h>
+#include <string.h>
+#include <stdlib.h>
 #include <openssl/bio.h>
 #include <openssl/rsa.h>
 #include <openssl/x509.h>
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to