seoeunbi / rapidjson

Automatically exported from code.google.com/p/rapidjson
MIT License
0 stars 0 forks source link

GCC 4.7.2-5 doesn't like implicit conversion of unsigned to signed types #93

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
To make rapidjson compile cleanly with our warning flags, I had to make this 
trivial change:
Index: include/rapidjson/writer.h
===================================================================
--- include/rapidjson/writer.h  (revision 131)
+++ include/rapidjson/writer.h  (working copy)
@@ -129,7 +129,7 @@ class Writer {
                char buffer[10];
                char *p = buffer;
                do {
-                       *p++ = (u % 10) + '0';
+                       *p++ = char((u % 10) + '0');
                        u /= 10;
                } while (u > 0);

@@ -151,7 +151,7 @@ class Writer {
                char buffer[20];
                char *p = buffer;
                do {
-                       *p++ = char(u64 % 10) + '0';
+                       *p++ = char(char(u64 % 10) + '0');
                        u64 /= 10;
                } while (u64 > 0);

Original issue reported on code.google.com by oleg.kis...@gmail.com on 28 Oct 2013 at 5:00

GoogleCodeExporter commented 8 years ago
May I know what is your warning flags settings?
After some efforts, the master branch at https://github.com/miloyip/rapidjson 
can be compiled with -Wall -Wextra -Weffc++ -Wswitch-default
Can you verify it in your environment?
Thank you.

Original comment by milo...@gmail.com on 13 Jul 2014 at 4:42