From 28643e60a9dbb5fd16e32270058f5c09f921238c Mon Sep 17 00:00:00 2001 From: "pchen%netscape.com" Date: Fri, 2 Nov 2001 02:55:56 +0000 Subject: [PATCH] 81762, r=jag, sr=sfraser, remove uses of PL_strlen with testing for null and non-empty string, also change const char* to static const char[] so that we can use sizeof-1 instead of PL_strlen git-svn-id: svn://10.0.0.236/trunk@107047 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpfe/appshell/src/nsCommandLineServiceMac.cpp | 10 +++++----- .../components/startup/src/nsCommandLineServiceMac.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mozilla/xpfe/appshell/src/nsCommandLineServiceMac.cpp b/mozilla/xpfe/appshell/src/nsCommandLineServiceMac.cpp index 14dc8b8e7b0..65af7245e2e 100644 --- a/mozilla/xpfe/appshell/src/nsCommandLineServiceMac.cpp +++ b/mozilla/xpfe/appshell/src/nsCommandLineServiceMac.cpp @@ -227,27 +227,27 @@ OSErr nsMacCommandLine::HandleOpenOneDoc(const FSSpec& inFileSpec, OSType inFile Boolean foundArgs = false; Boolean foundEnv = false; char chars[1024]; - const char* kCommandLinePrefix = "ARGS:"; - const char* kEnvVarLinePrefix = "ENV:"; + static const char kCommandLinePrefix[] = "ARGS:"; + static const char kEnvVarLinePrefix[] = "ENV:"; s.readline(chars, sizeof(chars)); do { // See if there are any command line or environment var settings if (PL_strstr(chars, kCommandLinePrefix) == chars) { - (void)AddToCommandLine(chars + PL_strlen(kCommandLinePrefix)); + (void)AddToCommandLine(chars + sizeof(kCommandLinePrefix) - 1); foundArgs = true; } else if (PL_strstr(chars, kEnvVarLinePrefix) == chars) { - (void)AddToEnvironmentVars(chars + PL_strlen(kEnvVarLinePrefix)); + (void)AddToEnvironmentVars(chars + sizeof(kEnvVarLinePrefix) - 1); foundEnv = true; } // Clear the buffer and get the next line from the command line file chars[0] = '\0'; s.readline(chars, sizeof(chars)); - } while (PL_strlen(chars)); + } while (chars && (chars[0] != '\0')); // If we found any environment vars we need to re-init NSPR's logging // so that it knows what the new vars are diff --git a/mozilla/xpfe/components/startup/src/nsCommandLineServiceMac.cpp b/mozilla/xpfe/components/startup/src/nsCommandLineServiceMac.cpp index 14dc8b8e7b0..65af7245e2e 100644 --- a/mozilla/xpfe/components/startup/src/nsCommandLineServiceMac.cpp +++ b/mozilla/xpfe/components/startup/src/nsCommandLineServiceMac.cpp @@ -227,27 +227,27 @@ OSErr nsMacCommandLine::HandleOpenOneDoc(const FSSpec& inFileSpec, OSType inFile Boolean foundArgs = false; Boolean foundEnv = false; char chars[1024]; - const char* kCommandLinePrefix = "ARGS:"; - const char* kEnvVarLinePrefix = "ENV:"; + static const char kCommandLinePrefix[] = "ARGS:"; + static const char kEnvVarLinePrefix[] = "ENV:"; s.readline(chars, sizeof(chars)); do { // See if there are any command line or environment var settings if (PL_strstr(chars, kCommandLinePrefix) == chars) { - (void)AddToCommandLine(chars + PL_strlen(kCommandLinePrefix)); + (void)AddToCommandLine(chars + sizeof(kCommandLinePrefix) - 1); foundArgs = true; } else if (PL_strstr(chars, kEnvVarLinePrefix) == chars) { - (void)AddToEnvironmentVars(chars + PL_strlen(kEnvVarLinePrefix)); + (void)AddToEnvironmentVars(chars + sizeof(kEnvVarLinePrefix) - 1); foundEnv = true; } // Clear the buffer and get the next line from the command line file chars[0] = '\0'; s.readline(chars, sizeof(chars)); - } while (PL_strlen(chars)); + } while (chars && (chars[0] != '\0')); // If we found any environment vars we need to re-init NSPR's logging // so that it knows what the new vars are