pg_locale_20100318.patch
application/octet-stream
Filename: pg_locale_20100318.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/backend/utils/adt/pg_locale.c | 32 | 10 |
| src/port/chklocale.c | 1 | 0 |
diff -cprN head/src/backend/utils/adt/pg_locale.c work/src/backend/utils/adt/pg_locale.c
*** head/src/backend/utils/adt/pg_locale.c 2010-03-01 10:46:55.122677000 +0900
--- work/src/backend/utils/adt/pg_locale.c 2010-03-18 12:31:47.094400713 +0900
*************** static char lc_monetary_envbuf[LC_ENV_BU
*** 92,97 ****
--- 92,99 ----
static char lc_numeric_envbuf[LC_ENV_BUFSIZE];
static char lc_time_envbuf[LC_ENV_BUFSIZE];
+ static char *db_encoding_strdup(const char *str);
+
#if defined(WIN32) && defined(LC_MESSAGES)
static char *IsoLocaleName(const char *); /* MSVC specific */
#endif
*************** free_struct_lconv(struct lconv * s)
*** 386,391 ****
--- 388,413 ----
free(s->positive_sign);
}
+ /*
+ * Converts strings encoded in the platform-dependent encoding to the database
+ * encoding and returns malloc'ed buffer.
+ */
+ static char *
+ db_encoding_strdup(const char *str)
+ {
+ char *pstr;
+ char *mstr;
+
+ /* convert the string to the database encoding */
+ pstr = (char *) pg_do_encoding_conversion(
+ (unsigned char *) str, strlen(str),
+ GetPlatformEncoding(), GetDatabaseEncoding());
+ mstr = strdup(pstr);
+ if (pstr != str)
+ pfree(pstr);
+
+ return mstr;
+ }
/*
* Return the POSIX lconv struct (contains number/money formatting
*************** PGLC_localeconv(void)
*** 424,439 ****
* localeconv()'s results.
*/
CurrentLocaleConv = *extlconv;
! CurrentLocaleConv.currency_symbol = strdup(extlconv->currency_symbol);
! CurrentLocaleConv.decimal_point = strdup(extlconv->decimal_point);
! CurrentLocaleConv.grouping = strdup(extlconv->grouping);
! CurrentLocaleConv.thousands_sep = strdup(extlconv->thousands_sep);
! CurrentLocaleConv.int_curr_symbol = strdup(extlconv->int_curr_symbol);
! CurrentLocaleConv.mon_decimal_point = strdup(extlconv->mon_decimal_point);
! CurrentLocaleConv.mon_grouping = strdup(extlconv->mon_grouping);
! CurrentLocaleConv.mon_thousands_sep = strdup(extlconv->mon_thousands_sep);
! CurrentLocaleConv.negative_sign = strdup(extlconv->negative_sign);
! CurrentLocaleConv.positive_sign = strdup(extlconv->positive_sign);
CurrentLocaleConv.n_sign_posn = extlconv->n_sign_posn;
/* Try to restore internal settings */
--- 446,461 ----
* localeconv()'s results.
*/
CurrentLocaleConv = *extlconv;
! CurrentLocaleConv.currency_symbol = db_encoding_strdup(extlconv->currency_symbol);
! CurrentLocaleConv.decimal_point = db_encoding_strdup(extlconv->decimal_point);
! CurrentLocaleConv.grouping = db_encoding_strdup(extlconv->grouping);
! CurrentLocaleConv.thousands_sep = db_encoding_strdup(extlconv->thousands_sep);
! CurrentLocaleConv.int_curr_symbol = db_encoding_strdup(extlconv->int_curr_symbol);
! CurrentLocaleConv.mon_decimal_point = db_encoding_strdup(extlconv->mon_decimal_point);
! CurrentLocaleConv.mon_grouping = db_encoding_strdup(extlconv->mon_grouping);
! CurrentLocaleConv.mon_thousands_sep = db_encoding_strdup(extlconv->mon_thousands_sep);
! CurrentLocaleConv.negative_sign = db_encoding_strdup(extlconv->negative_sign);
! CurrentLocaleConv.positive_sign = db_encoding_strdup(extlconv->positive_sign);
CurrentLocaleConv.n_sign_posn = extlconv->n_sign_posn;
/* Try to restore internal settings */
diff -cprN head/src/port/chklocale.c work/src/port/chklocale.c
*** head/src/port/chklocale.c 2010-02-26 11:29:55.507518000 +0900
--- work/src/port/chklocale.c 2010-03-18 12:31:47.191403027 +0900
*************** static const struct encoding_match encod
*** 182,187 ****
--- 182,188 ----
{PG_SHIFT_JIS_2004, "SJIS_2004"},
{PG_SQL_ASCII, "US-ASCII"},
+ {PG_SQL_ASCII, "ANSI_X3.4-1968"},
{PG_SQL_ASCII, NULL} /* end marker */
};