Mend compile-time warnings in locale_to_closest_locale
Also, not currently used except for macOS, so wrapping in #ifdef to avoid "defined but not used" warning.
This commit is contained in:
parent
110cdeaa6a
commit
b60a4ec4d1
1 changed files with 10 additions and 4 deletions
14
src/i18n.c
14
src/i18n.c
|
|
@ -4,7 +4,7 @@
|
||||||
For Tux Paint
|
For Tux Paint
|
||||||
Language-related functions
|
Language-related functions
|
||||||
|
|
||||||
Copyright (c) 2002-2020 by Bill Kendrick and others
|
Copyright (c) 2002-2022 by Bill Kendrick and others
|
||||||
bill@newbreedsoftware.com
|
bill@newbreedsoftware.com
|
||||||
http://www.tuxpaint.org/
|
http://www.tuxpaint.org/
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
June 14, 2002 - October 25, 2021
|
June 14, 2002 - February 9, 2022
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -818,6 +818,9 @@ static const char *language_to_locale(const char *langstr)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given locale, return the known locale that matches it closest, or exit
|
* For a given locale, return the known locale that matches it closest, or exit
|
||||||
* with a usage error.
|
* with a usage error.
|
||||||
|
|
@ -834,11 +837,11 @@ static const char *locale_to_closest_locale(const char *inlocale)
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
/* find the locale with the longest string match */
|
/* find the locale with the longest string match */
|
||||||
for (i=0; i<numlocale; i++)
|
for (i = 0; i < numlocale; i++)
|
||||||
{
|
{
|
||||||
const char* candidate = language_to_locale_array[i].locale;
|
const char* candidate = language_to_locale_array[i].locale;
|
||||||
|
|
||||||
for (j=0; j<strlen(inlocale) && j<strlen(candidate); j++)
|
for (j = 0; j < (int) strlen(inlocale) && j < (int) strlen(candidate); j++)
|
||||||
{
|
{
|
||||||
if(inlocale[j] != candidate[j]) break;
|
if(inlocale[j] != candidate[j]) break;
|
||||||
}
|
}
|
||||||
|
|
@ -859,6 +862,9 @@ static const char *locale_to_closest_locale(const char *inlocale)
|
||||||
return outlocale;
|
return outlocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set language ("langint" global) based on a given locale;
|
* Set language ("langint" global) based on a given locale;
|
||||||
* will try a few ways of checking, is case-insensitive, etc.
|
* will try a few ways of checking, is case-insensitive, etc.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue