RESOLVED FIXED 118155
Add a new String::charactersWithNullTermination() function that returns a vector
https://bugs.webkit.org/show_bug.cgi?id=118155
Summary Add a new String::charactersWithNullTermination() function that returns a vector
Anders Carlsson
Reported 2013-06-27 16:36:21 PDT
Add a new String::charactersWithNullTermination() function that returns a vector
Attachments
Patch (46.38 KB, patch)
2013-06-27 16:38 PDT, Anders Carlsson
kling: review+
Anders Carlsson
Comment 1 2013-06-27 16:38:59 PDT
WebKit Commit Bot
Comment 2 2013-06-27 16:41:12 PDT
Attachment 205646 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/text/WTFString.cpp', u'Source/WTF/wtf/text/WTFString.h', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/graphics/win/FontCacheWin.cpp', u'Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp', u'Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp', u'Source/WebCore/platform/graphics/win/IconWin.cpp', u'Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp', u'Source/WebCore/platform/graphics/wince/FontPlatformData.cpp', u'Source/WebCore/platform/network/curl/CurlDownload.cpp', u'Source/WebCore/platform/network/win/CookieJarWin.cpp', u'Source/WebCore/platform/network/win/DownloadBundleWin.cpp', u'Source/WebCore/platform/network/win/ResourceHandleWin.cpp', u'Source/WebCore/platform/text/win/LocaleWin.cpp', u'Source/WebCore/platform/text/win/TextCodecWin.cpp', u'Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp', u'Source/WebCore/platform/win/ContextMenuWin.cpp', u'Source/WebCore/platform/win/DragImageWin.cpp', u'Source/WebCore/platform/win/FileSystemWin.cpp', u'Source/WebCore/platform/win/MIMETypeRegistryWin.cpp', u'Source/WebCore/platform/win/PasteboardWin.cpp', u'Source/WebCore/platform/win/PathWalker.cpp', u'Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp', u'Source/WebCore/platform/win/SharedBufferWin.cpp', u'Source/WebCore/platform/wince/FileSystemWinCE.cpp', u'Source/WebCore/plugins/win/PluginDatabaseWin.cpp', u'Source/WebCore/plugins/win/PluginPackageWin.cpp', u'Source/WebCore/plugins/win/PluginViewWin.cpp']" exit_code: 1 Source/WebCore/platform/network/win/ResourceHandleWin.cpp:310: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/plugins/win/PluginViewWin.cpp:900: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Source/WebCore/platform/graphics/win/FontCacheWin.cpp:103: Use 0 instead of NULL. [readability/null] [5] Source/WebCore/platform/graphics/win/FontCacheWin.cpp:105: Use 0 instead of NULL. [readability/null] [5] Total errors found: 4 in 29 files If any of these errors are false positives, please file a bug against check-webkit-style.
Andreas Kling
Comment 3 2013-06-27 17:14:27 PDT
Comment on attachment 205646 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205646&action=review > Source/WTF/wtf/text/WTFString.cpp:401 > + if (m_impl) { No early return?
Anders Carlsson
Comment 4 2013-06-27 17:20:20 PDT
Brent Fulgham
Comment 5 2013-07-19 11:54:54 PDT
Comment on attachment 205646 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205646&action=review These changes broke a few things on Windows. I'll correct under a separate bug. > Source/WebCore/platform/win/ContextMenuWin.cpp:126 > + menuItem.dwTypeData = const_cast<LPWSTR>(itemTitle.charactersWithNullTermination().data()); This definitely breaks things due to asking the menuItem to display a (possibly re-used) temporary memory address. > Source/WebCore/platform/win/PasteboardWin.cpp:966 > + LPCWSTR localPathStr = localPath.charactersWithNullTermination().data(); I think this might break things, because we are using the address of a temporary. > Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp:71 > + requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallenge.charactersWithNullTermination().data()); Holding onto the address of a temporary!
Note You need to log in before you can comment on or make changes to this bug.