Followup fix to ArrayLength stuff for bug 693469 -- ISO C++98 forbids templates declaring on local types. Boo-urns! r=red

--HG--
extra : rebase_source : f0e398168239c0be1274079e8260ff363198beee
This commit is contained in:
Jeff Walden 2011-10-12 11:42:55 -07:00
Родитель 1ff5b31dd3
Коммит b4993b8d3e
1 изменённых файлов: 20 добавлений и 20 удалений

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

@ -63,6 +63,26 @@ nsSystemInfo::~nsSystemInfo()
{ {
} }
// CPU-specific information.
static const struct {
const char *name;
bool (*propfun)(void);
} cpuPropItems[] = {
// x86-specific bits.
{ "hasMMX", mozilla::supports_mmx },
{ "hasSSE", mozilla::supports_sse },
{ "hasSSE2", mozilla::supports_sse2 },
{ "hasSSE3", mozilla::supports_sse3 },
{ "hasSSSE3", mozilla::supports_ssse3 },
{ "hasSSE4A", mozilla::supports_sse4a },
{ "hasSSE4_1", mozilla::supports_sse4_1 },
{ "hasSSE4_2", mozilla::supports_sse4_2 },
// ARM-specific bits.
{ "hasEDSP", mozilla::supports_edsp },
{ "hasARMv6", mozilla::supports_armv6 },
{ "hasNEON", mozilla::supports_neon }
};
nsresult nsresult
nsSystemInfo::Init() nsSystemInfo::Init()
{ {
@ -98,26 +118,6 @@ nsSystemInfo::Init()
SetInt32Property(NS_LITERAL_STRING("cpucount"), PR_GetNumberOfProcessors()); SetInt32Property(NS_LITERAL_STRING("cpucount"), PR_GetNumberOfProcessors());
SetUint64Property(NS_LITERAL_STRING("memsize"), PR_GetPhysicalMemorySize()); SetUint64Property(NS_LITERAL_STRING("memsize"), PR_GetPhysicalMemorySize());
// CPU-specific information.
static const struct {
const char *name;
bool (*propfun)(void);
} cpuPropItems[] = {
// x86-specific bits.
{ "hasMMX", mozilla::supports_mmx },
{ "hasSSE", mozilla::supports_sse },
{ "hasSSE2", mozilla::supports_sse2 },
{ "hasSSE3", mozilla::supports_sse3 },
{ "hasSSSE3", mozilla::supports_ssse3 },
{ "hasSSE4A", mozilla::supports_sse4a },
{ "hasSSE4_1", mozilla::supports_sse4_1 },
{ "hasSSE4_2", mozilla::supports_sse4_2 },
// ARM-specific bits.
{ "hasEDSP", mozilla::supports_edsp },
{ "hasARMv6", mozilla::supports_armv6 },
{ "hasNEON", mozilla::supports_neon }
};
for (PRUint32 i = 0; i < ArrayLength(cpuPropItems); i++) { for (PRUint32 i = 0; i < ArrayLength(cpuPropItems); i++) {
rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16(cpuPropItems[i].name), rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16(cpuPropItems[i].name),
cpuPropItems[i].propfun()); cpuPropItems[i].propfun());