mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 658405 - Use NS_ARRAY_LENGTH macro. r=karlt
--HG-- extra : rebase_source : a8063e50e165735d0623e5ac08d4f020f8d34275
This commit is contained in:
parent
e1b022a91f
commit
341957a759
@ -53,7 +53,7 @@ static const char gSymName[][sizeof("cupsPrintFile")] = {
|
||||
{ "cupsPrintFile" },
|
||||
{ "cupsTempFd" },
|
||||
};
|
||||
static const int gSymNameCt = sizeof(gSymName) / sizeof(gSymName[0]);
|
||||
static const int gSymNameCt = NS_ARRAY_LENGTH(gSymName);
|
||||
|
||||
|
||||
PRBool
|
||||
|
@ -190,7 +190,7 @@ struct nsKeyConverter nsSunKeycodes[] = {
|
||||
int
|
||||
GdkKeyCodeToDOMKeyCode(int aKeysym)
|
||||
{
|
||||
int i, length = 0;
|
||||
unsigned int i;
|
||||
|
||||
// First, try to handle alphanumeric input, not listed in nsKeycodes:
|
||||
// most likely, more letters will be getting typed in than things in
|
||||
@ -213,16 +213,14 @@ GdkKeyCodeToDOMKeyCode(int aKeysym)
|
||||
|
||||
#ifdef SOLARIS
|
||||
// map Sun Keyboard special keysyms
|
||||
length = sizeof(nsSunKeycodes) / sizeof(struct nsKeyConverter);
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsSunKeycodes); i++) {
|
||||
if (nsSunKeycodes[i].keysym == aKeysym)
|
||||
return(nsSunKeycodes[i].vkCode);
|
||||
}
|
||||
#endif /* SOLARIS */
|
||||
|
||||
// misc other things
|
||||
length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter);
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsKeycodes); i++) {
|
||||
if (nsKeycodes[i].keysym == aKeysym)
|
||||
return(nsKeycodes[i].vkCode);
|
||||
}
|
||||
@ -237,7 +235,7 @@ GdkKeyCodeToDOMKeyCode(int aKeysym)
|
||||
int
|
||||
DOMKeyCodeToGdkKeyCode(int aKeysym)
|
||||
{
|
||||
int i, length = 0;
|
||||
unsigned int i;
|
||||
|
||||
// First, try to handle alphanumeric input, not listed in nsKeycodes:
|
||||
// most likely, more letters will be getting typed in than things in
|
||||
@ -257,8 +255,7 @@ DOMKeyCodeToGdkKeyCode(int aKeysym)
|
||||
return aKeysym - NS_VK_NUMPAD0 + GDK_KP_0;
|
||||
|
||||
// misc other things
|
||||
length = NS_ARRAY_LENGTH(nsKeycodes);
|
||||
for (i = 0; i < length; ++i) {
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsKeycodes); ++i) {
|
||||
if (nsKeycodes[i].vkCode == aKeysym) {
|
||||
return nsKeycodes[i].keysym;
|
||||
}
|
||||
|
@ -41,8 +41,7 @@
|
||||
#include "nsPaperPS.h"
|
||||
#include "plstr.h"
|
||||
#include "nsCoord.h"
|
||||
|
||||
#define COUNTOF(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#include "nsMemory.h"
|
||||
|
||||
const nsPaperSizePS_ nsPaperSizePS::mList[] =
|
||||
{
|
||||
@ -59,7 +58,7 @@ const nsPaperSizePS_ nsPaperSizePS::mList[] =
|
||||
#undef SIZE_MM
|
||||
};
|
||||
|
||||
const unsigned int nsPaperSizePS::mCount = COUNTOF(mList);
|
||||
const unsigned int nsPaperSizePS::mCount = NS_ARRAY_LENGTH(mList);
|
||||
|
||||
PRBool
|
||||
nsPaperSizePS::Find(const char *aName)
|
||||
|
@ -184,7 +184,7 @@ struct nsKeyConverter nsSunKeycodes[] = {
|
||||
int
|
||||
QtKeyCodeToDOMKeyCode(int aKeysym)
|
||||
{
|
||||
int i, length = 0;
|
||||
unsigned int i;
|
||||
|
||||
// First, try to handle alphanumeric input, not listed in nsKeycodes:
|
||||
// most likely, more letters will be getting typed in than things in
|
||||
@ -205,16 +205,14 @@ QtKeyCodeToDOMKeyCode(int aKeysym)
|
||||
|
||||
#ifdef SOLARIS
|
||||
// map Sun Keyboard special keysyms
|
||||
length = sizeof(nsSunKeycodes) / sizeof(struct nsKeyConverter);
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsSunKeycodes); i++) {
|
||||
if (nsSunKeycodes[i].keysym == aKeysym)
|
||||
return(nsSunKeycodes[i].vkCode);
|
||||
}
|
||||
#endif
|
||||
|
||||
// misc other things
|
||||
length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter);
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsKeycodes); i++) {
|
||||
if (nsKeycodes[i].keysym == aKeysym)
|
||||
return(nsKeycodes[i].vkCode);
|
||||
}
|
||||
@ -229,7 +227,7 @@ QtKeyCodeToDOMKeyCode(int aKeysym)
|
||||
int
|
||||
DOMKeyCodeToQtKeyCode(int aKeysym)
|
||||
{
|
||||
int i, length = 0;
|
||||
unsigned int i;
|
||||
|
||||
// First, try to handle alphanumeric input, not listed in nsKeycodes:
|
||||
// most likely, more letters will be getting typed in than things in
|
||||
@ -252,8 +250,7 @@ DOMKeyCodeToQtKeyCode(int aKeysym)
|
||||
}
|
||||
|
||||
// misc other things
|
||||
length = NS_ARRAY_LENGTH(nsKeycodes);
|
||||
for (i = 0; i < length; ++i) {
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsKeycodes); ++i) {
|
||||
if (nsKeycodes[i].vkCode == aKeysym) {
|
||||
return nsKeycodes[i].keysym;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user