lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master f9ce1cb 1/2: Don't assume size_t is unsigned


From: Greg Chicares
Subject: [lmi-commits] [lmi] master f9ce1cb 1/2: Don't assume size_t is unsigned long
Date: Sun, 24 Mar 2019 15:48:35 -0400 (EDT)

branch: master
commit f9ce1cbbb3d90380ad3a01f85bc551bfea76f162
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Don't assume size_t is unsigned long
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2019-03/msg00035.html
---
 pdf_command_wx.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pdf_command_wx.cpp b/pdf_command_wx.cpp
index c90f493..e138acc 100644
--- a/pdf_command_wx.cpp
+++ b/pdf_command_wx.cpp
@@ -51,7 +51,7 @@
 #include <wx/html/m_templ.h>
 
 #include <array>
-#include <cstdint>                      // SIZE_MAX
+#include <cstdint>                      // ULONG_MAX
 #include <cstdlib>                      // strtoul()
 #include <exception>                    // uncaught_exceptions()
 #include <fstream>
@@ -272,10 +272,10 @@ class html_interpolator
             auto const index = std::strtoul(s.c_str() + open_pos + 1, &stop, 
10);
 
             // Conversion must have stopped at the closing bracket character
-            // and also check for overflow (notice that index == SIZE_MAX
+            // and also check for overflow (notice that index == ULONG_MAX
             // doesn't, in theory, need to indicate overflow, but in practice
             // we're never going to have valid indices close to this number).
-            if(stop != s.c_str() + s.length() - 1 || SIZE_MAX <= index)
+            if(stop != s.c_str() + s.length() - 1 || ULONG_MAX == index)
                 {
                 throw std::runtime_error
                     ("Index of vector variable '" + s + "' is not a valid 
number"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]