Fix compiler warnings for generated CalendarPicker.cpp with VC++
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 08:52:32 +0000 (08:52 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 08:52:32 +0000 (08:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83672

Reviewed by Kentaro Hara.

* make-file-arrays.py:
(main): Do not generate literal integers larger than 127 for
members of char arrays. Use '\xHH' instead.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113838 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/make-file-arrays.py

index e094011..00e1bd0 100644 (file)
@@ -1,3 +1,14 @@
+2012-04-11  Kent Tamura  <tkent@chromium.org>
+
+        Fix compiler warnings for generated CalendarPicker.cpp with VC++
+        https://bugs.webkit.org/show_bug.cgi?id=83672
+
+        Reviewed by Kentaro Hara.
+
+        * make-file-arrays.py:
+        (main): Do not generate literal integers larger than 127 for
+        members of char arrays. Use '\xHH' instead.
+
 2012-04-11  Pavel Feldman  <pfeldman@chromium.org>
 
         Web Inspector: fix category -> type refactoring implications.
index 49dd5dd..99b4dbe 100755 (executable)
@@ -78,7 +78,11 @@ def main():
         header_file.write("extern const char %s[%d];\n" % (variable_name, size))
         cpp_file.write("const char %s[%d] = {\n" % (variable_name, size))
         for index in range(size):
-            cpp_file.write("%d" % ord(content[index]))
+            char_code = ord(content[index])
+            if char_code < 128:
+                cpp_file.write("%d" % char_code)
+            else:
+                cpp_file.write("'\\x%02x'" % char_code)
             cpp_file.write("," if index != len(content) - 1 else "};\n")
             if index % 20 == 19:
                 cpp_file.write("\n")