Skip to content
Permalink
Browse files
2010-10-25 Patrick Gansterer <paroga@webkit.org>
        Reviewed by David Kilzer.

        Replace _countof with WTF_ARRAY_LENGTH
        https://bugs.webkit.org/show_bug.cgi?id=48229

        * wtf/Platform.h:
2010-10-25  Patrick Gansterer  <paroga@webkit.org>

        Reviewed by David Kilzer.

        Replace _countof with WTF_ARRAY_LENGTH
        https://bugs.webkit.org/show_bug.cgi?id=48229

        * platform/win/FileSystemWin.cpp:
        (WebCore::openTemporaryFile):
        * platform/wince/FileSystemWinCE.cpp:
        (WebCore::openTemporaryFile):
        * plugins/win/PluginDatabaseWin.cpp:
        (WebCore::addPluginPathsFromRegistry):
        (WebCore::addWindowsMediaPlayerPluginDirectory):
        (WebCore::addMacromediaPluginDirectories):
2010-10-25  Patrick Gansterer  <paroga@webkit.org>

        Reviewed by David Kilzer.

        Replace _countof with WTF_ARRAY_LENGTH
        https://bugs.webkit.org/show_bug.cgi?id=48229

        * WebCoreSupport/WebContextMenuClient.cpp:
        (isPreInspectElementTagSafari):
        * WebView.cpp:
        (WebView::interpretKeyEvent):
2010-10-25  Patrick Gansterer  <paroga@webkit.org>

        Reviewed by David Kilzer.

        Replace _countof with WTF_ARRAY_LENGTH
        https://bugs.webkit.org/show_bug.cgi?id=48229

        * WebCoreSupport/EditorClientWinCE.cpp:
        (WebKit::EditorClientWinCE::interpretKeyEvent):
2010-10-25  Patrick Gansterer  <paroga@webkit.org>

        Reviewed by David Kilzer.

        Replace _countof with WTF_ARRAY_LENGTH
        https://bugs.webkit.org/show_bug.cgi?id=48229

        * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
        (WebKit::ProcessLauncher::launchProcess):
        * UIProcess/Plugins/win/PluginInfoStoreWin.cpp:
        (WebKit::safariPluginsDirectory):
        (WebKit::addMozillaPluginDirectories):
        (WebKit::addWindowsMediaPlayerPluginDirectory):
        (WebKit::addAdobeAcrobatPluginDirectory):
        (WebKit::addMacromediaPluginDirectories):
        (WebKit::addPluginPathsFromRegistry):
        * WebProcess/WebPage/win/WebPageWin.cpp:
        (WebKit::WebPage::interpretKeyEvent):

Canonical link: https://commits.webkit.org/60996@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70460 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
paroga committed Oct 25, 2010
1 parent 2510a19 commit 7694985475ae87aee747655926cf5b4529e2565b
Showing 15 changed files with 90 additions and 33 deletions.
@@ -1,3 +1,12 @@
2010-10-25 Patrick Gansterer <paroga@webkit.org>

Reviewed by David Kilzer.

Replace _countof with WTF_ARRAY_LENGTH
https://bugs.webkit.org/show_bug.cgi?id=48229

* wtf/Platform.h:

2010-10-25 Peter Rybin <peter.rybin@gmail.com>

Reviewed by Adam Barth.
@@ -563,11 +563,6 @@
#define _INC_ASSERT /* disable "assert.h" */
#define assert(x)

/* _countof is only included in CE6; for CE5 we need to define it ourself */
#ifndef _countof
#define _countof(x) (sizeof(x) / sizeof((x)[0]))
#endif

#endif /* OS(WINCE) && !PLATFORM(QT) */

#if PLATFORM(QT)
@@ -1,3 +1,19 @@
2010-10-25 Patrick Gansterer <paroga@webkit.org>

Reviewed by David Kilzer.

Replace _countof with WTF_ARRAY_LENGTH
https://bugs.webkit.org/show_bug.cgi?id=48229

