From 63c50e078a88601ed992b96a7c770388bff59d33 Mon Sep 17 00:00:00 2001 From: "jband%netscape.com" Date: Mon, 18 Oct 1999 23:45:39 +0000 Subject: [PATCH] checking in code to fix bug 12768 submitted by Dan.Oscarsson@trab.se. Needed a 'const char*' tmp varible to work with a 'const char*' buffer that was passed in. The same problem is in both js.c and xpcshell.cpp. r=jband --- js/src/js.c | 9 +++++---- js/src/xpconnect/shell/xpcshell.cpp | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/js/src/js.c b/js/src/js.c index 30f6eda30dba..08834537fc2e 100644 --- a/js/src/js.c +++ b/js/src/js.c @@ -1518,6 +1518,7 @@ my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) { int i, j, k, n; char *prefix = NULL, *tmp; + const char *ctmp; if (!report) { fprintf(gErrFile, "%s\n", message); @@ -1542,11 +1543,11 @@ my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) } /* embedded newlines -- argh! */ - while ((tmp = strchr(message, '\n')) != 0) { - tmp++; + while ((ctmp = strchr(message, '\n')) != 0) { + ctmp++; if (prefix) fputs(prefix, gErrFile); - fwrite(message, 1, tmp - message, gErrFile); - message = tmp; + fwrite(message, 1, ctmp - message, gErrFile); + message = ctmp; } /* If there were no filename or lineno, the prefix might be empty */ if (prefix) diff --git a/js/src/xpconnect/shell/xpcshell.cpp b/js/src/xpconnect/shell/xpcshell.cpp index 33143a8f5e60..97754ea94ab3 100644 --- a/js/src/xpconnect/shell/xpcshell.cpp +++ b/js/src/xpconnect/shell/xpcshell.cpp @@ -101,6 +101,7 @@ my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) { int i, j, k, n; char *prefix = NULL, *tmp; + const char *ctmp; if (!report) { fprintf(gErrFile, "%s\n", message); @@ -121,11 +122,11 @@ my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) } /* embedded newlines -- argh! */ - while ((tmp = strchr(message, '\n')) != 0) { - tmp++; + while ((ctmp = strchr(message, '\n')) != 0) { + ctmp++; if (prefix) fputs(prefix, gErrFile); - fwrite(message, 1, tmp - message, gErrFile); - message = tmp; + fwrite(message, 1, ctmp - message, gErrFile); + message = ctmp; } /* If there were no filename or lineno, the prefix might be empty */ if (prefix)