Skip to content

Commit 8463195

Browse files
committed
Fix win32setlocale.c const-related warnings.
Back-patch to 9.2, like commit db29620.
1 parent 9522efd commit 8463195

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/port/win32setlocale.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ static const struct locale_map locale_map_result[] = {
103103

104104
#define MAX_LOCALE_NAME_LEN 100
105105

106-
static char *
107-
map_locale(struct locale_map *map, char *locale)
106+
static const char *
107+
map_locale(const struct locale_map *map, const char *locale)
108108
{
109109
static char aliasbuf[MAX_LOCALE_NAME_LEN];
110110
int i;
@@ -167,7 +167,7 @@ map_locale(struct locale_map *map, char *locale)
167167
char *
168168
pgwin32_setlocale(int category, const char *locale)
169169
{
170-
char *argument;
170+
const char *argument;
171171
char *result;
172172

173173
if (locale == NULL)
@@ -178,8 +178,12 @@ pgwin32_setlocale(int category, const char *locale)
178178
/* Call the real setlocale() function */
179179
result = setlocale(category, argument);
180180

181+
/*
182+
* setlocale() is specified to return a "char *" that the caller is
183+
* forbidden to modify, so casting away the "const" is innocuous.
184+
*/
181185
if (result)
182-
result = map_locale(locale_map_result, result);
186+
result = (char *) map_locale(locale_map_result, result);
183187

184188
return result;
185189
}

0 commit comments

Comments
 (0)