From bf4667cfceb0533267591edb96f91eb21a3bb218 Mon Sep 17 00:00:00 2001 From: Daiyuu Nobori Date: Sun, 4 Aug 2019 10:35:16 +0900 Subject: [PATCH] Fix several compile warnings on MS VC++ 2008. --- src/Cedar/Sam.c | 12 ++++++------ src/Mayaqua/Encrypt.c | 10 +++++----- src/Mayaqua/Network.c | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Cedar/Sam.c b/src/Cedar/Sam.c index b863f245..49eeb575 100644 --- a/src/Cedar/Sam.c +++ b/src/Cedar/Sam.c @@ -195,13 +195,13 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna return false; } - if (base64_enc_len(strlen(name)) < sizeof(buffer)-1 && - base64_enc_len(strlen(password)) < sizeof(buffer)-1 && - base64_enc_len(strlen(domainname)) < sizeof(buffer)-1) + if (base64_enc_len((unsigned int)strlen(name)) < sizeof(buffer)-1 && + base64_enc_len((unsigned int)strlen(password)) < sizeof(buffer)-1 && + base64_enc_len((unsigned int)strlen(domainname)) < sizeof(buffer)-1) { char answer[300]; - unsigned int end = B64_Encode(buffer, name, strlen(name)); + unsigned int end = B64_Encode(buffer, name, (int)strlen(name)); buffer[end] = '\0'; fputs("Username:: ", out); fputs(buffer, out); @@ -209,7 +209,7 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna Debug("Username: %s\n", buffer); buffer[0] = 0; - end = B64_Encode(buffer, domainname, strlen(domainname)); + end = B64_Encode(buffer, domainname, (int)strlen(domainname)); buffer[end] = '\0'; fputs("NT-Domain:: ", out); fputs(buffer, out); @@ -220,7 +220,7 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna if (password[0] != '\0') { Debug("Password authentication\n"); - end = B64_Encode(buffer, password, strlen(password)); + end = B64_Encode(buffer, password, (int)strlen(password)); buffer[end] = '\0'; fputs("Password:: ", out); fputs(buffer, out); diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index de74c531..502aa8d5 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -1650,12 +1650,12 @@ X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial) // Set the Expiration t1 = X509_get0_notBefore(x509); t2 = X509_get0_notAfter(x509); - if (!UINT64ToAsn1Time(t1, notBefore)) + if (!UINT64ToAsn1Time((void *)t1, notBefore)) { FreeX509(x509); return NULL; } - if (!UINT64ToAsn1Time(t2, notAfter)) + if (!UINT64ToAsn1Time((void *)t2, notAfter)) { FreeX509(x509); return NULL; @@ -1792,12 +1792,12 @@ X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial) // Set the Expiration t1 = X509_get0_notBefore(x509); t2 = X509_get0_notAfter(x509); - if (!UINT64ToAsn1Time(t1, notBefore)) + if (!UINT64ToAsn1Time((void *)t1, notBefore)) { FreeX509(x509); return NULL; } - if (!UINT64ToAsn1Time(t2, notAfter)) + if (!UINT64ToAsn1Time((void *)t2, notAfter)) { FreeX509(x509); return NULL; @@ -4432,7 +4432,7 @@ static UINT Internal_HMac(const EVP_MD *md, void *dest, void *key, UINT key_size goto final; } - len = MdProcess(m, dest, src, src_size); + len = MdProcess(m, dest, (void *)src, src_size); if (len == 0) { Debug("Internal_HMac(): MdProcess() returned 0!\n"); diff --git a/src/Mayaqua/Network.c b/src/Mayaqua/Network.c index d9567c8f..d484a601 100644 --- a/src/Mayaqua/Network.c +++ b/src/Mayaqua/Network.c @@ -5563,7 +5563,7 @@ int SslCertVerifyCallback(int preverify_ok, X509_STORE_CTX *ctx) if (!preverify_ok) { const char *msg = X509_verify_cert_error_string(clientcert->PreverifyErr); - StrCpy(clientcert->PreverifyErrMessage, PREVERIFY_ERR_MESSAGE_SIZE, msg); + StrCpy(clientcert->PreverifyErrMessage, PREVERIFY_ERR_MESSAGE_SIZE, (char *)msg); Debug("SslCertVerifyCallback preverify error: '%s'\n", msg); } else @@ -16532,12 +16532,12 @@ TOKEN_LIST *GetCipherList() sk = SSL_get_ciphers(ssl); #endif - for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) + for (i = 0; i < (UINT)sk_SSL_CIPHER_num(sk); i++) { const SSL_CIPHER *c = sk_SSL_CIPHER_value(sk, i); name = SSL_CIPHER_get_name(c); - if (IsEmptyStr(name)) + if (IsEmptyStr((char *)name)) { break; } @@ -16553,7 +16553,7 @@ TOKEN_LIST *GetCipherList() ciphers->Token = Malloc(sizeof(char *)); } - ciphers->Token[i] = CopyStr(name); + ciphers->Token[i] = CopyStr((char *)name); } sk_SSL_CIPHER_free(sk);