Fix build error with GCC6 14/123314/1 accepted/tizen_4.0_unified accepted/tizen_unified tizen tizen_4.0 accepted/tizen/4.0/unified/20170816.020320 accepted/tizen/4.0/unified/20170828.222008 accepted/tizen/unified/20170405.174321 submit/tizen/20170405.075707 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170814.115522 submit/tizen_4.0/20170828.100008 submit/tizen_4.0_unified/20170814.115522 tizen_4.0.m1_release
authorDongkyun, Son <dongkyun.s@samsung.com>
Wed, 5 Apr 2017 05:16:50 +0000 (14:16 +0900)
committerDongkyun, Son <dongkyun.s@samsung.com>
Wed, 5 Apr 2017 07:38:31 +0000 (16:38 +0900)
This patch fixes the narrowing conversion errors.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=811768

Change-Id: I500a036f3b6a3101a11bd0145865c0f185a20e54
Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
src/main/cpp/locationinfo.cpp
src/main/cpp/loggingevent.cpp
src/main/cpp/objectoutputstream.cpp
src/test/cpp/xml/domtestcase.cpp

index e76ea29..1cdcf24 100644 (file)
@@ -148,7 +148,7 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
     if (lineNumber == -1 && fileName == NA && methodName == NA_METHOD) {
          os.writeNull(p);
     } else {
-        char prolog[] = {
+        unsigned char prolog[] = {
          0x72, 0x00, 0x21, 0x6F, 0x72, 0x67, 0x2E, 
          0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6C, 
          0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69, 
@@ -161,7 +161,7 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
                 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 
                 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
          0x78, 0x70 };
-      os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, prolog, sizeof(prolog), p);
+      os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, (char *)prolog, sizeof(prolog), p);
         char* line = p.itoa(lineNumber);
         //
         //   construct Java-like fullInfo (replace "::" with ".")
index 1c0d4be..bae1a1c 100644 (file)
@@ -236,7 +236,7 @@ void LoggingEvent::setProperty(const LogString& key, const LogString& value)
 
 
 void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p)  {
-     char classDesc[] = {
+     unsigned char classDesc[] = {
         0x72, 0x00, 0x21, 
         0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 
         0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A, 
@@ -292,7 +292,7 @@ void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p)  {
         0x3B, 0x78, 0x70 }; 
 
      os.writeProlog("org.apache.log4j.spi.LoggingEvent", 
-        8, classDesc, sizeof(classDesc), p);
+        8, (char *) classDesc, sizeof(classDesc), p);
 }
 
 void LoggingEvent::write(helpers::ObjectOutputStream& os, Pool& p) const {
index 7cd696b..83eede1 100644 (file)
@@ -36,8 +36,8 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
        objectHandle(0x7E0000),
        classDescriptions(new ClassDescriptionMap())
 {
-   char start[] = { 0xAC, 0xED, 0x00, 0x05 };
-   ByteBuffer buf(start, sizeof(start));
+   unsigned char start[] = { 0xAC, 0xED, 0x00, 0x05 };
+   ByteBuffer buf((char*)start, sizeof(start));
    os->write(buf, p);
 }
 
@@ -81,7 +81,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
     //
     //  TC_OBJECT and the classDesc for java.util.Hashtable
     //
-    char prolog[] = {
+    unsigned char prolog[] = {
         0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61, 
         0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61, 
         0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13, 
@@ -90,7 +90,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
         0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49, 
         0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 
         0x6F, 0x6C, 0x64, 0x78, 0x70  };
-    writeProlog("java.util.Hashtable", 1, prolog, sizeof(prolog), p);
+    writeProlog("java.util.Hashtable", 1, (char *) prolog, sizeof(prolog), p);
     //
     //   loadFactor = 0.75, threshold = 5, blockdata start, buckets.size = 7
     char data[] = { 0x3F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 
index a500628..29d67dd 100644 (file)
@@ -190,9 +190,9 @@ public:
                 DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase3.xml"));
                 LOG4CXX_INFO(logger, "File name is expected to end with a superscript 3");
 #if LOG4CXX_LOGCHAR_IS_UTF8
-                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xC2, 0xB3, 0 };
+                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xC2), static_cast<logchar>(0xB3), 0 };
 #else
-                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xB3, 0 };
+                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xB3), 0 };
 #endif
                 File file;
                 file.setPath(fname);
@@ -209,9 +209,9 @@ public:
                 DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase4.xml"));
                 LOG4CXX_INFO(logger, "File name is expected to end with an ideographic 4");
 #if LOG4CXX_LOGCHAR_IS_UTF8
-                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xE3, 0x86, 0x95, 0 };
+                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xE3), static_cast<logchar>(0x86), static_cast<logchar>(0x95), 0 };
 #else
-                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0x3195, 0 };
+                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0x3195), 0 };
 #endif
                 File file;
                 file.setPath(fname);