lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 08e2d4c 03/16: Truncate sizeof(char*)


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 08e2d4c 03/16: Truncate sizeof(char*)
Date: Thu, 15 Nov 2018 17:37:03 -0500 (EST)

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

    Truncate sizeof(char*)
    
    This value is certainly representable as 'int'.
---
 getopt.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/getopt.cpp b/getopt.cpp
index f39ae09..d9307d9 100644
--- a/getopt.cpp
+++ b/getopt.cpp
@@ -197,7 +197,7 @@ GetOpt::Initialize(std::string const& a_optstring)
 void
 GetOpt::exchange(char** argv)
 {
-  int nonopts_size = (last_nonopt - first_nonopt) * sizeof(char*);
+  int nonopts_size = (last_nonopt - first_nonopt) * (int)sizeof(char*);
 // GWC substituted std::malloc() for alloca() and added call to std::free() 
below.
 //  char** temp = static_cast<char**>(alloca(nonopts_size));
   char** temp = static_cast<char**>(std::malloc(nonopts_size));



reply via email to

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