Bug 693469 - Implement mozilla::ArrayLength and mozilla::ArrayEnd, and replace uses of NS_ARRAY_LENGTH whenever possible. (Exceptions: assigning to static initializers, use in static assertions, as template parameters, etc. These will go away when the relevant compilers have C++11 constexpr support.) r=cjones

This commit is contained in:
Jeff Walden
2011-10-10 22:50:08 -07:00
parent 8ce2dc6ecd
commit 7d613942b0
253 changed files with 1546 additions and 733 deletions

View File

@@ -34,6 +34,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "nsCOMPtr.h"
#include "nsGNOMEShellService.h"
#include "nsShellService.h"
@@ -68,6 +70,8 @@
#include <limits.h>
#include <stdlib.h>
using namespace mozilla;
struct ProtocolAssociation
{
const char *name;
@@ -239,7 +243,7 @@ nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck,
nsCAutoString handler;
nsCOMPtr<nsIGIOMimeApp> gioApp;
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (!appProtocols[i].essential)
continue;
@@ -295,7 +299,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
appKeyValue.AppendLiteral(" %s");
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (appProtocols[i].essential || aClaimAllTypes) {
gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
appKeyValue);
@@ -328,7 +332,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
NS_ENSURE_SUCCESS(rv, rv);
// set handler for the protocols
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (appProtocols[i].essential || aClaimAllTypes) {
appInfo->SetAsDefaultForURIScheme(nsDependentCString(appProtocols[i].name));
}
@@ -337,7 +341,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
// set handler for .html and xhtml files and MIME types:
if (aClaimAllTypes) {
// Add mime types for html, xhtml extension and set app to just created appinfo.
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
for (unsigned int i = 0; i < ArrayLength(appTypes); ++i) {
appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
}