]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Windows: Fix symbol collisions (#1385)
authorAmos Jeffries <yadij@users.noreply.github.com>
Sat, 6 Jan 2024 21:51:16 +0000 (21:51 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 7 Jan 2024 03:07:53 +0000 (03:07 +0000)
'near' is a macro defined by the Windows API.
We cannot use it for anything.

src/errorpage.cc
src/errorpage.h

index 5dd96beaf5e374d48573ce189963e1b02c421fde..a56998dd7264724cdd93f000c24672a495f2c7f9 100644 (file)
@@ -114,7 +114,12 @@ public:
 class BuildErrorPrinter
 {
 public:
-    BuildErrorPrinter(const SBuf &anInputLocation, int aPage, const char *aMsg, const char *aNear): inputLocation(anInputLocation), page_id(aPage), msg(aMsg), near(aNear) {}
+    BuildErrorPrinter(const SBuf &anInputLocation, int aPage, const char *aMsg, const char *anErrorLocation):
+        inputLocation(anInputLocation),
+        page_id(aPage),
+        msg(aMsg),
+        errorLocation(anErrorLocation)
+    {}
 
     /// reports error details (for admin-visible exceptions and debugging)
     std::ostream &print(std::ostream &) const;
@@ -126,7 +131,7 @@ public:
     const SBuf &inputLocation;
     const int page_id;
     const char *msg;
-    const char *near;
+    const char *errorLocation;
 };
 
 static inline std::ostream &
@@ -1431,13 +1436,13 @@ ErrorState::compile(const char *input, bool building_deny_info_url, bool allowRe
 
 /// react to a compile() error
 /// \param msg  description of what went wrong
-/// \param near  approximate start of the problematic input
+/// \param errorLocation approximate start of the problematic input
 /// \param  forceBypass whether detection of this error was introduced late,
 /// after old configurations containing this error could have been
 /// successfully validated and deployed (i.e. the admin may not be
 /// able to fix this newly detected but old problem quickly)
 void
-ErrorState::noteBuildError_(const char *msg, const char *near, const bool forceBypass)
+ErrorState::noteBuildError_(const char *const msg, const char * const errorLocation, const bool forceBypass)
 {
     using ErrorPage::BuildErrorPrinter;
     const auto runtime = !starting_up;
@@ -1458,9 +1463,9 @@ ErrorState::noteBuildError_(const char *msg, const char *near, const bool forceB
         if (starting_up && seenErrors <= 10)
             debugs(4, debugLevel, "WARNING: The following configuration error will be fatal in future Squid versions");
 
-        debugs(4, debugLevel, "ERROR: " << BuildErrorPrinter(inputLocation, page_id, msg, near));
+        debugs(4, debugLevel, "ERROR: " << BuildErrorPrinter(inputLocation, page_id, msg, errorLocation));
     } else {
-        throw TexcHere(ToSBuf(BuildErrorPrinter(inputLocation, page_id, msg, near)));
+        throw TexcHere(ToSBuf(BuildErrorPrinter(inputLocation, page_id, msg, errorLocation)));
     }
 }
 
@@ -1486,11 +1491,11 @@ ErrorPage::BuildErrorPrinter::print(std::ostream &os) const {
 
     // TODO: Add support for prefix printing to Raw
     const size_t maxContextLength = 15; // plus "..."
-    if (strlen(near) > maxContextLength) {
-        os.write(near, maxContextLength);
+    if (strlen(errorLocation) > maxContextLength) {
+        os.write(errorLocation, maxContextLength);
         os << "...";
     } else {
-        os << near;
+        os << errorLocation;
     }
 
     // XXX: We should not be converting (inner) exception to text if we are
index 8eb295f8ffa81f7afa519c2a8826c67e433eb094..1f09b6eefbb353290167c3771c11be3552ac7ee2 100644 (file)
@@ -145,18 +145,18 @@ private:
 
     /// React to a compile() error, throwing if buildContext allows.
     /// \param msg description of what went wrong
-    /// \param near approximate start of the problematic input
-    void noteBuildError(const char *msg, const char *near) {
-        noteBuildError_(msg, near, false);
+    /// \param errorLocation approximate start of the problematic input
+    void noteBuildError(const char *const msg, const char * const errorLocation) {
+        noteBuildError_(msg, errorLocation, false);
     }
 
     /// Note a compile() error but do not throw for backwards
     /// compatibility with older configurations that may have such errors.
     /// Should eventually be replaced with noteBuildError().
     /// \param msg description of what went wrong
-    /// \param near approximate start of the problematic input
-    void bypassBuildErrorXXX(const char *msg, const char *near) {
-        noteBuildError_(msg, near, true);
+    /// \param errorLocation approximate start of the problematic input
+    void bypassBuildErrorXXX(const char *const msg, const char * const errorLocation) {
+        noteBuildError_(msg, errorLocation, true);
     }
 
     /**
@@ -207,7 +207,7 @@ public:
     HttpReplyPointer response_;
 
 private:
-    void noteBuildError_(const char *msg, const char *near, const bool forceBypass);
+    void noteBuildError_(const char *msg, const char *errorLocation, bool forceBypass);
 
     static const SBuf LogformatMagic; ///< marks each embedded logformat entry
 };