mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Backed out 2 changesets (bug 1353593) for windows build bustage a=backout
Backed out changeset c16b53fc17d9 (bug 1353593) Backed out changeset 4bc441fc5860 (bug 1353593) MozReview-Commit-ID: F2pCPyEOmwn
This commit is contained in:
parent
10538136d5
commit
d49e092dc0
@ -56,12 +56,6 @@ public:
|
|||||||
{
|
{
|
||||||
return reinterpret_cast<const wchar_t*>(mPtr);
|
return reinterpret_cast<const wchar_t*>(mPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator wchar_t*()
|
|
||||||
{
|
|
||||||
return const_cast<wchar_t*>(reinterpret_cast<const wchar_t*>(mPtr));
|
|
||||||
}
|
|
||||||
|
|
||||||
operator const void*() const
|
operator const void*() const
|
||||||
{
|
{
|
||||||
return mPtr;
|
return mPtr;
|
||||||
|
@ -344,7 +344,7 @@ IMMHandler::InitKeyboardLayout(nsWindow* aWindow,
|
|||||||
// Add room for the terminating null character
|
// Add room for the terminating null character
|
||||||
sIMEName.SetLength(++IMENameLength);
|
sIMEName.SetLength(++IMENameLength);
|
||||||
IMENameLength =
|
IMENameLength =
|
||||||
::ImmGetDescriptionW(aKeyboardLayout, sIMEName.get(),
|
::ImmGetDescriptionW(aKeyboardLayout, wwc(sIMEName.BeginWriting()),
|
||||||
IMENameLength);
|
IMENameLength);
|
||||||
// Adjust the length to ignore the terminating null character
|
// Adjust the length to ignore the terminating null character
|
||||||
sIMEName.SetLength(IMENameLength);
|
sIMEName.SetLength(IMENameLength);
|
||||||
|
@ -229,7 +229,7 @@ nsresult GetCountryCode(nsAString& aCountryCode)
|
|||||||
}
|
}
|
||||||
// Now get the string for real
|
// Now get the string for real
|
||||||
aCountryCode.SetLength(numChars);
|
aCountryCode.SetLength(numChars);
|
||||||
numChars = GetGeoInfoW(geoid, GEO_ISO2, char16ptr_t(aCountryCode.BeginWriting()),
|
numChars = GetGeoInfoW(geoid, GEO_ISO2, wwc(aCountryCode.BeginWriting()),
|
||||||
aCountryCode.Length(), 0);
|
aCountryCode.Length(), 0);
|
||||||
if (!numChars) {
|
if (!numChars) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -354,8 +354,11 @@ nsWindowsRegKey::ReadStringValue(const nsAString& aName, nsAString& aResult)
|
|||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsAString::iterator begin;
|
||||||
|
expandedResult.BeginWriting(begin);
|
||||||
|
|
||||||
resultLen = ExpandEnvironmentStringsW(flatSource.get(),
|
resultLen = ExpandEnvironmentStringsW(flatSource.get(),
|
||||||
expandedResult.get(),
|
wwc(begin.get()),
|
||||||
resultLen + 1);
|
resultLen + 1);
|
||||||
if (resultLen <= 0) {
|
if (resultLen <= 0) {
|
||||||
rv = ERROR_UNKNOWN_FEATURE;
|
rv = ERROR_UNKNOWN_FEATURE;
|
||||||
|
@ -61,7 +61,7 @@ HandleToFilename(HANDLE aHandle, const LARGE_INTEGER& aOffset,
|
|||||||
do {
|
do {
|
||||||
mappedFilename.SetLength(mappedFilename.Length() + MAX_PATH);
|
mappedFilename.SetLength(mappedFilename.Length() + MAX_PATH);
|
||||||
len = GetMappedFileNameW(GetCurrentProcess(), view,
|
len = GetMappedFileNameW(GetCurrentProcess(), view,
|
||||||
mappedFilename.get(),
|
wwc(mappedFilename.BeginWriting()),
|
||||||
mappedFilename.Length());
|
mappedFilename.Length());
|
||||||
} while (!len && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
} while (!len && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
||||||
if (!len) {
|
if (!len) {
|
||||||
|
@ -995,7 +995,7 @@ nsLocalFile::ResolveShortcut()
|
|||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t* resolvedPath = mResolvedPath.get();
|
wchar_t* resolvedPath = wwc(mResolvedPath.BeginWriting());
|
||||||
|
|
||||||
// resolve this shortcut
|
// resolve this shortcut
|
||||||
nsresult rv = gResolver->Resolve(mWorkingPath.get(), resolvedPath);
|
nsresult rv = gResolver->Resolve(mWorkingPath.get(), resolvedPath);
|
||||||
@ -1365,7 +1365,7 @@ nsLocalFile::Create(uint32_t aType, uint32_t aAttributes)
|
|||||||
// Skip the first 'X:\' for the first form, and skip the first full
|
// Skip the first 'X:\' for the first form, and skip the first full
|
||||||
// '\\machine\volume\' segment for the second form.
|
// '\\machine\volume\' segment for the second form.
|
||||||
|
|
||||||
wchar_t* path = char16ptr_t(mResolvedPath.BeginWriting());
|
wchar_t* path = wwc(mResolvedPath.BeginWriting());
|
||||||
|
|
||||||
if (path[0] == L'\\' && path[1] == L'\\') {
|
if (path[0] == L'\\' && path[1] == L'\\') {
|
||||||
// dealing with a UNC path here; skip past '\\machine\'
|
// dealing with a UNC path here; skip past '\\machine\'
|
||||||
@ -3743,7 +3743,7 @@ nsDriveEnumerator::Init()
|
|||||||
if (!mDrives.SetLength(length + 1, fallible)) {
|
if (!mDrives.SetLength(length + 1, fallible)) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
if (!GetLogicalDriveStringsW(length, mDrives.get())) {
|
if (!GetLogicalDriveStringsW(length, wwc(mDrives.BeginWriting()))) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
mDrives.BeginReading(mStartOfCurrentDrive);
|
mDrives.BeginReading(mStartOfCurrentDrive);
|
||||||
|
@ -929,8 +929,12 @@ NS_CopyNativeToUnicode(const nsACString& aInput, nsAString& aOutput)
|
|||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
if (resultLen > 0) {
|
if (resultLen > 0) {
|
||||||
char16ptr_t result = aOutput.BeginWriting();
|
nsAString::iterator out_iter;
|
||||||
::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, result, resultLen);
|
aOutput.BeginWriting(out_iter);
|
||||||
|
|
||||||
|
char16_t* result = out_iter.get();
|
||||||
|
|
||||||
|
::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, wwc(result), resultLen);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -974,6 +978,41 @@ NS_CopyUnicodeToNative(const nsAString& aInput, nsACString& aOutput)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// moved from widget/windows/nsToolkit.cpp
|
||||||
|
int32_t
|
||||||
|
NS_ConvertAtoW(const char* aStrInA, int aBufferSize, char16_t* aStrOutW)
|
||||||
|
{
|
||||||
|
return MultiByteToWideChar(CP_ACP, 0, aStrInA, -1, wwc(aStrOutW), aBufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t
|
||||||
|
NS_ConvertWtoA(const char16_t* aStrInW, int aBufferSizeOut,
|
||||||
|
char* aStrOutA, const char* aDefault)
|
||||||
|
{
|
||||||
|
if ((!aStrInW) || (!aStrOutA) || (aBufferSizeOut <= 0)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int numCharsConverted = WideCharToMultiByte(CP_ACP, 0, char16ptr_t(aStrInW), -1,
|
||||||
|
aStrOutA, aBufferSizeOut,
|
||||||
|
aDefault, nullptr);
|
||||||
|
|
||||||
|
if (!numCharsConverted) {
|
||||||
|
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
||||||
|
// Overflow, add missing null termination but return 0
|
||||||
|
aStrOutA[aBufferSizeOut - 1] = '\0';
|
||||||
|
} else {
|
||||||
|
// Other error, clear string and return 0
|
||||||
|
aStrOutA[0] = '\0';
|
||||||
|
}
|
||||||
|
} else if (numCharsConverted < aBufferSizeOut) {
|
||||||
|
// Add 2nd null (really necessary?)
|
||||||
|
aStrOutA[numCharsConverted] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return numCharsConverted;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
|
@ -148,6 +148,49 @@ private:
|
|||||||
NS_ConvertUTF8toUTF16(char16_t) = delete;
|
NS_ConvertUTF8toUTF16(char16_t) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MOZ_USE_CHAR16_WRAPPER
|
||||||
|
|
||||||
|
inline char16_t*
|
||||||
|
wwc(wchar_t* aStr)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<char16_t*>(aStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline wchar_t*
|
||||||
|
wwc(char16_t* aStr)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<wchar_t*>(aStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char16_t*
|
||||||
|
wwc(const wchar_t* aStr)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<const char16_t*>(aStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const wchar_t*
|
||||||
|
wwc(const char16_t* aStr)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<const wchar_t*>(aStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
inline char16_t*
|
||||||
|
wwc(char16_t* aStr)
|
||||||
|
{
|
||||||
|
return aStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char16_t*
|
||||||
|
wwc(const char16_t* aStr)
|
||||||
|
{
|
||||||
|
return aStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// the following are included/declared for backwards compatibility
|
// the following are included/declared for backwards compatibility
|
||||||
typedef nsAutoString nsVoidableString;
|
typedef nsAutoString nsVoidableString;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user