[LyX/master] Fix compiler warning -Wstring-plus-int

Scott Kostyshak skostysh at lyx.org
Thu Dec 29 02:01:33 UTC 2022


commit d44eaa9713d305fc9ac02fd521d0ac4cdfac7900
Author: Scott Kostyshak <skostysh at lyx.org>
Date:   Wed Dec 28 21:56:18 2022 -0500

    Fix compiler warning -Wstring-plus-int
    
    Warning was as follows:
    
      src/tex2lyx/Parser.cpp:898:39: error: adding 'uint32_t' (aka 'unsigned int') to a string does not append to the string [-Werror,-Wstring-plus-int]
                      warning_message("ignoring a char: " + static_cast<uint32_t>(c));
                                      ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
      src/tex2lyx/Parser.cpp:898:39: note: use array indexing to silence this warning
                      warning_message("ignoring a char: " + static_cast<uint32_t>(c));
                                                          ^
                                      &                   [                         ]
      1 error generated.
---
 src/tex2lyx/Parser.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/tex2lyx/Parser.cpp b/src/tex2lyx/Parser.cpp
index 499e31e..61619cb 100644
--- a/src/tex2lyx/Parser.cpp
+++ b/src/tex2lyx/Parser.cpp
@@ -895,7 +895,7 @@ void Parser::tokenize_one()
 	}
 
 	case catIgnore: {
-		warning_message("ignoring a char: " + static_cast<uint32_t>(c));
+		warning_message("ignoring a char: " + std::to_string(static_cast<uint32_t>(c)));
 		break;
 	}
 


More information about the lyx-cvs mailing list