Changeset 217771 in webkit
- Timestamp:
- Jun 4, 2017 9:38:39 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r217770 r217771 1 2017-06-04 Konstantin Tokarev <annulen@yandex.ru> 2 3 Fix build of Windows-specific code with ICU 59.1 4 https://bugs.webkit.org/show_bug.cgi?id=172729 5 6 Reviewed by Darin Adler. 7 8 Fix conversions from WTF::String to wchar_t* and vice versa. 9 10 * jsc.cpp: 11 (currentWorkingDirectory): 12 (fetchModuleFromLocalFileSystem): 13 * runtime/DateConversion.cpp: 14 (JSC::formatDateTime): 15 1 16 2017-06-04 Yusuke Suzuki <utatane.tea@gmail.com> 2 17 -
trunk/Source/JavaScriptCore/jsc.cpp
r217523 r217771 97 97 #if OS(WINDOWS) 98 98 #include <direct.h> 99 #include <wtf/text/win/WCharStringExtras.h> 99 100 #else 100 101 #include <unistd.h> … … 1568 1569 auto buffer = std::make_unique<wchar_t[]>(bufferLength); 1569 1570 DWORD lengthNotIncludingNull = ::GetCurrentDirectoryW(bufferLength, buffer.get()); 1570 static_assert(sizeof(wchar_t) == sizeof(UChar), "In Windows, both are UTF-16LE"); 1571 String directoryString = String(reinterpret_cast<UChar*>(buffer.get())); 1571 String directoryString = nullTerminatedWCharToString(buffer.get()); 1572 1572 // We don't support network path like \\host\share\<path name>. 1573 1573 if (directoryString.startsWith("\\\\")) … … 1746 1746 // Use long UNC to pass the long path name to the Windows APIs. 1747 1747 String longUNCPathName = WTF::makeString("\\\\?\\", fileName); 1748 static_assert(sizeof(wchar_t) == sizeof(UChar), "In Windows, both are UTF-16LE"); 1749 auto utf16Vector = longUNCPathName.charactersWithNullTermination(); 1750 FILE* f = _wfopen(reinterpret_cast<wchar_t*>(utf16Vector.data()), L"rb"); 1748 FILE* f = _wfopen(stringToNullTerminatedWChar(longUNCPathName).data(), L"rb"); 1751 1749 #else 1752 1750 FILE* f = fopen(fileName.utf8().data(), "r"); -
trunk/Source/JavaScriptCore/runtime/DateConversion.cpp
r216187 r217771 33 33 #if OS(WINDOWS) 34 34 #include <windows.h> 35 #include <wtf/text/win/WCharStringExtras.h> 35 36 #endif 36 37 … … 109 110 GetTimeZoneInformation(&timeZoneInformation); 110 111 const WCHAR* winTimeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName; 111 String timeZoneName (reinterpret_cast<const UChar*>(winTimeZoneName));112 String timeZoneName = nullTerminatedWCharToString(winTimeZoneName); 112 113 #else 113 114 struct tm gtm = t; -
trunk/Source/WTF/ChangeLog
r217736 r217771 1 2017-06-04 Konstantin Tokarev <annulen@yandex.ru> 2 3 Fix build of Windows-specific code with ICU 59.1 4 https://bugs.webkit.org/show_bug.cgi?id=172729 5 6 Reviewed by Darin Adler. 7 8 * wtf/text/win/WCharStringExtras.h: Added new header file wuth helper 9 functions for conversion between WTF::String and wchart_t*. 10 (WTF::stringToNullTerminatedWChar): 11 (WTF::wcharToString): 12 (WTF::nullTerminatedWCharToString): 13 1 14 2017-06-02 Stephan Szabo <stephan.szabo@am.sony.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r217767 r217771 1 2017-06-04 Konstantin Tokarev <annulen@yandex.ru> 2 3 Fix build of Windows-specific code with ICU 59.1 4 https://bugs.webkit.org/show_bug.cgi?id=172729 5 6 Reviewed by Darin Adler. 7 8 Fix conversions from WTF::String to wchar_t* and vice versa. 9 No new tests needed. 10 11 * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: 12 (WebCore::mimeTypeCache): 13 (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource): 14 1 15 2017-06-04 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
r201482 r217771 43 43 #include <wtf/MainThread.h> 44 44 #include <wtf/NeverDestroyed.h> 45 #include <wtf/text/win/WCharStringExtras.h> 45 46 46 47 SOFT_LINK_LIBRARY(Mf); … … 143 144 CALPWSTR mimeTypeArray = propVarMimeTypeArray.calpwstr; 144 145 for (unsigned i = 0; i < mimeTypeArray.cElems; i++) 145 cachedTypes.get().add( mimeTypeArray.pElems[i]);146 cachedTypes.get().add(nullTerminatedWCharToString(mimeTypeArray.pElems[i])); 146 147 } 147 148 … … 461 462 462 463 COMPtr<IUnknown> cancelCookie; 463 Vector< UChar> urlSource = url.charactersWithNullTermination();464 Vector<wchar_t> urlSource = stringToNullTerminatedWChar(url); 464 465 465 466 AsyncCallback* callback = new AsyncCallback(this, false); -
trunk/Source/WebKit/win/ChangeLog
r217557 r217771 1 2017-06-04 Konstantin Tokarev <annulen@yandex.ru> 2 3 Fix build of Windows-specific code with ICU 59.1 4 https://bugs.webkit.org/show_bug.cgi?id=172729 5 6 Reviewed by Darin Adler. 7 8 Fix conversions from WTF::String to wchar_t* and vice versa. 9 10 * Plugins/PluginDatabaseWin.cpp: 11 (WebCore::addPluginPathsFromRegistry): 12 (WebCore::PluginDatabase::getPluginPathsInDirectories): 13 (WebCore::addMozillaPluginDirectories): 14 (WebCore::addWindowsMediaPlayerPluginDirectory): 15 (WebCore::addAdobeAcrobatPluginDirectory): 16 (WebCore::addJavaPluginDirectory): 17 (WebCore::safariPluginsDirectory): 18 (WebCore::addMacromediaPluginDirectories): 19 * Plugins/PluginPackageWin.cpp: 20 (WebCore::getVersionInfo): 21 (WebCore::PluginPackage::fetchInfo): 22 (WebCore::PluginPackage::load): 23 * Plugins/PluginViewWin.cpp: 24 (WebCore::PluginView::handlePostReadFile): 25 1 26 2017-05-30 Per Arne Vollan <pvollan@apple.com> 2 27 -
trunk/Source/WebKit/win/Plugins/PluginDatabaseWin.cpp
r195743 r217771 33 33 #include "PluginPackage.h" 34 34 #include <wtf/WindowsExtras.h> 35 #include <wtf/text/win/WCharStringExtras.h> 35 36 36 37 namespace WebCore { … … 63 64 continue; 64 65 65 paths.add( String(pathStr, pathStrSize / sizeof(WCHAR) - 1));66 paths.add(wcharToString(pathStr, pathStrSize / sizeof(WCHAR) - 1)); 66 67 } 67 68 … … 84 85 String pattern = *it + "\\*"; 85 86 86 hFind = FindFirstFileW( pattern.charactersWithNullTermination().data(), &findFileData);87 hFind = FindFirstFileW(stringToNullTerminatedWChar(pattern).data(), &findFileData); 87 88 88 89 if (hFind == INVALID_HANDLE_VALUE) … … 93 94 continue; 94 95 95 String filename = String(findFileData.cFileName, wcslen(findFileData.cFileName));96 String filename = wcharToString(findFileData.cFileName, wcslen(findFileData.cFileName)); 96 97 if ((!filename.startsWith("np", false) || !filename.endsWith("dll", false)) && 97 98 (!equalLettersIgnoringASCIICase(filename, "plugin.dll") || !it->endsWith("Shockwave 10", false))) … … 180 181 break; 181 182 182 String extensionsPath = String(name, nameLen) + "\\Extensions";183 String extensionsPath = wcharToString(name, nameLen) + "\\Extensions"; 183 184 HKEY extensionsKey; 184 185 185 186 // Try opening the key 186 result = RegOpenKeyEx(key, extensionsPath.charactersWithNullTermination().data(), 0, KEY_READ, &extensionsKey);187 result = RegOpenKeyEx(key, stringToNullTerminatedWChar(extensionsPath).data(), 0, KEY_READ, &extensionsKey); 187 188 188 189 if (result == ERROR_SUCCESS) { … … 195 196 196 197 if (result == ERROR_SUCCESS && type == REG_SZ) 197 directories.append( String(pluginsDirectoryStr, pluginsDirectorySize / sizeof(WCHAR) - 1));198 directories.append(wcharToString(pluginsDirectoryStr, pluginsDirectorySize / sizeof(WCHAR) - 1)); 198 199 199 200 RegCloseKey(extensionsKey); … … 212 213 213 214 if (pluginDirectorySize > 0 && pluginDirectorySize <= WTF_ARRAY_LENGTH(pluginDirectoryStr)) 214 directories.append( String(pluginDirectoryStr, pluginDirectorySize - 1));215 directories.append(wcharToString(pluginDirectoryStr, pluginDirectorySize - 1)); 215 216 216 217 DWORD type; … … 221 222 222 223 if (result == ERROR_SUCCESS && type == REG_SZ) 223 directories.append( String(installationDirectoryStr, installationDirectorySize / sizeof(WCHAR) - 1));224 directories.append(wcharToString(installationDirectoryStr, installationDirectorySize / sizeof(WCHAR) - 1)); 224 225 } 225 226 … … 245 246 break; 246 247 247 Vector<int> acrobatVersion = parseVersionString( String(name, nameLen));248 Vector<int> acrobatVersion = parseVersionString(wcharToString(name, nameLen)); 248 249 if (compareVersions(acrobatVersion, latestAcrobatVersion)) { 249 250 latestAcrobatVersion = acrobatVersion; 250 latestAcrobatVersionString = String(name, nameLen);251 latestAcrobatVersionString = wcharToString(name, nameLen); 251 252 } 252 253 } … … 258 259 259 260 String acrobatPluginKeyPath = "Software\\Adobe\\Acrobat Reader\\" + latestAcrobatVersionString + "\\InstallPath"; 260 result = getRegistryValue(HKEY_LOCAL_MACHINE, acrobatPluginKeyPath.charactersWithNullTermination().data(), 0, &type, acrobatInstallPathStr, &acrobatInstallPathSize);261 result = getRegistryValue(HKEY_LOCAL_MACHINE, stringToNullTerminatedWChar(acrobatPluginKeyPath).data(), 0, &type, acrobatInstallPathStr, &acrobatInstallPathSize); 261 262 262 263 if (result == ERROR_SUCCESS) { 263 String acrobatPluginDirectory = String(acrobatInstallPathStr, acrobatInstallPathSize / sizeof(WCHAR) - 1) + "\\browser";264 String acrobatPluginDirectory = wcharToString(acrobatInstallPathStr, acrobatInstallPathSize / sizeof(WCHAR) - 1) + "\\browser"; 264 265 directories.append(acrobatPluginDirectory); 265 266 } … … 290 291 break; 291 292 292 Vector<int> javaVersion = parseVersionString( String(name, nameLen));293 Vector<int> javaVersion = parseVersionString(wcharToString(name, nameLen)); 293 294 if (compareVersions(javaVersion, latestJavaVersion)) { 294 295 latestJavaVersion = javaVersion; 295 latestJavaVersionString = String(name, nameLen);296 latestJavaVersionString = wcharToString(name, nameLen); 296 297 } 297 298 } … … 305 306 306 307 String javaPluginKeyPath = "Software\\JavaSoft\\Java Plug-in\\" + latestJavaVersionString; 307 result = getRegistryValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.charactersWithNullTermination().data(), L"UseNewJavaPlugin", &type, &useNewPluginValue, &useNewPluginSize);308 result = getRegistryValue(HKEY_LOCAL_MACHINE, stringToNullTerminatedWChar(javaPluginKeyPath).data(), L"UseNewJavaPlugin", &type, &useNewPluginValue, &useNewPluginSize); 308 309 309 310 if (result == ERROR_SUCCESS && useNewPluginValue == 1) { 310 result = getRegistryValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.charactersWithNullTermination().data(), L"JavaHome", &type, javaInstallPathStr, &javaInstallPathSize);311 result = getRegistryValue(HKEY_LOCAL_MACHINE, stringToNullTerminatedWChar(javaPluginKeyPath).data(), L"JavaHome", &type, javaInstallPathStr, &javaInstallPathSize); 311 312 if (result == ERROR_SUCCESS) { 312 String javaPluginDirectory = String(javaInstallPathStr, javaInstallPathSize / sizeof(WCHAR) - 1) + "\\bin\\new_plugin";313 String javaPluginDirectory = wcharToString(javaInstallPathStr, javaInstallPathSize / sizeof(WCHAR) - 1) + "\\bin\\new_plugin"; 313 314 directories.append(javaPluginDirectory); 314 315 } … … 336 337 goto exit; 337 338 338 pluginsDirectory = String(moduleFileNameStr) + "\\Plugins";339 pluginsDirectory = nullTerminatedWCharToString(moduleFileNameStr) + "\\Plugins"; 339 340 } 340 341 exit: … … 352 353 353 354 PathCombine(macromediaDirectoryStr, systemDirectoryStr, TEXT("macromed\\Flash")); 354 directories.append( macromediaDirectoryStr);355 directories.append(nullTerminatedWCharToString(macromediaDirectoryStr)); 355 356 356 357 PathCombine(macromediaDirectoryStr, systemDirectoryStr, TEXT("macromed\\Shockwave 10")); 357 directories.append( macromediaDirectoryStr);358 directories.append(nullTerminatedWCharToString(macromediaDirectoryStr)); 358 359 } 359 360 -
trunk/Source/WebKit/win/Plugins/PluginPackageWin.cpp
r196223 r217771 35 35 #include "Timer.h" 36 36 #include "npruntime_impl.h" 37 #include <shlwapi.h> 37 38 #include <string.h> 38 39 #include <wtf/StdLibExtras.h> 39 40 #include <wtf/text/CString.h> 40 #include < shlwapi.h>41 #include <wtf/text/win/WCharStringExtras.h> 41 42 42 43 namespace WebCore { … … 48 49 String subInfo = "\\StringfileInfo\\040904E4\\" + info; 49 50 bool retval = VerQueryValueW(versionInfoData, 50 const_cast<UChar*>(subInfo.charactersWithNullTermination().data()),51 stringToNullTerminatedWChar(subInfo).data(), 51 52 &buffer, &bufferLength); 52 53 if (!retval || bufferLength == 0) … … 168 169 { 169 170 DWORD versionInfoSize, zeroHandle; 170 versionInfoSize = GetFileVersionInfoSizeW( const_cast<UChar*>(m_path.charactersWithNullTermination().data()), &zeroHandle);171 versionInfoSize = GetFileVersionInfoSizeW(stringToNullTerminatedWChar(m_path).data(), &zeroHandle); 171 172 if (versionInfoSize == 0) 172 173 return false; … … 174 175 auto versionInfoData = std::make_unique<char[]>(versionInfoSize); 175 176 176 if (!GetFileVersionInfoW(const_cast<UChar*>(m_path.charactersWithNullTermination().data()), 177 0, versionInfoSize, versionInfoData.get())) 177 if (!GetFileVersionInfoW(stringToNullTerminatedWChar(m_path).data(), 0, versionInfoSize, versionInfoData.get())) 178 178 return false; 179 179 … … 245 245 String path = m_path.substring(0, m_path.reverseFind('\\')); 246 246 247 if (!::SetCurrentDirectoryW( path.charactersWithNullTermination().data()))247 if (!::SetCurrentDirectoryW(stringToNullTerminatedWChar(path).data())) 248 248 return false; 249 249 250 250 // Load the library 251 m_module = ::LoadLibraryExW( m_path.charactersWithNullTermination().data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);251 m_module = ::LoadLibraryExW(stringToNullTerminatedWChar(m_path).data(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); 252 252 253 253 if (!::SetCurrentDirectoryW(currentPath)) { -
trunk/Source/WebKit/win/Plugins/PluginViewWin.cpp
r216554 r217771 73 73 #include <wtf/ASCIICType.h> 74 74 #include <wtf/text/WTFString.h> 75 #include <wtf/text/win/WCharStringExtras.h> 75 76 #include <wtf/win/GDIObject.h> 76 77 … … 762 763 // Get file info 763 764 WIN32_FILE_ATTRIBUTE_DATA attrs; 764 if ( GetFileAttributesExW(filename.charactersWithNullTermination().data(), GetFileExInfoStandard, &attrs) == 0)765 if (!GetFileAttributesExW(stringToNullTerminatedWChar(filename).data(), GetFileExInfoStandard, &attrs)) 765 766 return NPERR_FILE_NOT_FOUND; 766 767 … … 768 769 return NPERR_FILE_NOT_FOUND; 769 770 770 HANDLE fileHandle = CreateFileW( filename.charactersWithNullTermination().data(), FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);771 HANDLE fileHandle = CreateFileW(stringToNullTerminatedWChar(filename).data(), FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); 771 772 772 773 if (fileHandle == INVALID_HANDLE_VALUE)
Note: See TracChangeset
for help on using the changeset viewer.