* platform/win/FileSystemWin.cpp:
(WebCore::openTemporaryFile):
* platform/wince/FileSystemWinCE.cpp:
(WebCore::openTemporaryFile):
* plugins/win/PluginDatabaseWin.cpp:
(WebCore::addPluginPathsFromRegistry):
(WebCore::addWindowsMediaPlayerPluginDirectory):
(WebCore::addMacromediaPluginDirectories):

2010-10-25 David Hyatt <hyatt@apple.com>

Reviewed by Sam Weinig.
@@ -192,8 +192,8 @@ CString openTemporaryFile(const char*, PlatformFileHandle& handle)
handle = INVALID_HANDLE_VALUE;

char tempPath[MAX_PATH];
int tempPathLength = ::GetTempPathA(_countof(tempPath), tempPath);
if (tempPathLength <= 0 || tempPathLength > _countof(tempPath))
int tempPathLength = ::GetTempPathA(WTF_ARRAY_LENGTH(tempPath), tempPath);
if (tempPathLength <= 0 || tempPathLength > WTF_ARRAY_LENGTH(tempPath))
return CString();

HCRYPTPROV hCryptProv = 0;
@@ -174,8 +174,8 @@ CString openTemporaryFile(const char*, PlatformFileHandle& handle)
handle = INVALID_HANDLE_VALUE;

wchar_t tempPath[MAX_PATH];
int tempPathLength = ::GetTempPath(_countof(tempPath), tempPath);
if (tempPathLength <= 0 || tempPathLength > _countof(tempPath))
int tempPathLength = ::GetTempPath(WTF_ARRAY_LENGTH(tempPath), tempPath);
if (tempPathLength <= 0 || tempPathLength > WTF_ARRAY_LENGTH(tempPath))
return CString();

HCRYPTPROV hCryptProv = 0;
@@ -34,10 +34,6 @@
#include <windows.h>
#include <shlwapi.h>

#if COMPILER(MINGW)
#define _countof(x) (sizeof(x)/sizeof(x[0]))
#endif

#if OS(WINCE)
// WINCE doesn't support Registry Key Access Rights. The parameter should always be 0
#ifndef KEY_ENUMERATE_SUB_KEYS
@@ -96,7 +92,7 @@ static inline void addPluginPathsFromRegistry(HKEY rootKey, HashSet<String>& pat

// Enumerate subkeys
for (int i = 0;; i++) {
DWORD nameLen = _countof(name);
DWORD nameLen = WTF_ARRAY_LENGTH(name);
result = RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, &lastModified);

if (result != ERROR_SUCCESS)
@@ -257,9 +253,9 @@ static inline void addWindowsMediaPlayerPluginDirectory(Vector<String>& director
#if !OS(WINCE)
// The new WMP Firefox plugin is installed in \PFiles\Plugins if it can't find any Firefox installs
WCHAR pluginDirectoryStr[_MAX_PATH + 1];
DWORD pluginDirectorySize = ::ExpandEnvironmentStringsW(TEXT("%SYSTEMDRIVE%\\PFiles\\Plugins"), pluginDirectoryStr, _countof(pluginDirectoryStr));
DWORD pluginDirectorySize = ::ExpandEnvironmentStringsW(TEXT("%SYSTEMDRIVE%\\PFiles\\Plugins"), pluginDirectoryStr, WTF_ARRAY_LENGTH(pluginDirectoryStr));

if (pluginDirectorySize > 0 && pluginDirectorySize <= _countof(pluginDirectoryStr))
if (pluginDirectorySize > 0 && pluginDirectorySize <= WTF_ARRAY_LENGTH(pluginDirectoryStr))
directories.append(String(pluginDirectoryStr, pluginDirectorySize - 1));
#endif

@@ -410,7 +406,7 @@ static inline void addMacromediaPluginDirectories(Vector<String>& directories)
#if !OS(WINCE)
WCHAR systemDirectoryStr[MAX_PATH];

if (GetSystemDirectory(systemDirectoryStr, _countof(systemDirectoryStr)) == 0)
if (!GetSystemDirectory(systemDirectoryStr, WTF_ARRAY_LENGTH(systemDirectoryStr)))
return;

WCHAR macromediaDirectoryStr[MAX_PATH];
@@ -1,3 +1,15 @@
2010-10-25 Patrick Gansterer <paroga@webkit.org>

Reviewed by David Kilzer.

Replace _countof with WTF_ARRAY_LENGTH
https://bugs.webkit.org/show_bug.cgi?id=48229

* WebCoreSupport/WebContextMenuClient.cpp:
(isPreInspectElementTagSafari):
* WebView.cpp:
(WebView::interpretKeyEvent):

2010-10-24 Dan Bernstein <mitz@apple.com>

Build fix.
@@ -60,7 +60,7 @@ static bool isPreInspectElementTagSafari(IWebUIDelegate* uiDelegate)
return false;

TCHAR modulePath[MAX_PATH];
DWORD length = ::GetModuleFileName(0, modulePath, _countof(modulePath));
DWORD length = ::GetModuleFileName(0, modulePath, WTF_ARRAY_LENGTH(modulePath));
if (!length)
return false;

@@ -1833,10 +1833,10 @@ const char* WebView::interpretKeyEvent(const KeyboardEvent* evt)
keyDownCommandsMap = new HashMap<int, const char*>;
keyPressCommandsMap = new HashMap<int, const char*>;

for (unsigned i = 0; i < _countof(keyDownEntries); i++)
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyDownEntries); ++i)
keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name);

for (unsigned i = 0; i < _countof(keyPressEntries); i++)
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyPressEntries); ++i)
keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name);
}

@@ -1,3 +1,13 @@
2010-10-25 Patrick Gansterer <paroga@webkit.org>

Reviewed by David Kilzer.

Replace _countof with WTF_ARRAY_LENGTH
https://bugs.webkit.org/show_bug.cgi?id=48229

* WebCoreSupport/EditorClientWinCE.cpp:
(WebKit::EditorClientWinCE::interpretKeyEvent):

2010-10-22 Sam Weinig <sam@webkit.org>

Reviewed by Anders Carlsson.
@@ -313,10 +313,10 @@ const char* EditorClientWinCE::interpretKeyEvent(const KeyboardEvent* event)
keyDownCommandsMap = new HashMap<int, const char*>;
keyPressCommandsMap = new HashMap<int, const char*>;

for (unsigned i = 0; i < _countof(keyDownEntries); i++)
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyDownEntries); ++i)
keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name);

for (unsigned i = 0; i < _countof(keyPressEntries); i++)
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyPressEntries); ++i)
keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name);
}

@@ -1,3 +1,22 @@
2010-10-25 Patrick Gansterer <paroga@webkit.org>

Reviewed by David Kilzer.

Replace _countof with WTF_ARRAY_LENGTH
https://bugs.webkit.org/show_bug.cgi?id=48229

* UIProcess/Launcher/win/ProcessLauncherWin.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Plugins/win/PluginInfoStoreWin.cpp:
(WebKit::safariPluginsDirectory):
(WebKit::addMozillaPluginDirectories):
(WebKit::addWindowsMediaPlayerPluginDirectory):
(WebKit::addAdobeAcrobatPluginDirectory):
(WebKit::addMacromediaPluginDirectories):
(WebKit::addPluginPathsFromRegistry):
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::interpretKeyEvent):

2010-10-25 Adam Roben <aroben@apple.com>

Stop copying .messages.in files into WebKit2's framework bundle
@@ -64,7 +64,7 @@ void ProcessLauncher::launchProcess()
return;

WCHAR pathStr[MAX_PATH];
if (!::GetModuleFileNameW(webKitModule, pathStr, _countof(pathStr)))
if (!::GetModuleFileNameW(webKitModule, pathStr, WTF_ARRAY_LENGTH(pathStr)))
return;

::PathRemoveFileSpecW(pathStr);
@@ -82,9 +82,9 @@ static inline String safariPluginsDirectory()
cachedPluginDirectory = true;

