The isxdigit() calls relied on undefined behavior. The isascii() call
was well-defined, but our prevailing style is to include the cast.
Back-patch to 9.4, where the isxdigit() calls were introduced.
if (GET_MAJOR_VERSION(cluster->major_version) <= 803)
{
for (p = bufin; *p; p++)
- if (!isascii(*p))
+ if (!isascii((unsigned char) *p))
pg_fatal("The 8.3 cluster's pg_controldata is incapable of outputting ASCII, even\n"
"with LANG=C. You must upgrade this cluster to a newer version of PostgreSQL\n"
"8.3 to fix this bug. PostgreSQL 8.3.7 and later are known to work properly.\n");
* only unicode escape that should be present is \u0000,
* all the other unicode escapes will have been resolved.
*/
- if (p[1] == 'u' && isxdigit(p[2]) && isxdigit(p[3])
- && isxdigit(p[4]) && isxdigit(p[5]))
+ if (p[1] == 'u' &&
+ isxdigit((unsigned char) p[2]) &&
+ isxdigit((unsigned char) p[3]) &&
+ isxdigit((unsigned char) p[4]) &&
+ isxdigit((unsigned char) p[5]))
appendStringInfoCharMacro(buf, *p);
else
appendStringInfoString(buf, "\\\\");