2
0

C type fixes.

This commit is contained in:
Maarten Billemont 2018-06-25 12:25:17 -04:00
parent 8276d2f4e5
commit b1698ee339
2 changed files with 6 additions and 6 deletions

View File

@ -66,9 +66,9 @@ const char **mpw_strings(size_t *count, const char *strings, ...) {
va_list args; va_list args;
va_start( args, strings ); va_start( args, strings );
char **array = NULL; const char **array = NULL;
size_t arraySize = 0; size_t arraySize = 0;
for (const char *string; string = va_arg( args, const char * );) { for (const char *string; (string = va_arg( args, const char * ));) {
size_t cursor = arraySize; size_t cursor = arraySize;
if (!mpw_realloc( &array, &arraySize, sizeof(string) )) { if (!mpw_realloc( &array, &arraySize, sizeof(string) )) {
mpw_free( &array, arraySize ); mpw_free( &array, arraySize );
@ -311,7 +311,7 @@ static uint8_t const *mpw_aes(bool encrypt, const uint8_t *key, const size_t key
AES_CBC_encrypt_buffer( resultBuf, aesBuf, aesSize, key, iv ); AES_CBC_encrypt_buffer( resultBuf, aesBuf, aesSize, key, iv );
else else
AES_CBC_decrypt_buffer( resultBuf, aesBuf, aesSize, key, iv ); AES_CBC_decrypt_buffer( resultBuf, aesBuf, aesSize, key, iv );
mpw_free( aesBuf, aesSize ); mpw_free( &aesBuf, aesSize );
// Truncate PKCS#7 padding // Truncate PKCS#7 padding
if (encrypt) if (encrypt)
@ -516,7 +516,7 @@ char *mpw_strndup(const char *src, size_t max) {
return dst; return dst;
} }
int *mpw_strncasecmp(const char *s1, const char *s2, size_t max) { int mpw_strncasecmp(const char *s1, const char *s2, size_t max) {
if (s1 && s2 && max) if (s1 && s2 && max)
for (; --max > 0; ++s1, ++s2) { for (; --max > 0; ++s1, ++s2) {

View File

@ -216,6 +216,6 @@ char *mpw_strdup(const char *src);
/** Drop-in for POSIX strndup(3). */ /** Drop-in for POSIX strndup(3). */
char *mpw_strndup(const char *src, size_t max); char *mpw_strndup(const char *src, size_t max);
/** Drop-in for POSIX strncasecmp(3). */ /** Drop-in for POSIX strncasecmp(3). */
int *mpw_strncasecmp(const char *s1, const char *s2, size_t max); int mpw_strncasecmp(const char *s1, const char *s2, size_t max);
#endif // _MPW_UTIL_H #endif // _MPW_UTIL_H