lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master e8dc749 4/5: Correct a printf problem


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e8dc749 4/5: Correct a printf problem
Date: Thu, 21 Jun 2018 18:35:41 -0400 (EDT)

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

    Correct a printf problem
    
    Octal '%o' expects an unsigned int argument.
---
 getopt.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/getopt.cpp b/getopt.cpp
index 1ddf48e..86ee462 100644
--- a/getopt.cpp
+++ b/getopt.cpp
@@ -267,7 +267,7 @@ GetOpt::print_expanding(char* v)
     if(x < 040)
       std::fprintf(stderr, "^%c", x + '@');
     else if(0177 < x)
-      std::fprintf(stderr, "\\%o", x);
+      std::fprintf(stderr, "\\%o", static_cast<unsigned int>(x));
     else
       std::fprintf(stderr, "%c", x);
 }
@@ -750,7 +750,7 @@ GetOpt::operator()()
                 list_option = nullptr;
 
                 std::fprintf(stderr, "%s: unrecognized option, character code 
0%o\n",
-                         nargv[0], c);
+                         nargv[0], static_cast<unsigned int>(c));
               }
             else
               {



reply via email to

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