]> pd.if.org Git - pdclib/commitdiff
Type mismatches give compiler warnings. Fixed.
authorMartin Baute <solar@rootdirectory.de>
Fri, 11 Mar 2016 06:22:05 +0000 (07:22 +0100)
committerMartin Baute <solar@rootdirectory.de>
Fri, 11 Mar 2016 06:22:05 +0000 (07:22 +0100)
functions/stdio/_PDCLIB_print.c
functions/stdio/_PDCLIB_scan.c
functions/string/strdup.c
functions/string/strndup.c

index e832782fd32c45c37fc2a2e1342cff3729608540..f264a6178cdb1520e575667839f320c83acc5267 100644 (file)
@@ -614,7 +614,7 @@ static int testprintf( char * buffer, const char * format, ... )
     status.write = testcb;
     va_start( status.arg, format );
     memset( buffer, '\0', 100 );
-    if ( _PDCLIB_print( format, &status ) != strlen( format ) )
+    if ( _PDCLIB_print( format, &status ) != (int)strlen( format ) )
     {
         printf( "_PDCLIB_print() did not return end-of-specifier on '%s'.\n", format );
         ++TEST_RESULTS;
index 9940fc028e07b1b9166fc50972fd4d0032dfdf5d..c3429ecde125da9ba9284b8ec5ed917d7d4b4013 100644 (file)
@@ -257,7 +257,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status )
         {
             char * c = va_arg( status->arg, char * );
             /* for %c, default width is one */
-            if ( status->width == SIZE_MAX )
+            if ( status->width == UINT_MAX )
             {
                 status->width = 1;
             }
index 6ed0f832feef21b29ec9871c622c6661c75a7b4b..d8792f30b72a98af858720b3c9a7c93a89630226 100644 (file)
@@ -32,13 +32,13 @@ int main( void )
     const char *teststr2 = "An alternative test string with non-7-bit characters \xFE\x8C\n";\r
     char *testres, *testres2;\r
 \r
-    TESTCASE(testres  = strdup(teststr));\r
-    TESTCASE(testres2 = strdup(teststr2));\r
+    TESTCASE((testres  = strdup(teststr)) != NULL);\r
+    TESTCASE((testres2 = strdup(teststr2)) != NULL);\r
     TESTCASE(strcmp(testres, teststr) == 0);\r
     TESTCASE(strcmp(testres2, teststr2) == 0);\r
     free(testres);\r
     free(testres2);\r
-    \r
+\r
     return TEST_RESULTS;\r
 }\r
 \r
index e50f419ded982705b0e9e5530299f080c0a40f54..b96a86e86fd849baff544741e1ed016f2df929e6 100644 (file)
@@ -37,16 +37,16 @@ int main( void )
     const char *teststr2 = "\xFE\x8C\n";\r
     char *testres, *testres2;\r
 \r
-    TESTCASE(testres  = strndup(teststr, 5));\r
-    TESTCASE(testres2 = strndup(teststr2, 1));\r
+    TESTCASE((testres  = strndup(teststr, 5)) != NULL);\r
+    TESTCASE((testres2 = strndup(teststr2, 1)) != NULL);\r
     TESTCASE(strcmp(testres, teststr) != 0);\r
     TESTCASE(strncmp(testres, teststr, 5) == 0);\r
     TESTCASE(strcmp(testres2, teststr2) != 0);\r
     TESTCASE(strncmp(testres2, teststr2, 1) == 0);\r
     free(testres);\r
     free(testres2);\r
-    TESTCASE(testres  = strndup(teststr, 20));\r
-    TESTCASE(testres2 = strndup(teststr2, 5));\r
+    TESTCASE((testres  = strndup(teststr, 20)) != NULL);\r
+    TESTCASE((testres2 = strndup(teststr2, 5)) != NULL);\r
     TESTCASE(strcmp(testres, teststr) == 0);\r
     TESTCASE(strcmp(testres2, teststr2) == 0);\r
     free(testres);\r