real implementation for IsValidCodePage
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5211 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
6133677dba
commit
8e1b521859
3 changed files with 15 additions and 8 deletions
|
@ -876,14 +876,6 @@ char SkipComments(FILE *f) {
|
|||
return (char) c;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
BOOL IsValidCodePage(UINT CodePage)
|
||||
{
|
||||
// FIXME make a real check
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// NSIS Language File parser
|
||||
LanguageTable * CEXEBuild::LoadLangFile(char *filename) {
|
||||
FILE *f = FOPEN(filename, "r");
|
||||
|
|
|
@ -528,6 +528,20 @@ int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
|
|||
return cchWideChar - (outbytes / sizeof (WCHAR));
|
||||
}
|
||||
|
||||
BOOL IsValidCodePage(UINT CodePage)
|
||||
{
|
||||
char cp[128];
|
||||
create_code_page_string(cp, sizeof(cp), CodePage);
|
||||
|
||||
iconv_t cd = iconv_open("UCS-2LE", cp);
|
||||
if (cd == (iconv_t) -1)
|
||||
return FALSE;
|
||||
|
||||
iconv_close(cd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define MY_ERROR_MSG(x) {if (g_display_errors) {fprintf(g_output,"%s", x);}}
|
||||
|
||||
char *my_convert(const char *path)
|
||||
|
|
|
@ -72,6 +72,7 @@ int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr,
|
|||
LPBOOL lpUsedDefaultChar);
|
||||
int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
|
||||
int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
|
||||
BOOL IsValidCodePage(UINT CodePage);
|
||||
|
||||
char *my_convert(const char *path);
|
||||
void my_convert_free(char *converted_path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue