Pick up a few straggler uses of {NS,JS}_ARRAY_LENGTH, probably added since the switch but before the deprecation announcement, and convert them to mozilla::ArrayLength. Also convert the two users of PR_ARRAY_SIZE, yet another length-computing macro, to mozilla::ArrayLength. No bug, r=sparky

--HG--
extra : rebase_source : f019e35a037516df872d0efb7262fa9c475f903c
This commit is contained in:
Jeff Walden 2011-10-21 03:16:47 -07:00
Родитель a29dccaf37
Коммит e3f1dfe121
6 изменённых файлов: 25 добавлений и 13 удалений

Просмотреть файл

@ -37,6 +37,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "Events.h"
#include "jsapi.h"
@ -57,6 +59,7 @@
#define CONSTANT_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT | JSPROP_READONLY
using namespace mozilla;
USING_WORKERS_NAMESPACE
namespace {
@ -1126,7 +1129,7 @@ DispatchEventToTarget(JSContext* aCx, JSObject* aTarget, JSObject* aEvent,
if (hasProperty) {
jsval argv[] = { OBJECT_TO_JSVAL(aEvent) };
jsval rval = JSVAL_VOID;
if (!JS_CallFunctionName(aCx, aTarget, kFunctionName, JS_ARRAY_LENGTH(argv),
if (!JS_CallFunctionName(aCx, aTarget, kFunctionName, ArrayLength(argv),
argv, &rval) ||
!JS_ValueToBoolean(aCx, rval, &preventDefaultCalled)) {
return false;

Просмотреть файл

@ -37,6 +37,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "Exceptions.h"
#include "jsapi.h"
@ -54,6 +56,7 @@
#define CONSTANT_FLAGS \
JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT | JSPROP_READONLY
using namespace mozilla;
USING_WORKERS_NAMESPACE
namespace {
@ -247,9 +250,7 @@ DOMException::Create(JSContext* aCx, intN aCode)
}
size_t foundIndex = size_t(-1);
for (size_t index = 0;
index < JS_ARRAY_LENGTH(sStaticProperties) - 1;
index++) {
for (size_t index = 0; index < ArrayLength(sStaticProperties) - 1; index++) {
if (sStaticProperties[index].tinyid == aCode) {
foundIndex = index;
break;
@ -397,9 +398,7 @@ FileException::Create(JSContext* aCx, intN aCode)
}
size_t foundIndex = size_t(-1);
for (size_t index = 0;
index < JS_ARRAY_LENGTH(sStaticProperties) - 1;
index++) {
for (size_t index = 0; index < ArrayLength(sStaticProperties) - 1; index++) {
if (sStaticProperties[index].tinyid == aCode) {
foundIndex = index;
break;

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "ListenerManager.h"
#include "jsapi.h"
@ -44,7 +46,8 @@
#include "Events.h"
using mozilla::dom::workers::events::ListenerManager;
using namespace mozilla;
using dom::workers::events::ListenerManager;
namespace {
@ -426,7 +429,7 @@ ListenerManager::DispatchEvent(JSContext* aCx, JSObject* aTarget,
jsval argv[] = { OBJECT_TO_JSVAL(aEvent) };
jsval rval = JSVAL_VOID;
if (!JS_CallFunctionValue(aCx, aTarget, listenerVal, JS_ARRAY_LENGTH(argv),
if (!JS_CallFunctionValue(aCx, aTarget, listenerVal, ArrayLength(argv),
argv, &rval)) {
if (!JS_ReportPendingException(aCx)) {
return false;

Просмотреть файл

@ -37,6 +37,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "WorkerScope.h"
#include "jsapi.h"
@ -68,6 +70,7 @@
#define FUNCTION_FLAGS \
JSPROP_ENUMERATE
using namespace mozilla;
USING_WORKERS_NAMESPACE
namespace {
@ -287,7 +290,7 @@ private:
jsval rval = JSVAL_VOID;
if (!JS_CallFunctionValue(aCx, JSVAL_TO_OBJECT(scope), listener,
JS_ARRAY_LENGTH(argv), argv, &rval)) {
ArrayLength(argv), argv, &rval)) {
JS_ReportPendingException(aCx);
return false;
}

Просмотреть файл

@ -2817,7 +2817,7 @@ nsLocalFile::RevealUsingShell()
}
const ITEMIDLIST* selection[] = { dir };
UINT count = PR_ARRAY_SIZE(selection);
UINT count = ArrayLength(selection);
//Perform the open of the directory.
hr = sSHOpenFolderAndSelectItems(dir, count, selection, 0);
@ -2846,7 +2846,7 @@ nsLocalFile::RevealUsingShell()
}
const ITEMIDLIST* selection[] = { item };
UINT count = PR_ARRAY_SIZE(selection);
UINT count = ArrayLength(selection);
//Perform the selection of the file.
hr = sSHOpenFolderAndSelectItems(dir, count, selection, 0);

Просмотреть файл

@ -38,6 +38,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "jscntxt.h"
#include "nscore.h"
#include "plstr.h"
@ -52,6 +54,8 @@
#include "nsICryptoHash.h"
#include "nsIX509Cert.h"
using namespace mozilla;
//
// nsXPITriggerItem
//
@ -246,7 +250,7 @@ XPITriggerEvent::Run()
// Build arguments into rooted jsval array
jsval args[2] = { JSVAL_NULL, JSVAL_NULL };
js::AutoArrayRooter tvr(cx, JS_ARRAY_LENGTH(args), args);
js::AutoArrayRooter tvr(cx, ArrayLength(args), args);
// args[0] is the URL
JSString *str = JS_NewUCStringCopyZ(cx, reinterpret_cast<const jschar*>(URL.get()));