summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/string.c6
-rw-r--r--src/tests/string_test.c1
2 files changed, 4 insertions, 3 deletions
diff --git a/src/core/string.c b/src/core/string.c
index 5a185e63..5bd9dae8 100644
--- a/src/core/string.c
+++ b/src/core/string.c
@@ -173,7 +173,7 @@ int strncmp ( const char *first, const char *second, size_t max ) {
int diff;
for ( ; max-- ; first_bytes++, second_bytes++ ) {
- diff = ( *second_bytes - *first_bytes );
+ diff = ( *first_bytes - *second_bytes );
if ( diff )
return diff;
if ( ! *first_bytes )
@@ -195,8 +195,8 @@ int strcasecmp ( const char *first, const char *second ) {
int diff;
for ( ; ; first_bytes++, second_bytes++ ) {
- diff = ( toupper ( *second_bytes ) -
- toupper ( *first_bytes ) );
+ diff = ( toupper ( *first_bytes ) -
+ toupper ( *second_bytes ) );
if ( diff )
return diff;
if ( ! *first_bytes )
diff --git a/src/tests/string_test.c b/src/tests/string_test.c
index 4693b5f6..a66501da 100644
--- a/src/tests/string_test.c
+++ b/src/tests/string_test.c
@@ -88,6 +88,7 @@ static void string_test_exec ( void ) {
ok ( strcmp ( "Hello", "hello" ) != 0 );
ok ( strcmp ( "Hello", "Hello world!" ) != 0 );
ok ( strcmp ( "Hello world!", "Hello" ) != 0 );
+ ok ( strcmp ( "abc", "def" ) < 0 );
/* Test strncmp() */
ok ( strncmp ( "", "", 0 ) == 0 );