فهرست منبع

2008-10-29 Marcus Brinkmann <marcus@g10code.de>

	* configure.ac (_ASSUAN_ONLY_GPG_ERRORS): Define it.
	* src/agent.c (default_inq_cb): Change return type to gpg_error_t
	to silence gcc -W warning.
	* src/cert-gpgsm.c (search_certs, export_cert_cb): Change type of
	argument to silence gcc -W warning.
	* src/p11-findobjects.c (CK_DEFINE_FUNCTION): Add explicit cast to
	silence gcc -W warning.
	* src/table.c (struct scute_table): Change signedness of
	FIRST_FREE and LAST_USED members to silence gcc -W warning.
	(scute_table_alloc): Change signedness of IDX for the same reason.
	* tests/t-getslotinfo.c, tests/t-getsessioninfo.c,
	tests/t-getmechanismlist.c, tests/t-auth.c,
	tests/t-getattribute.c, tests/t-opensession.c,
	tests/t-getslotlist.c, tests/t-getmechanisminfo.c,
	tests/t-support.h, tests/t-closeallsessions.c,
	tests/t-findobjects.c, tests/t-gettokeninfo.c: Change signedness
	of some variables to silence gcc -W warnings.
Marcus Brinkmann 16 سال پیش
والد
کامیت
6886e89f99

+ 20 - 0
ChangeLog

@@ -1,3 +1,23 @@
+2008-10-29  Marcus Brinkmann  <marcus@g10code.de>
+
+	* configure.ac (_ASSUAN_ONLY_GPG_ERRORS): Define it.
+	* src/agent.c (default_inq_cb): Change return type to gpg_error_t
+	to silence gcc -W warning.
+	* src/cert-gpgsm.c (search_certs, export_cert_cb): Change type of
+	argument to silence gcc -W warning.
+	* src/p11-findobjects.c (CK_DEFINE_FUNCTION): Add explicit cast to
+	silence gcc -W warning.
+	* src/table.c (struct scute_table): Change signedness of
+	FIRST_FREE and LAST_USED members to silence gcc -W warning.
+	(scute_table_alloc): Change signedness of IDX for the same reason.
+	* tests/t-getslotinfo.c, tests/t-getsessioninfo.c,
+	tests/t-getmechanismlist.c, tests/t-auth.c,
+	tests/t-getattribute.c, tests/t-opensession.c,
+	tests/t-getslotlist.c, tests/t-getmechanisminfo.c,
+	tests/t-support.h, tests/t-closeallsessions.c,
+	tests/t-findobjects.c, tests/t-gettokeninfo.c: Change signedness
+	of some variables to silence gcc -W warnings.
+
 2008-10-21  Marcus Brinkmann  <marcus@g10code.com>
 
 	* src/slots.c (slots_update_slot): Ignore card errors.

+ 2 - 0
configure.ac

@@ -126,6 +126,8 @@ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
 AC_DEFINE_UNQUOTED(VERSION_MAJOR, $VERSION_MAJOR, [Major version number])
 AC_DEFINE_UNQUOTED(VERSION_MINOR, $VERSION_MINOR, [Minor version number])
 
+AC_DEFINE_UNQUOTED(_ASSUAN_ONLY_GPG_ERRORS, 1, [Disable backward compatibility])
+
 # Don't default to build static libs.
 AC_DISABLE_STATIC
 AC_LIBTOOL_WIN32_DLL

+ 1 - 1
src/agent.c

@@ -370,7 +370,7 @@ agent_connect (assuan_context_t *ctx_r)
 
 /* This is the default inquiry callback.  It mainly handles the
    Pinentry notifications.  */
