Changeset 226205 in webkit


Ignore:
Timestamp:
Dec 20, 2017 5:10:52 PM (6 years ago)
Author:
don.olmstead@sony.com
Message:

[Win] Use WCharStringExtras functions in WebCore
https://bugs.webkit.org/show_bug.cgi?id=180963

Reviewed by Alex Christensen.

No new tests. No change in behavior.

  • platform/graphics/win/FontCacheWin.cpp:

(WebCore::appendLinkedFonts):
(WebCore::getLinkedFonts):
(WebCore::FontCache::systemFallbackForCharacters):
(WebCore::FontCache::fontFromDescriptionAndLogFont):

  • platform/graphics/win/FontCustomPlatformDataCairo.cpp:

(WebCore::FontCustomPlatformData::fontPlatformData):

  • platform/graphics/win/IconWin.cpp:

(WebCore::Icon::createIconForFiles):

  • platform/network/win/DownloadBundleWin.cpp:

(WebCore::DownloadBundle::appendResumeData):
(WebCore::DownloadBundle::extractResumeData):

  • platform/text/win/LocaleWin.cpp:

(WebCore::LCIDFromLocaleInternal):
(WebCore::LCIDFromLocale):

  • platform/win/ClipboardUtilitiesWin.cpp:

(WebCore::getWebLocData):
(WebCore::createGlobalData):
(WebCore::getFileDescriptorData):
(WebCore::getURL):
(WebCore::getCFData):
(WebCore::setCFData):

  • platform/win/DragDataWin.cpp:

(WebCore::DragData::asFilenames const):

  • platform/win/DragImageWin.cpp:

(WebCore::createDragImageIconForCachedImageFilename):
(WebCore::dragLabelFont):

  • platform/win/FileSystemWin.cpp:

(WebCore::FileSystem::getFindData):
(WebCore::FileSystem::createSymbolicLink):
(WebCore::FileSystem::deleteFile):
(WebCore::FileSystem::deleteEmptyDirectory):
(WebCore::FileSystem::moveFile):
(WebCore::FileSystem::pathByAppendingComponent):
(WebCore::FileSystem::makeAllDirectories):
(WebCore::FileSystem::pathGetFileName):
(WebCore::FileSystem::openTemporaryFile):
(WebCore::FileSystem::openFile):
(WebCore::FileSystem::hardLinkOrCopyFile):

  • platform/win/MIMETypeRegistryWin.cpp:

(WebCore::mimeTypeForExtension):
(WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):

  • platform/win/PasteboardWin.cpp:

(WebCore::Pasteboard::read):
(WebCore::createGlobalHDropContent):

  • platform/win/PathWalker.cpp:

(WebCore::PathWalker::PathWalker):

  • platform/win/SSLKeyGeneratorWin.cpp:

(WebCore::WebCore::signedPublicKeyAndChallengeString):

  • platform/win/SharedBufferWin.cpp:

(WebCore::SharedBuffer::createFromReadingFile):

  • rendering/RenderThemeWin.cpp:

(WebCore::fillFontDescription):

