*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/scansup.c,v 1.40 2010/05/08 16:39:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/scansup.c,v 1.41 2010/05/09 02:15:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (warn)
{
/*
- * Cannot use %.*s here because some machines interpret %s's
- * precision in characters, others in bytes.
+ * We avoid using %.*s here because it can misbehave if the data
+ * is not valid in what libc thinks is the prevailing encoding.
*/
char buf[NAMEDATALEN];
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.31 2010/05/08 16:39:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.32 2010/05/09 02:15:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifdef WPARSER_TRACE
/*
- * Use of %.*s here is not portable when the string contains multibyte
- * characters: some machines interpret the length in characters, others
- * in bytes. Since it's only a debugging aid, we haven't bothered to
- * fix this.
+ * Use of %.*s here is a bit risky since it can misbehave if the data
+ * is not in what libc thinks is the prevailing encoding. However,
+ * since this is just a debugging aid, we choose to live with that.
*/
fprintf(stderr, "parsing \"%.*s\"\n", len, str);
#endif
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.211 2010/05/08 16:39:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.212 2010/05/09 02:15:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
AppendTimestampSeconds(str + strlen(str), tm, fsec);
/*
- * Note: the uses of %.*s in this function would be unportable
- * if the timezone names ever contain non-ASCII characters,
- * since some platforms think the string length is measured
- * in characters not bytes. However, all TZ abbreviations in
- * the Olson database are plain ASCII.
+ * Note: the uses of %.*s in this function would be risky if the
+ * timezone names ever contain non-ASCII characters. However, all
+ * TZ abbreviations in the Olson database are plain ASCII.
*/
if (tzp != NULL && tm->tm_isdst >= 0)
*
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.125 2010/05/08 16:39:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.126 2010/05/09 02:15:59 tgl Exp $
*/
#include "postgres_fe.h"
/*
* fputnbytes: print exactly N bytes to a file
*
- * Think not to use fprintf with a %.*s format for this. Some machines
- * believe %s's precision is measured in characters, others in bytes.
+ * We avoid using %.*s here because it can misbehave if the data
+ * is not valid in what libc thinks is the prevailing encoding.
*/
static void
fputnbytes(FILE *f, const char *str, size_t n)
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.52 2010/05/08 16:39:52 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.53 2010/05/09 02:15:59 tgl Exp $ */
#include "postgres_fe.h"
sprintf(str + strlen(str), " BC");
/*
- * Note: the uses of %.*s in this function would be unportable
- * if the timezone names ever contain non-ASCII characters,
- * since some platforms think the string length is measured
- * in characters not bytes. However, all TZ abbreviations in
- * the Olson database are plain ASCII.
+ * Note: the uses of %.*s in this function would be risky if the
+ * timezone names ever contain non-ASCII characters. However, all
+ * TZ abbreviations in the Olson database are plain ASCII.
*/
if (tzp != NULL && tm->tm_isdst >= 0)
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.142 2010/05/08 16:39:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.143 2010/05/09 02:16:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/*
* fputnbytes: print exactly N bytes to a file
*
- * Think not to use fprintf with a %.*s format for this. Some machines
- * believe %s's precision is measured in characters, others in bytes.
+ * We avoid using %.*s here because it can misbehave if the data
+ * is not valid in what libc thinks is the prevailing encoding.
*/
static void
fputnbytes(FILE *f, const char *str, size_t n)