-static int
+static gpg_error_t
 default_inq_cb (void *opaque, const char *line)
 {
   (void)opaque;

+ 4 - 2
src/cert-gpgsm.c

@@ -436,9 +436,10 @@ search_certs_line (struct search_ctx *ctx)
    handles the EOF signal provided directly by
    scute_gpgsm_search_certs.  */
 static gpg_error_t
-search_certs (void *hook, char *line, size_t line_len)
+search_certs (void *hook, const void *line_data, size_t line_len)
 {
   struct search_ctx *ctx = hook;
+  const char *line = line_data;
   gpg_error_t err;
 
   if (!line)
@@ -615,9 +616,10 @@ struct export_hook
 #define EXP_DATA_START 4096
 
 static gpg_error_t
-export_cert_cb (void *hook, char *line, size_t line_len)
+export_cert_cb (void *hook, const void *line_data, size_t line_len)
 {
   struct export_hook *exp = hook;
+  const char *line = line_data;
 
   if (exp->buffer_size - exp->buffer_len < line_len)
     {

+ 1 - 1
src/p11-findobjects.c

@@ -67,7 +67,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_FindObjects)
   err = session_get_search_result (slot, session, &oids, &oids_len);
   assert (!err);
 
-  count = MIN (ulMaxObjectCount, oids_len);
+  count = MIN ((int) ulMaxObjectCount, oids_len);
   memcpy (phObject, oids, sizeof (CK_OBJECT_HANDLE) * count);
 
   oids_len = oids_len - count;

+ 3 - 3
src/table.c

@@ -66,10 +66,10 @@ struct scute_table
   int used;
 
   /* The index of the lowest entry that is unused.  */
-  unsigned int first_free;
+  int first_free;
 
   /* The index after the highest entry that is used.  */
-  unsigned int last_used;
+  int last_used;
 
   /* The allocator and deallocator callback.  */
   scute_table_alloc_cb_t alloc;
@@ -172,7 +172,7 @@ scute_table_alloc (scute_table_t table, int *index_r, void **data_r,
 		   void *hook)
 {
   gpg_error_t err;
-  unsigned int idx;
+  int idx;
   void *data;
 
   if (table->used == table->size)

+ 1 - 1
tests/t-auth.c

@@ -92,7 +92,7 @@ main (int argc, char *argv[])
   CK_RV err;
   CK_SLOT_ID_PTR slots;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   init_cryptoki ();
 

+ 1 - 1
tests/t-closeallsessions.c

@@ -40,7 +40,7 @@ main (int argc, char *argv[])
   CK_SLOT_ID_PTR slots;
   CK_SESSION_HANDLE_PTR sessions;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   init_cryptoki ();
 

+ 1 - 1
tests/t-findobjects.c

@@ -39,7 +39,7 @@ main (int argc, char *argv[])
   CK_RV err;
   CK_SLOT_ID_PTR slots;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   init_cryptoki ();
 

+ 4 - 4
tests/t-getattribute.c

@@ -37,12 +37,12 @@
 bool printable;
 
 CK_RV
-dump_one (CK_ATTRIBUTE_PTR attr, unsigned char *data, int max_size)
+dump_one (CK_ATTRIBUTE_PTR attr, unsigned char *data, unsigned int max_size)
 {
-  int i;
+  unsigned int i;
   int col;
 
-  if (attr->ulValueLen < 0 || attr->ulValueLen > max_size)
+  if (attr->ulValueLen > max_size)
     return CKR_GENERAL_ERROR;
 
   col = 0;
@@ -526,7 +526,7 @@ main (int argc, char *argv[])
   CK_RV err;
   CK_SLOT_ID_PTR slots;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   if (argc > 1 && !strcmp ("--printable", argv[1]))
     printable = true;

+ 2 - 2
tests/t-getmechanisminfo.c

@@ -39,7 +39,7 @@ main (int argc, char *argv[])
   CK_RV err;
   CK_SLOT_ID_PTR slots;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   init_cryptoki ();
 
@@ -64,7 +64,7 @@ main (int argc, char *argv[])
     {
       CK_MECHANISM_TYPE_PTR mechanisms;
       CK_ULONG mechanisms_count;
-      int j;
+      unsigned int j;
 
       printf ("%2i. Slot ID %lu\n", i, slots[i]);
 

+ 2 - 2
tests/t-getmechanismlist.c

@@ -39,7 +39,7 @@ main (int argc, char *argv[])
   CK_RV err;
   CK_SLOT_ID_PTR slots;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   init_cryptoki ();
 
@@ -64,7 +64,7 @@ main (int argc, char *argv[])
     {
       CK_MECHANISM_TYPE_PTR mechanisms;
       CK_ULONG mechanisms_count;
-      int j;
+      unsigned int j;
 
       printf ("%2i. Slot ID %lu\n", i, slots[i]);
 

+ 1 - 1
tests/t-getsessioninfo.c

@@ -40,7 +40,7 @@ main (int argc, char *argv[])
   CK_SLOT_ID_PTR slots;
   CK_SESSION_HANDLE_PTR sessions;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   init_cryptoki ();
 

+ 1 - 1
tests/t-getslotinfo.c

@@ -39,7 +39,7 @@ main (int argc, char *argv[])
   bool token = false;
   CK_SLOT_ID_PTR slots;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   if (argc > 1)
     token = true;

+ 1 - 1
tests/t-getslotlist.c

@@ -39,7 +39,7 @@ main (int argc, char *argv[])
   bool token = false;
   CK_SLOT_ID_PTR slots;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   if (argc > 1)
     token = true;

+ 1 - 1
tests/t-gettokeninfo.c

@@ -38,7 +38,7 @@ main (int argc, char *argv[])
   CK_RV err;
   CK_SLOT_ID_PTR slots;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   init_cryptoki ();
 

+ 1 - 1
tests/t-opensession.c

@@ -40,7 +40,7 @@ main (int argc, char *argv[])
   CK_SLOT_ID_PTR slots;
   CK_SESSION_HANDLE_PTR sessions;
   CK_ULONG slots_count;
-  int i;
+  unsigned int i;
 
   init_cryptoki ();
 

+ 1 - 1
tests/t-support.h

@@ -190,7 +190,7 @@ const char *msg[] =
     "Function rejected" };
 
 #define ERRMSG(nr) ((nr) == CKR_VENDOR_DEFINED ? "Vendor defined" :	\
-		    (((nr) < 0 || (nr) > sizeof (msg) / sizeof (msg[0])) ? \
+		    ((nr) > sizeof (msg) / sizeof (msg[0]) ?		\
 		     "(unknown error code)" : msg[(nr)]))