Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5d7f699

Browse files
committed
Use (unsigned char) cast in argument of pg_tolower(). Maybe it works on
Windows without that, but we shouldn't put bad examples where people might copy them. Also, reformat slightly to improve the odds that pgindent won't go nuts on this.
1 parent 1b2bb33 commit 5d7f699

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/port/path.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.77 2009/04/03 11:52:08 mha Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.78 2009/04/03 23:27:17 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -420,20 +420,22 @@ get_progname(const char *argv0)
420420

421421

422422
/*
423-
* dir_strcmp: strcmp except any two DIR_SEP characters are considered equal
423+
* dir_strcmp: strcmp except any two DIR_SEP characters are considered equal,
424+
* and we honor filesystem case insensitivity if known
424425
*/
425426
static int
426427
dir_strcmp(const char *s1, const char *s2)
427428
{
428429
while (*s1 && *s2)
429430
{
431+
if (
430432
#ifndef WIN32
431-
if (*s1 != *s2 &&
433+
*s1 != *s2
432434
#else
433435
/* On windows, paths are case-insensitive */
434-
if (pg_tolower(*s1) != pg_tolower(*s2) &&
436+
pg_tolower((unsigned char) *s1) != pg_tolower((unsigned char) *s2)
435437
#endif
436-
!(IS_DIR_SEP(*s1) && IS_DIR_SEP(*s2)))
438+
&& !(IS_DIR_SEP(*s1) && IS_DIR_SEP(*s2)))
437439
return (int) *s1 - (int) *s2;
438440
s1++, s2++;
439441
}

0 commit comments

Comments
 (0)