Location:
trunk/Source/WebCore
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r226203 r226205  
     12017-12-20  Don Olmstead  <don.olmstead@sony.com>
     2
     3        [Win] Use WCharStringExtras functions in WebCore
     4        https://bugs.webkit.org/show_bug.cgi?id=180963
     5
     6        Reviewed by Alex Christensen.
     7
     8        No new tests. No change in behavior.
     9
     10        * platform/graphics/win/FontCacheWin.cpp:
     11        (WebCore::appendLinkedFonts):
     12        (WebCore::getLinkedFonts):
     13        (WebCore::FontCache::systemFallbackForCharacters):
     14        (WebCore::FontCache::fontFromDescriptionAndLogFont):
     15        * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
     16        (WebCore::FontCustomPlatformData::fontPlatformData):
     17        * platform/graphics/win/IconWin.cpp:
     18        (WebCore::Icon::createIconForFiles):
     19        * platform/network/win/DownloadBundleWin.cpp:
     20        (WebCore::DownloadBundle::appendResumeData):
     21        (WebCore::DownloadBundle::extractResumeData):
     22        * platform/text/win/LocaleWin.cpp:
     23        (WebCore::LCIDFromLocaleInternal):
     24        (WebCore::LCIDFromLocale):
     25        * platform/win/ClipboardUtilitiesWin.cpp:
     26        (WebCore::getWebLocData):
     27        (WebCore::createGlobalData):
     28        (WebCore::getFileDescriptorData):
     29        (WebCore::getURL):
     30        (WebCore::getCFData):
     31        (WebCore::setCFData):
     32        * platform/win/DragDataWin.cpp:
     33        (WebCore::DragData::asFilenames const):
     34        * platform/win/DragImageWin.cpp:
     35        (WebCore::createDragImageIconForCachedImageFilename):
     36        (WebCore::dragLabelFont):
     37        * platform/win/FileSystemWin.cpp:
     38        (WebCore::FileSystem::getFindData):
     39        (WebCore::FileSystem::createSymbolicLink):
     40        (WebCore::FileSystem::deleteFile):
     41        (WebCore::FileSystem::deleteEmptyDirectory):
     42        (WebCore::FileSystem::moveFile):
     43        (WebCore::FileSystem::pathByAppendingComponent):
     44        (WebCore::FileSystem::makeAllDirectories):
     45        (WebCore::FileSystem::pathGetFileName):
     46        (WebCore::FileSystem::openTemporaryFile):
     47        (WebCore::FileSystem::openFile):
     48        (WebCore::FileSystem::hardLinkOrCopyFile):
     49        * platform/win/MIMETypeRegistryWin.cpp:
     50        (WebCore::mimeTypeForExtension):
     51        (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
     52        * platform/win/PasteboardWin.cpp:
     53        (WebCore::Pasteboard::read):
     54        (WebCore::createGlobalHDropContent):
     55        * platform/win/PathWalker.cpp:
     56        (WebCore::PathWalker::PathWalker):
     57        * platform/win/SSLKeyGeneratorWin.cpp:
     58        (WebCore::WebCore::signedPublicKeyAndChallengeString):
     59        * platform/win/SharedBufferWin.cpp:
     60        (WebCore::SharedBuffer::createFromReadingFile):
     61        * rendering/RenderThemeWin.cpp:
     62        (WebCore::fillFontDescription):
     63
    1642017-12-20  Youenn Fablet  <youenn@apple.com>
    265
  • trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp

    r225641 r226205  
    4040#include <wtf/text/StringHash.h>
    4141#include <wtf/text/StringView.h>
     42#include <wtf/text/win/WCharStringExtras.h>
    4243#include <wtf/win/GDIObject.h>
    4344
     
    114115        while (j < length && linkedFonts[j])
    115116            j++;
    116         result->append(String(linkedFonts + i, j - i));
     117        result->append(wcharToString(linkedFonts + i, j - i));
    117118        i = j + 1;
    118119    }
     
    133134
    134135    DWORD linkedFontsBufferSize = 0;
    135     if (::RegQueryValueEx(fontLinkKey, family.charactersWithNullTermination().data(), 0, nullptr, nullptr, &linkedFontsBufferSize) == ERROR_FILE_NOT_FOUND) {
     136    if (::RegQueryValueEx(fontLinkKey, stringToNullTerminatedWChar(family).data(), 0, nullptr, nullptr, &linkedFontsBufferSize) == ERROR_FILE_NOT_FOUND) {
    136137        WTFLogAlways("The font link key %s does not exist in the registry.", family.utf8().data());
    137138        return result;
     
    140141    static const constexpr unsigned InitialBufferSize { 256 / sizeof(WCHAR) };
    141142    Vector<WCHAR, InitialBufferSize> linkedFonts(roundUpToMultipleOf<sizeof(WCHAR)>(linkedFontsBufferSize) / sizeof(WCHAR));
    142     if (::RegQueryValueEx(fontLinkKey, family.charactersWithNullTermination().data(), 0, nullptr, reinterpret_cast<BYTE*>(linkedFonts.data()), &linkedFontsBufferSize) == ERROR_SUCCESS) {
     143    if (::RegQueryValueEx(fontLinkKey, stringToNullTerminatedWChar(family).data(), 0, nullptr, reinterpret_cast<BYTE*>(linkedFonts.data()), &linkedFontsBufferSize) == ERROR_SUCCESS) {
    143144        unsigned length = linkedFontsBufferSize / sizeof(WCHAR);
    144145        appendLinkedFonts(linkedFonts.data(), length, result);
     
    287288        WCHAR name[LF_FACESIZE];
    288289        GetTextFace(hdc, LF_FACESIZE, name);
    289         familyName = name;
     290        familyName = nullTerminatedWCharToString(name);
    290291
    291292        if (containsCharacter || currentFontContainsCharacter(hdc, character))
     
    332333RefPtr<Font> FontCache::fontFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)
    333334{
    334     AtomicString familyName = String(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE));
     335    AtomicString familyName = wcharToString(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE));
    335336    RefPtr<Font> fontData = fontForFamily(fontDescription, familyName);
    336337    if (fontData)
  • trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp

    r206597 r226205  
    3030#include <wtf/RetainPtr.h>
    3131#include <wtf/text/Base64.h>
     32#include <wtf/text/win/WCharStringExtras.h>
    3233#include <wtf/win/GDIObject.h>
    3334
     
    4748    LOGFONT logFont;
    4849    memset(&logFont, 0, sizeof(LOGFONT));
    49     wcsncpy(logFont.lfFaceName, m_name.charactersWithNullTermination().data(), LF_FACESIZE - 1);
     50    wcsncpy(logFont.lfFaceName, stringToNullTerminatedWChar(m_name).data(), LF_FACESIZE - 1);
    5051
    5152    logFont.lfHeight = -size;
  • trunk/Source/WebCore/platform/graphics/win/IconWin.cpp

    r198655 r226205  
    2727#include <windows.h>
    2828#include <wtf/text/WTFString.h>
     29#include <wtf/text/win/WCharStringExtras.h>
    2930
    3031namespace WebCore {
     
    5455
    5556        String tmpFilename = filenames[0];
    56         if (!SHGetFileInfo(tmpFilename.charactersWithNullTermination().data(), 0, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SHELLICONSIZE | SHGFI_SMALLICON))
     57        if (!SHGetFileInfo(stringToNullTerminatedWChar(tmpFilename).data(), 0, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SHELLICONSIZE | SHGFI_SMALLICON))
    5758            return 0;
    5859
  • trunk/Source/WebCore/platform/network/win/DownloadBundleWin.cpp

    r219858 r226205  
    3232#include <wtf/text/CString.h>
    3333#include <wtf/text/WTFString.h>
     34#include <wtf/text/win/WCharStringExtras.h>
    3435
    3536namespace WebCore {
     
    6162    String nullifiedPath = bundlePath;
    6263    FILE* bundle = 0;
    63     if (_wfopen_s(&bundle, nullifiedPath.charactersWithNullTermination().data(), TEXT("ab")) || !bundle) {
     64    if (_wfopen_s(&bundle, stringToNullTerminatedWChar(nullifiedPath).data(), TEXT("ab")) || !bundle) {
    6465        LOG_ERROR("Failed to open file %s to append resume data", bundlePath.ascii().data());
    6566        return false;
     
    100101    String nullifiedPath = bundlePath;
    101102    FILE* bundle = 0;
    102     if (_wfopen_s(&bundle, nullifiedPath.charactersWithNullTermination().data(), TEXT("r+b")) || !bundle) {
     103    if (_wfopen_s(&bundle, stringToNullTerminatedWChar(nullifiedPath).data(), TEXT("r+b")) || !bundle) {
    103104        LOG_ERROR("Failed to open file %s to get resume data", bundlePath.ascii().data());
    104105        return false;
  • trunk/Source/WebCore/platform/text/win/LocaleWin.cpp

    r225555 r226205  
    4343#include <wtf/text/StringBuilder.h>
    4444#include <wtf/text/StringHash.h>
    45 
     45#include <wtf/text/win/WCharStringExtras.h>
    4646
    4747namespace WebCore {
     
    6262    if (equalIgnoringASCIICase(extractLanguageCode(locale), userDefaultLanguageCode))
    6363        return userDefaultLCID;
    64     return LocaleNameToLCID(locale.charactersWithNullTermination().data(), 0);
     64    return LocaleNameToLCID(stringToNullTerminatedWChar(locale).data(), 0);
    6565}
    6666
     
    7171    WCHAR lowercaseLanguageCode[languageCodeBufferSize];
    7272    ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, lowercaseLanguageCode, languageCodeBufferSize);
    73     String userDefaultLanguageCode = String(lowercaseLanguageCode);
     73    String userDefaultLanguageCode = nullTerminatedWCharToString(lowercaseLanguageCode);
    7474
    7575    LCID lcid = LCIDFromLocaleInternal(LOCALE_USER_DEFAULT, userDefaultLanguageCode, String(locale));
  • trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp

    r225117 r226205  
    3838#include <wtf/text/CString.h>
    3939#include <wtf/text/StringBuilder.h>
    40 
     40#include <wtf/text/win/WCharStringExtras.h>
    4141
    4242#if USE(CF)
     
    132132        return false;
    133133
    134     wcscpy(filename, dataObject->get(cfHDropFormat()->cfFormat)[0].charactersWithNullTermination().data());
     134    wcscpy(filename, stringToNullTerminatedWChar(dataObject->get(cfHDropFormat()->cfFormat)[0]).data());
    135135    if (_wcsicmp(PathFindExtensionW(filename), L".url"))
    136136        return false;   
     
    141141    if (title) {
    142142        PathRemoveExtension(filename);
    143         *title = filename;
     143        *title = nullTerminatedWCharToString(filename);
    144144    }
    145145   
    146     url = urlBuffer;
     146    url = nullTerminatedWCharToString(urlBuffer);
    147147    return true;
    148148#else
     
    181181    if (cbData) {
    182182        PWSTR buffer = static_cast<PWSTR>(GlobalLock(cbData));
    183         _snwprintf(buffer, size, L"%s\n%s", mutableURL.charactersWithNullTermination().data(), mutableTitle.charactersWithNullTermination().data());
     183        _snwprintf(buffer, size, L"%s\n%s", stringToNullTerminatedWChar(mutableURL).data(), stringToNullTerminatedWChar(mutableTitle).data());
    184184        GlobalUnlock(cbData);
    185185    }
     
    398398    FILEGROUPDESCRIPTOR* fgd = static_cast<FILEGROUPDESCRIPTOR*>(GlobalLock(store.hGlobal));
    399399    size = fgd->fgd[0].nFileSizeLow;
    400     pathname = fgd->fgd[0].cFileName;
     400    pathname = nullTerminatedWCharToString(fgd->fgd[0].cFileName);
    401401
    402402    GlobalUnlock(store.hGlobal);
     
    521521        getDataMapItem(data, filenameFormat(), stringData);
    522522
    523     if (stringData.isEmpty() || (!PathFileExists(stringData.charactersWithNullTermination().data()) && !PathIsUNC(stringData.charactersWithNullTermination().data())))
     523    if (stringData.isEmpty() || (!PathFileExists(stringToNullTerminatedWChar(stringData).data()) && !PathIsUNC(stringToNullTerminatedWChar(stringData).data())))
    524524        return url;
    525     RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)stringData.charactersWithNullTermination().data(), wcslen(stringData.charactersWithNullTermination().data())));
     525    RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)stringToNullTerminatedWChar(stringData).data(), wcslen(stringToNullTerminatedWChar(stringData).data())));
    526526    if (urlFromPath(pathAsCFString.get(), url) && title)
    527527        *title = url;
     
    738738        if (!DragQueryFileW(hdrop, i, filename, WTF_ARRAY_LENGTH(filename)))
    739739            continue;
    740         dataStrings.append(static_cast<UChar*>(filename));
     740        dataStrings.append(nullTerminatedWCharToString(filename));
    741741    }
    742742
     
    793793    dropFiles->fWide = TRUE;
    794794    String filename = dataStrings.first();
    795     wcscpy(reinterpret_cast<LPWSTR>(dropFiles + 1), filename.charactersWithNullTermination().data());   
     795    wcscpy(reinterpret_cast<LPWSTR>(dropFiles + 1), stringToNullTerminatedWChar(filename).data());
    796796    GlobalUnlock(medium.hGlobal);
    797797    data->SetData(format, &medium, FALSE);
  • trunk/Source/WebCore/platform/win/DragDataWin.cpp

    r222025 r226205  
    3838#include <wtf/RefPtr.h>
    3939#include <wtf/text/WTFString.h>
     40#include <wtf/text/win/WCharStringExtras.h>
    4041
    4142namespace WebCore {
     
    158159            if (!DragQueryFileW(hdrop, i, filename, WTF_ARRAY_LENGTH(filename)))
    159160                continue;
    160             result.append(static_cast<UChar*>(filename));
     161            result.append(nullTerminatedWCharToString(filename));
    161162        }
    162163
  • trunk/Source/WebCore/platform/win/DragImageWin.cpp

    r213464 r226205  
    4141#include "WebCoreTextRenderer.h"
    4242#include <wtf/RetainPtr.h>
     43#include <wtf/text/win/WCharStringExtras.h>
    4344#include <wtf/win/GDIObject.h>
    4445
     
    7576    SHFILEINFO shfi = {0};
    7677    String fname = filename;
    77     if (FAILED(SHGetFileInfo(static_cast<LPCWSTR>(fname.charactersWithNullTermination().data()), FILE_ATTRIBUTE_NORMAL,
    78         &shfi, sizeof(shfi), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES)))
     78    if (FAILED(SHGetFileInfo(stringToNullTerminatedWChar(fname).data(), FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES)))
    7979        return 0;
    8080
     
    113113    FontCascadeDescription description;
    114114    description.setWeight(bold ? boldWeightValue() : normalWeightValue());
    115     description.setOneFamily(metrics.lfSmCaptionFont.lfFaceName);
     115    description.setOneFamily(nullTerminatedWCharToString(metrics.lfSmCaptionFont.lfFaceName));
    116116    description.setSpecifiedSize((float)size);
    117117    description.setComputedSize((float)size);
  • trunk/Source/WebCore/platform/win/FileSystemWin.cpp

    r224635 r226205  
    4343#include <wtf/text/CString.h>
    4444#include <wtf/text/StringBuilder.h>
     45#include <wtf/text/win/WCharStringExtras.h>
    4546
    4647namespace WebCore {
     
    5253static bool getFindData(String path, WIN32_FIND_DATAW& findData)
    5354{
    54     HANDLE handle = FindFirstFileW(path.charactersWithNullTermination().data(), &findData);
     55    HANDLE handle = FindFirstFileW(stringToNullTerminatedWChar(path).data(), &findData);
    5556    if (handle == INVALID_HANDLE_VALUE)
    5657        return false;
     
    220221bool createSymbolicLink(const String& targetPath, const String& symbolicLinkPath)
    221222{
    222     return !::CreateSymbolicLinkW(symbolicLinkPath.charactersWithNullTermination().data(), targetPath.charactersWithNullTermination().data(), 0);
     223    return !::CreateSymbolicLinkW(stringToNullTerminatedWChar(symbolicLinkPath).data(), stringToNullTerminatedWChar(targetPath).data(), 0);
    223224}
    224225
     
    232233{
    233234    String filename = path;
    234     return !!DeleteFileW(filename.charactersWithNullTermination().data());
     235    return !!DeleteFileW(stringToNullTerminatedWChar(filename).data());
    235236}
    236237
     
    238239{
    239240    String filename = path;
    240     return !!RemoveDirectoryW(filename.charactersWithNullTermination().data());
     241    return !!RemoveDirectoryW(stringToNullTerminatedWChar(filename).data());
    241242}
    242243
     
    245246    String oldFilename = oldPath;
    246247    String newFilename = newPath;
    247     return !!::MoveFileEx(oldFilename.charactersWithNullTermination().data(), newFilename.charactersWithNullTermination().data(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
     248    return !!::MoveFileEx(stringToNullTerminatedWChar(oldFilename).data(), stringToNullTerminatedWChar(newFilename).data(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
    248249}
    249250
     
    258259    buffer[path.length()] = '\0';
    259260
    260     if (!PathAppendW(buffer.data(), component.charactersWithNullTermination().data()))
     261    if (!PathAppendW(buffer.data(), stringToNullTerminatedWChar(component).data()))
    261262        return String();
    262263
     
    296297{
    297298    String fullPath = path;
    298     if (SHCreateDirectoryEx(0, fullPath.charactersWithNullTermination().data(), 0) != ERROR_SUCCESS) {
     299    if (SHCreateDirectoryEx(0, stringToNullTerminatedWChar(fullPath).data(), 0) != ERROR_SUCCESS) {
    299300        DWORD error = GetLastError();
    300301        if (error != ERROR_FILE_EXISTS && error != ERROR_ALREADY_EXISTS) {
     
    314315String pathGetFileName(const String& path)
    315316{
    316     return String(::PathFindFileName(String(path).charactersWithNullTermination().data()));
     317    return nullTerminatedWCharToString(::PathFindFileName(stringToNullTerminatedWChar(path).data()));
    317318}
    318319
     
    399400        ASSERT(wcslen(tempFile) == WTF_ARRAY_LENGTH(tempFile) - 1);
    400401
    401         proposedPath = pathByAppendingComponent(tempPath, tempFile);
     402        proposedPath = pathByAppendingComponent(nullTerminatedWCharToString(tempPath), nullTerminatedWCharToString(tempFile));
    402403        if (proposedPath.isEmpty())
    403404            break;
    404405
    405406        // use CREATE_NEW to avoid overwriting an existing file with the same name
    406         handle = ::CreateFileW(proposedPath.charactersWithNullTermination().data(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
     407        handle = ::CreateFileW(stringToNullTerminatedWChar(proposedPath).data(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
    407408    } while (!isHandleValid(handle) && GetLastError() == ERROR_ALREADY_EXISTS);
    408409
     
    433434
    434435    String destination = path;
    435     return CreateFile(destination.charactersWithNullTermination().data(), desiredAccess, shareMode, 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
     436    return CreateFile(stringToNullTerminatedWChar(destination).data(), desiredAccess, shareMode, 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0);
    436437}
    437438
     
    492493bool hardLinkOrCopyFile(const String& source, const String& destination)
    493494{
    494     return !!::CopyFile(source.charactersWithNullTermination().data(), destination.charactersWithNullTermination().data(), TRUE);
     495    return !!::CopyFile(stringToNullTerminatedWChar(source).data(), stringToNullTerminatedWChar(destination).data(), TRUE);
    495496}
    496497
  • trunk/Source/WebCore/platform/win/MIMETypeRegistryWin.cpp

    r165676 r226205  
    3131#include <wtf/MainThread.h>
    3232#include <wtf/WindowsExtras.h>
     33#include <wtf/text/win/WCharStringExtras.h>
    3334
    3435namespace WebCore {
     
    4142    DWORD keyType;
    4243
    43     HRESULT result = getRegistryValue(HKEY_CLASSES_ROOT, ext.charactersWithNullTermination().data(), L"Content Type", &keyType, contentTypeStr, &contentTypeStrLen);
     44    HRESULT result = getRegistryValue(HKEY_CLASSES_ROOT, stringToNullTerminatedWChar(ext).data(), L"Content Type", &keyType, contentTypeStr, &contentTypeStrLen);
    4445
    4546    if (result == ERROR_SUCCESS && keyType == REG_SZ)
    46         return String(contentTypeStr, contentTypeStrLen / sizeof(contentTypeStr[0]) - 1);
     47        return wcharToString(contentTypeStr, contentTypeStrLen / sizeof(contentTypeStr[0]) - 1);
    4748
    4849    return String();
     
    5657    DWORD keyType;
    5758
    58     HRESULT result = getRegistryValue(HKEY_CLASSES_ROOT, path.charactersWithNullTermination().data(), L"Extension", &keyType, extStr, &extStrLen);
     59    HRESULT result = getRegistryValue(HKEY_CLASSES_ROOT, stringToNullTerminatedWChar(path).data(), L"Extension", &keyType, extStr, &extStrLen);
    5960
    6061    if (result == ERROR_SUCCESS && keyType == REG_SZ)
    61         return String(extStr + 1, extStrLen / sizeof(extStr[0]) - 2);
     62        return wcharToString(extStr + 1, extStrLen / sizeof(extStr[0]) - 2);
    6263
    6364    return String();
  • trunk/Source/WebCore/platform/win/PasteboardWin.cpp

    r225127 r226205  
    5252#include <wtf/text/CString.h>
    5353#include <wtf/text/StringView.h>
     54#include <wtf/text/win/WCharStringExtras.h>
    5455#include <wtf/win/GDIObject.h>
    5556
     
    340341            if (!DragQueryFileW(hdrop, i, filename, WTF_ARRAY_LENGTH(filename)))
    341342                continue;
    342             reader.readFilename(filename);
     343            reader.readFilename(nullTerminatedWCharToString(filename));
    343344        }
    344345
     
    960961        if (localPath[0] == '/')
    961962            localPath = localPath.substring(1);
    962         const Vector<UChar>& localPathWide = localPath.charactersWithNullTermination();
     963        auto localPathWide = stringToNullTerminatedWChar(localPath);
    963964        LPCWSTR localPathStr = localPathWide.data();
    964965        if (localPathStr && wcslen(localPathStr) + 1 < MAX_PATH)
     
    971972        if (!::GetTempPath(WTF_ARRAY_LENGTH(tempPath), tempPath))
    972973            return 0;
    973         if (!::PathAppend(tempPath, fileName.charactersWithNullTermination().data()))
     974        if (!::PathAppend(tempPath, stringToNullTerminatedWChar(fileName).data()))
    974975            return 0;
    975976        LPCWSTR foundExtension = ::PathFindExtension(tempPath);
  • trunk/Source/WebCore/platform/win/PathWalker.cpp

    r152142 r226205  
    2828
    2929#include <wtf/text/WTFString.h>
     30#include <wtf/text/win/WCharStringExtras.h>
    3031
    3132namespace WebCore {
     
    3435{
    3536    String path = directory + "\\" + pattern;
    36     m_handle = ::FindFirstFileW(path.charactersWithNullTermination().data(), &m_data);
     37    m_handle = ::FindFirstFileW(stringToNullTerminatedWChar(path).data(), &m_data);
    3738}
    3839
  • trunk/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp

    r208858 r226205  
    2323#include <wtf/text/Base64.h>
    2424#include <wtf/text/CString.h>
     25#include <wtf/text/win/WCharStringExtras.h>
    2526
    2627#include <windows.h>
     
    6869
    6970        // Windows API won't write to our buffer, although it's not declared with const.
    70         const Vector<UChar>& localChallengeWide = localChallenge.charactersWithNullTermination();
     71        auto localChallengeWide = stringToNullTerminatedWChar(localChallenge);
    7172        requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallengeWide.data());
    7273
  • trunk/Source/WebCore/platform/win/SharedBufferWin.cpp

    r216833 r226205  
    3131#include "SharedBuffer.h"
    3232#include <wtf/text/CString.h>
     33#include <wtf/text/win/WCharStringExtras.h>
    3334
    3435namespace WebCore {
     
    4041
    4142    String nullifiedPath = filePath;
    42     HANDLE fileHandle = CreateFileW(nullifiedPath.charactersWithNullTermination().data(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
     43    HANDLE fileHandle = CreateFileW(stringToNullTerminatedWChar(nullifiedPath).data(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
    4344    if (fileHandle == INVALID_HANDLE_VALUE) {
    4445        LOG_ERROR("Failed to open file %s to create shared buffer, GetLastError() = %u", filePath.ascii().data(), GetLastError());
  • trunk/Source/WebCore/rendering/RenderThemeWin.cpp

    r224635 r226205  
    4141#include <wtf/SoftLinking.h>
    4242#include <wtf/text/StringBuilder.h>
     43#include <wtf/text/win/WCharStringExtras.h>
    4344#include <wtf/win/GDIObject.h>
    4445
     
    319320{   
    320321    fontDescription.setIsAbsoluteSize(true);
    321     fontDescription.setOneFamily(String(logFont.lfFaceName));
     322    fontDescription.setOneFamily(nullTerminatedWCharToString(logFont.lfFaceName));
    322323    fontDescription.setSpecifiedSize(fontSize);
    323324    fontDescription.setWeight(logFont.lfWeight >= 700 ? boldWeightValue() : normalWeightValue()); // FIXME: Use real weight.
Note: See TracChangeset for help on using the changeset viewer.