Windows: comparisons of nul strings should match

When comparing nul strings in cm_strnicmp_utf8 and cm_strnicmp_utf16
the functions should return 0.

LICENSE MIT

Change-Id: I30c1321f42135a5e0160407467549b13cc92393f
Reviewed-on: http://gerrit.openafs.org/2539
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2010-08-12 00:48:44 -04:00 committed by Jeffrey Altman
parent 3daf18a3cb
commit 03f76092bd

View File

@ -1113,6 +1113,9 @@ int cm_strnicmp_utf8(const char * str1, const char * str2, int n)
if (!nls_init) if (!nls_init)
cm_InitNormalization(); cm_InitNormalization();
if (n == 0)
return 0;
/* first check for NULL pointers (assume NULL < "") */ /* first check for NULL pointers (assume NULL < "") */
if (str1 == NULL) { if (str1 == NULL) {
if (str2 == NULL) if (str2 == NULL)
@ -1159,6 +1162,9 @@ int cm_strnicmp_utf16(const cm_unichar_t * str1, const cm_unichar_t * str2, int
if (!nls_init) if (!nls_init)
cm_InitNormalization(); cm_InitNormalization();
if (len == 0)
return 0;
/* first check for NULL pointers */ /* first check for NULL pointers */
if (str1 == NULL) { if (str1 == NULL) {
if (str2 == NULL) if (str2 == NULL)