WCHAR moduleFileNameStr[MAX_PATH];
int moduleFileNameLen = ::GetModuleFileNameW(0, moduleFileNameStr, _countof(moduleFileNameStr));
int moduleFileNameLen = ::GetModuleFileNameW(0, moduleFileNameStr, WTF_ARRAY_LENGTH(moduleFileNameStr));

if (!moduleFileNameLen || moduleFileNameLen == _countof(moduleFileNameStr))
if (!moduleFileNameLen || moduleFileNameLen == WTF_ARRAY_LENGTH(moduleFileNameStr))
return pluginsDirectory;

if (!::PathRemoveFileSpecW(moduleFileNameStr))
@@ -109,7 +109,7 @@ static inline void addMozillaPluginDirectories(Vector<String>& directories)

// Enumerate subkeys
for (int i = 0;; i++) {
DWORD nameLen = _countof(name);
DWORD nameLen = WTF_ARRAY_LENGTH(name);
result = ::RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, &lastModified);

if (result != ERROR_SUCCESS)
@@ -143,9 +143,9 @@ static inline void addWindowsMediaPlayerPluginDirectory(Vector<String>& director
{
// The new WMP Firefox plugin is installed in \PFiles\Plugins if it can't find any Firefox installs
WCHAR pluginDirectoryStr[MAX_PATH + 1];
DWORD pluginDirectorySize = ::ExpandEnvironmentStringsW(L"%SYSTEMDRIVE%\\PFiles\\Plugins", pluginDirectoryStr, _countof(pluginDirectoryStr));
DWORD pluginDirectorySize = ::ExpandEnvironmentStringsW(L"%SYSTEMDRIVE%\\PFiles\\Plugins", pluginDirectoryStr, WTF_ARRAY_LENGTH(pluginDirectoryStr));

if (pluginDirectorySize > 0 && pluginDirectorySize <= _countof(pluginDirectoryStr))
if (pluginDirectorySize > 0 && pluginDirectorySize <= WTF_ARRAY_LENGTH(pluginDirectoryStr))
directories.append(String(pluginDirectoryStr, pluginDirectorySize - 1));

DWORD type;
@@ -187,7 +187,7 @@ static inline void addAdobeAcrobatPluginDirectory(Vector<String>& directories)

// Enumerate subkeys
for (int i = 0;; i++) {
DWORD nameLen = _countof(name);
DWORD nameLen = WTF_ARRAY_LENGTH(name);
result = ::RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, &lastModified);

if (result != ERROR_SUCCESS)
@@ -222,7 +222,7 @@ static inline void addMacromediaPluginDirectories(Vector<String>& directories)
#if !OS(WINCE)
WCHAR systemDirectoryStr[MAX_PATH];

if (!::GetSystemDirectoryW(systemDirectoryStr, _countof(systemDirectoryStr)))
if (!::GetSystemDirectoryW(systemDirectoryStr, WTF_ARRAY_LENGTH(systemDirectoryStr)))
return;

WCHAR macromediaDirectoryStr[MAX_PATH];
@@ -312,7 +312,7 @@ static void addPluginPathsFromRegistry(HKEY rootKey, Vector<String>& paths)
for (size_t i = 0; ; ++i) {
// MSDN says that key names have a maximum length of 255 characters.
wchar_t name[256];
DWORD nameLen = _countof(name);
DWORD nameLen = WTF_ARRAY_LENGTH(name);
if (::RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, 0) != ERROR_SUCCESS)
break;

@@ -157,10 +157,10 @@ const char* WebPage::interpretKeyEvent(const KeyboardEvent* evt)
keyDownCommandsMap = new HashMap<int, const char*>;
keyPressCommandsMap = new HashMap<int, const char*>;

for (unsigned i = 0; i < _countof(keyDownEntries); i++)
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyDownEntries); ++i)
keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name);

for (unsigned i = 0; i < _countof(keyPressEntries); i++)
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyPressEntries); ++i)
keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name);
}

0 comments on commit 7694985

Please sign in to comment.