зеркало из https://github.com/mozilla/gecko-dev.git
bug 344630 : "Mojibake" in file download dialog : r/sr=darin
This commit is contained in:
Родитель
3bbbf65949
Коммит
006997ce62
|
@ -71,6 +71,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <mbstring.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
#include "prproces.h"
|
||||
|
@ -1406,30 +1407,26 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& _retval)
|
|||
{
|
||||
LANGANDCODEPAGE* translate = nsnull;
|
||||
UINT pageCount;
|
||||
BOOL queryResult = ::VerQueryValue(ver, "\\VarFileInfo\\Translation",
|
||||
BOOL queryResult = ::VerQueryValueW(ver, L"\\VarFileInfo\\Translation",
|
||||
(void**)&translate, &pageCount);
|
||||
if (queryResult && translate)
|
||||
{
|
||||
for (PRInt32 i = 0; i < 2; ++i)
|
||||
{
|
||||
// XXX : need to make sure that we can get away with
|
||||
// 'VerQueryValueA' here.
|
||||
char subBlock[MAX_PATH];
|
||||
PR_snprintf(subBlock, sizeof(subBlock),
|
||||
"\\StringFileInfo\\%04x%04x\\%s",
|
||||
(i == 0 ? translate[0].wLanguage
|
||||
: ::GetUserDefaultLangID()),
|
||||
translate[0].wCodePage, aField);
|
||||
|
||||
PRUnichar subBlock[MAX_PATH];
|
||||
StringCchPrintfW(subBlock, MAX_PATH,
|
||||
L"\\StringFileInfo\\%04x%04x\\%s",
|
||||
(i == 0 ? translate[0].wLanguage
|
||||
: ::GetUserDefaultLangID()),
|
||||
translate[0].wCodePage,
|
||||
NS_ConvertASCIItoUTF16(
|
||||
nsDependentCString(aField)).get());
|
||||
LPVOID value = nsnull;
|
||||
UINT size;
|
||||
queryResult = ::VerQueryValueA(ver, subBlock, &value, &size);
|
||||
queryResult = ::VerQueryValueW(ver, subBlock, &value, &size);
|
||||
if (queryResult && value)
|
||||
{
|
||||
NS_ASSERTION(nsCRT::IsAscii((const char*) value),
|
||||
"Version string has non-ASCII characters");
|
||||
CopyASCIItoUTF16(nsDependentCString((const char*) value),
|
||||
_retval);
|
||||
_retval = nsDependentString((const PRUnichar*) value);
|
||||
if (!_retval.IsEmpty())
|
||||
{
|
||||
rv = NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче