[xmlsec] fix compile warnings



commit 1e4f30850015b3962513fd1d88ca79ae23fdc632
Author: Aleksey Sanin <aleksey aleksey com>
Date:   Sun May 9 13:24:12 2010 -0700

    fix compile warnings

 src/gnutls/app.c      |   26 ++++++++++++++++++--------
 src/gnutls/kw_des.c   |    4 ++--
 src/kw_aes_des.c      |   12 ++++++------
 src/mscrypto/kw_des.c |    4 ++--
 src/nss/kw_des.c      |    4 ++--
 src/openssl/app.c     |    6 ++++--
 src/openssl/kw_des.c  |    4 ++--
 src/openssl/x509vfy.c |   16 ++++++++--------
 8 files changed, 44 insertions(+), 32 deletions(-)
---
diff --git a/src/gnutls/app.c b/src/gnutls/app.c
index 5b98c17..264a489 100644
--- a/src/gnutls/app.c
+++ b/src/gnutls/app.c
@@ -170,10 +170,13 @@ xmlSecGnuTLSAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecGnuTLSAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
-                                xmlSecKeyDataFormat format) {
+xmlSecGnuTLSAppKeyCertLoadMemory(xmlSecKeyPtr key,
+                                 const xmlSecByte* data,
+                                 xmlSecSize dataSize,
+                                 xmlSecKeyDataFormat format) {
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
+    xmlSecAssert2(dataSize > 0, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
 
     /* TODO */
@@ -231,9 +234,12 @@ xmlSecGnuTLSAppPkcs12Load(const char *filename,
  */
 xmlSecKeyPtr
 xmlSecGnuTLSAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
-                           const char *pwd, void* pwdCallback,
-                           void* pwdCallbackCtx) {
+                           const char *pwd ATTRIBUTE_UNUSED,
+                           void* pwdCallback ATTRIBUTE_UNUSED,
+                           void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     xmlSecAssert2(data != NULL, NULL);
+    xmlSecAssert2(dataSize > 0, NULL);
+
     /* TODO */
     xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
@@ -257,7 +263,8 @@ xmlSecGnuTLSAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
+xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, 
+                                const char *filename,
                                 xmlSecKeyDataFormat format,
                                 xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     xmlSecAssert2(mngr != NULL, -1);
@@ -287,11 +294,14 @@ xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecGnuTLSAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
-                                    xmlSecSize dataSize, xmlSecKeyDataFormat format,
-                                    xmlSecKeyDataType type) {
+xmlSecGnuTLSAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
+                                      const xmlSecByte* data,
+                                      xmlSecSize dataSize,
+                                      xmlSecKeyDataFormat format,
+                                      xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
+    xmlSecAssert2(dataSize > 0, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
 
     /* TODO */
diff --git a/src/gnutls/kw_des.c b/src/gnutls/kw_des.c
index a16a711..d6af1ef 100644
--- a/src/gnutls/kw_des.c
+++ b/src/gnutls/kw_des.c
@@ -467,7 +467,7 @@ xmlSecGnuTLSKWDes3BlockEncrypt(void * context,
     xmlSecAssert2(iv != NULL, -1);
     xmlSecAssert2(ivSize >= XMLSEC_KW_DES3_IV_LENGTH, -1);
     xmlSecAssert2(in != NULL, -1);
-    xmlSecAssert2(inSize >= 0, -1);
+    xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
 
@@ -503,7 +503,7 @@ xmlSecGnuTLSKWDes3BlockDecrypt(void * context,
     xmlSecAssert2(iv != NULL, -1);
     xmlSecAssert2(ivSize >= XMLSEC_KW_DES3_IV_LENGTH, -1);
     xmlSecAssert2(in != NULL, -1);
-    xmlSecAssert2(inSize >= 0, -1);
+    xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
 
diff --git a/src/kw_aes_des.c b/src/kw_aes_des.c
index 7164eb7..022e720 100644
--- a/src/kw_aes_des.c
+++ b/src/kw_aes_des.c
@@ -117,11 +117,11 @@ xmlSecKWDes3Encode(xmlSecKWDes3Id kwDes3Id, void *context,
     }
 
     /* step 5: first encryption, result is TEMP1 */
-    ret = kwDes3Id->encrypt(context, 
+    ret = kwDes3Id->encrypt(context,
                            iv, sizeof(iv),
                            out, inSize + XMLSEC_KW_DES3_BLOCK_LENGTH,
                            out, outSize);
-    if((ret < 0) || (ret != inSize + XMLSEC_KW_DES3_BLOCK_LENGTH)) {
+    if((ret < 0) || ((xmlSecSize)ret != inSize + XMLSEC_KW_DES3_BLOCK_LENGTH)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "kwDes3Id->encrypt",
@@ -132,7 +132,7 @@ xmlSecKWDes3Encode(xmlSecKWDes3Id kwDes3Id, void *context,
 
     /* step 6: construct TEMP2=IV || TEMP1 */
     memmove(out + XMLSEC_KW_DES3_IV_LENGTH, out, inSize + XMLSEC_KW_DES3_BLOCK_LENGTH);
-    memcpy(out, iv, XMLSEC_KW_DES3_IV_LENGTH); 
+    memcpy(out, iv, XMLSEC_KW_DES3_IV_LENGTH);
     s = inSize + XMLSEC_KW_DES3_BLOCK_LENGTH + XMLSEC_KW_DES3_IV_LENGTH;
 
     /* step 7: reverse octets order, result is TEMP3 */
@@ -147,11 +147,11 @@ xmlSecKWDes3Encode(xmlSecKWDes3Id kwDes3Id, void *context,
     }
 
     /* step 8: second encryption with static IV */
-    ret = kwDes3Id->encrypt(context, 
+    ret = kwDes3Id->encrypt(context,
                            xmlSecKWDes3Iv, sizeof(xmlSecKWDes3Iv),
-                           out, s, 
+                           out, s,
                            out, outSize);
-    if((ret < 0) || (ret != s)) {
+    if((ret < 0) || ((xmlSecSize)ret != s)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "kwDes3Id->encrypt",
diff --git a/src/mscrypto/kw_des.c b/src/mscrypto/kw_des.c
index 47e0671..c043d28 100644
--- a/src/mscrypto/kw_des.c
+++ b/src/mscrypto/kw_des.c
@@ -576,7 +576,7 @@ xmlSecMSCryptoKWDes3BlockEncrypt(void * context,
     xmlSecAssert2(iv != NULL, -1);
     xmlSecAssert2(ivSize >= XMLSEC_KW_DES3_IV_LENGTH, -1);
     xmlSecAssert2(in != NULL, -1);
-    xmlSecAssert2(inSize >= 0, -1);
+    xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
 
@@ -660,7 +660,7 @@ xmlSecMSCryptoKWDes3BlockDecrypt(void * context,
     xmlSecAssert2(iv != NULL, -1);
     xmlSecAssert2(ivSize >= XMLSEC_KW_DES3_IV_LENGTH, -1);
     xmlSecAssert2(in != NULL, -1);
-    xmlSecAssert2(inSize >= 0, -1);
+    xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
 
diff --git a/src/nss/kw_des.c b/src/nss/kw_des.c
index 90d7a26..e75f69c 100644
--- a/src/nss/kw_des.c
+++ b/src/nss/kw_des.c
@@ -483,7 +483,7 @@ xmlSecNssKWDes3BlockEncrypt(void * context,
     xmlSecAssert2(iv != NULL, -1);
     xmlSecAssert2(ivSize >= XMLSEC_KW_DES3_IV_LENGTH, -1);
     xmlSecAssert2(in != NULL, -1);
-    xmlSecAssert2(inSize >= 0, -1);
+    xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
 
@@ -518,7 +518,7 @@ xmlSecNssKWDes3BlockDecrypt(void * context,
     xmlSecAssert2(iv != NULL, -1);
     xmlSecAssert2(ivSize >= XMLSEC_KW_DES3_IV_LENGTH, -1);
     xmlSecAssert2(in != NULL, -1);
-    xmlSecAssert2(inSize >= 0, -1);
+    xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
 
diff --git a/src/openssl/app.c b/src/openssl/app.c
index 40cccd9..fe427ea 100644
--- a/src/openssl/app.c
+++ b/src/openssl/app.c
@@ -1590,10 +1590,12 @@ xmlSecOpenSSLDefaultPasswordCallback(char *buf, int bufsize, int verify, void *u
 }
 
 static int
-xmlSecOpenSSLDummyPasswordCallback(char *buf, int bufsize, int verify, void *userdata) {
+xmlSecOpenSSLDummyPasswordCallback(char *buf, int bufsize,
+                                   int verify ATTRIBUTE_UNUSED,
+                                   void *userdata) {
     char* password = (char*)userdata;
 
-    if((password == NULL) || (strlen(password) + 1 > bufsize)) {
+    if((password == NULL) || ((int)strlen(password) + 1 > bufsize)) {
         return(-1);
     }
 
diff --git a/src/openssl/kw_des.c b/src/openssl/kw_des.c
index a03fd14..9d55e10 100644
--- a/src/openssl/kw_des.c
+++ b/src/openssl/kw_des.c
@@ -441,7 +441,7 @@ xmlSecOpenSSLKWDes3BlockEncrypt(void * context,
     xmlSecAssert2(iv != NULL, -1);
     xmlSecAssert2(ivSize >= XMLSEC_KW_DES3_IV_LENGTH, -1);
     xmlSecAssert2(in != NULL, -1);
-    xmlSecAssert2(inSize >= 0, -1);
+    xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
 
@@ -476,7 +476,7 @@ xmlSecOpenSSLKWDes3BlockDecrypt(void * context,
     xmlSecAssert2(iv != NULL, -1);
     xmlSecAssert2(ivSize >= XMLSEC_KW_DES3_IV_LENGTH, -1);
     xmlSecAssert2(in != NULL, -1);
-    xmlSecAssert2(inSize >= 0, -1);
+    xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
 
diff --git a/src/openssl/x509vfy.c b/src/openssl/x509vfy.c
index 0fbeadb..fe51da4 100644
--- a/src/openssl/x509vfy.c
+++ b/src/openssl/x509vfy.c
@@ -174,9 +174,9 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
     xmlSecOpenSSLX509StoreCtxPtr ctx;
     STACK_OF(X509)* certs2 = NULL;
     STACK_OF(X509_CRL)* crls2 = NULL;
-    X509* res = NULL;
-    X509* cert;
-    X509 *err_cert = NULL;
+    X509 * res = NULL;
+    X509 * cert;
+    X509 * err_cert = NULL;
     char buf[256];
     int err = 0, depth;
     int i;
@@ -233,7 +233,7 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
             if(ret == 1) {
                 ++i;
             } else if(ret == 0) {
-                sk_X509_CRL_delete(crls2, i);
+                (void)sk_X509_CRL_delete(crls2, i);
             } else {
                 xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
@@ -252,7 +252,7 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
         if(crls2 != NULL) {
             ret = xmlSecOpenSSLX509VerifyCertAgainstCrls(crls2, cert);
             if(ret == 0) {
-                sk_X509_delete(certs2, i);
+                (void)sk_X509_delete(certs2, i);
                 continue;
             } else if(ret != 1) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -267,7 +267,7 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
         if(ctx->crls != NULL) {
             ret = xmlSecOpenSSLX509VerifyCertAgainstCrls(ctx->crls, cert);
             if(ret == 0) {
-                sk_X509_delete(certs2, i);
+                (void)sk_X509_delete(certs2, i);
                 continue;
             } else if(ret != 1) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1232,9 +1232,9 @@ xmlSecOpenSSLX509NamesCompare(X509_NAME *a, X509_NAME *b) {
     }
 
     /* sort both */
-    sk_X509_NAME_ENTRY_set_cmp_func(a1->entries, xmlSecOpenSSLX509_NAME_ENTRY_cmp);
+    (void)sk_X509_NAME_ENTRY_set_cmp_func(a1->entries, xmlSecOpenSSLX509_NAME_ENTRY_cmp);
     sk_X509_NAME_ENTRY_sort(a1->entries);
-    sk_X509_NAME_ENTRY_set_cmp_func(b1->entries, xmlSecOpenSSLX509_NAME_ENTRY_cmp);
+    (void)sk_X509_NAME_ENTRY_set_cmp_func(b1->entries, xmlSecOpenSSLX509_NAME_ENTRY_cmp);
     sk_X509_NAME_ENTRY_sort(b1->entries);
 
     /* actually compare */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]