summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortschoening <tschoening@13f79535-47bb-0310-9956-ffa450edef68>2016-07-02 10:36:18 +0000
committertschoening <tschoening@13f79535-47bb-0310-9956-ffa450edef68>2016-07-02 10:36:18 +0000
commit37c21231bf363ebd513764f4a00b99fafea32b37 (patch)
tree28081949c2bc498ceaee34302e9496e979f3b1e1
parentde6d75655c509f7125c58ac09ff2e9e4bb528736 (diff)
downloadlog4cxx-37c21231bf363ebd513764f4a00b99fafea32b37.tar.gz
LOGCXX-482: I never liked the static_cast<char>-approach and so changed to what the bug author provided and is inline with the following comment, which has already been mentione din LOGCXX-400.
http://stackoverflow.com/questions/28094263/create-array-of-chars-avoiding-narrowing?rq=1#comment44564938_28094263 git-svn-id: http://svn.apache.org/repos/asf/incubator/log4cxx/trunk@1751049 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/changes/changes.xml1
-rw-r--r--src/main/cpp/locationinfo.cpp9
-rw-r--r--src/main/cpp/loggingevent.cpp108
-rw-r--r--src/main/cpp/objectoutputstream.cpp12
4 files changed, 65 insertions, 65 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6747f75..6025577 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -93,6 +93,7 @@
<action issue="LOGCXX-443" type="fix">Return by const reference in Logger::getName()</action>
<action issue="LOGCXX-446" type="fix">make install fails, trying to overwrite header files</action>
<action issue="LOGCXX-464" type="fix">TimeBasedRollingPolicy should append as configured on rollover</action>
+ <action issue="LOGCXX-482" type="fix">Build failure with GCC-6</action>
<action type="update">Behavior of StringHelper::startsWith and endsWith synced</action>
<action type="update">Documented C (class) and M (method) log format keywords.</action>
diff --git a/src/main/cpp/locationinfo.cpp b/src/main/cpp/locationinfo.cpp
index ff401c2..a848c95 100644
--- a/src/main/cpp/locationinfo.cpp
+++ b/src/main/cpp/locationinfo.cpp
@@ -152,14 +152,13 @@ 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, 0x2E, 0x4C, 0x6F,
- 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, static_cast<char>(0xED),
- static_cast<char>(0x99), static_cast<char>(0xBB), static_cast<char>(0xE1),
- 0x4A, static_cast<char>(0x91), static_cast<char>(0xA5), 0x7C, 0x02,
+ 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, 0xED, 0x99,
+ 0xBB, 0xE1, 0x4A, 0x91, 0xA5, 0x7C, 0x02,
0x00,
0x01, 0x4C,
0x00,
@@ -168,7 +167,7 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
0x12, 0x4C, 0x6A, 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 ".")
diff --git a/src/main/cpp/loggingevent.cpp b/src/main/cpp/loggingevent.cpp
index edbf40b..56140ad 100644
--- a/src/main/cpp/loggingevent.cpp
+++ b/src/main/cpp/loggingevent.cpp
@@ -236,63 +236,63 @@ void LoggingEvent::setProperty(const LogString& key, const LogString& value)
void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p) {
- char classDesc[] = {
- 0x72, 0x00, 0x21,
- 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63,
- 0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A,
- 0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F, 0x67,
- 0x67, 0x69, 0x6E, 0x67, 0x45, 0x76, 0x65, 0x6E,
- 0x74, static_cast<char>(0xF3), static_cast<char>(0xF2), static_cast<char>(0xB9), 0x23, 0x74, 0x0B, static_cast<char>(0xB5),
- 0x3F, 0x03, 0x00, 0x0A, 0x5A, 0x00, 0x15, 0x6D,
- 0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x4C, 0x6F,
- 0x6F, 0x6B, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75,
- 0x69, 0x72, 0x65, 0x64, 0x5A, 0x00, 0x11, 0x6E,
- 0x64, 0x63, 0x4C, 0x6F, 0x6F, 0x6B, 0x75, 0x70,
- 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64,
- 0x4A, 0x00, 0x09, 0x74, 0x69, 0x6D, 0x65, 0x53,
- 0x74, 0x61, 0x6D, 0x70, 0x4C, 0x00, 0x0C, 0x63,
- 0x61, 0x74, 0x65, 0x67, 0x6F, 0x72, 0x79, 0x4E,
- 0x61, 0x6D, 0x65, 0x74, 0x00, 0x12, 0x4C, 0x6A,
- 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
- 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
- 0x4C, 0x00, 0x0C, 0x6C, 0x6F, 0x63, 0x61, 0x74,
- 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, 0x74,
- 0x00, 0x23, 0x4C, 0x6F, 0x72, 0x67, 0x2F, 0x61,
- 0x70, 0x61, 0x63, 0x68, 0x65, 0x2F, 0x6C, 0x6F,
- 0x67, 0x34, 0x6A, 0x2F, 0x73, 0x70, 0x69, 0x2F,
- 0x4C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
- 0x49, 0x6E, 0x66, 0x6F, 0x3B, 0x4C, 0x00, 0x07,
- 0x6D, 0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x74,
- 0x00, 0x15, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F,
- 0x75, 0x74, 0x69, 0x6C, 0x2F, 0x48, 0x61, 0x73,
- 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x3B, 0x4C,
- 0x00, 0x03, 0x6E, 0x64, 0x63,
- 0x74, 0x00, 0x12, 0x4C, 0x6A,
- 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
+ unsigned char classDesc[] = {
+ 0x72, 0x00, 0x21,
+ 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63,
+ 0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A,
+ 0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F, 0x67,
+ 0x67, 0x69, 0x6E, 0x67, 0x45, 0x76, 0x65, 0x6E,
+ 0x74, 0xF3, 0xF2, 0xB9, 0x23, 0x74, 0x0B, 0xB5,
+ 0x3F, 0x03, 0x00, 0x0A, 0x5A, 0x00, 0x15, 0x6D,
+ 0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x4C, 0x6F,
+ 0x6F, 0x6B, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75,
+ 0x69, 0x72, 0x65, 0x64, 0x5A, 0x00, 0x11, 0x6E,
+ 0x64, 0x63, 0x4C, 0x6F, 0x6F, 0x6B, 0x75, 0x70,
+ 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64,
+ 0x4A, 0x00, 0x09, 0x74, 0x69, 0x6D, 0x65, 0x53,
+ 0x74, 0x61, 0x6D, 0x70, 0x4C, 0x00, 0x0C, 0x63,
+ 0x61, 0x74, 0x65, 0x67, 0x6F, 0x72, 0x79, 0x4E,
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61, 0x6D, 0x65,
- 0x74, 0x00, 0x12, 0x4C, 0x6A,
- 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
+ 0x4C, 0x00, 0x0F, 0x72, 0x65, 0x6E,
+ 0x64, 0x65, 0x72, 0x65, 0x64, 0x4D, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65,
+ 0x74, 0x00, 0x12, 0x4C, 0x6A,
+ 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
- 0x4C, 0x00, 0x0D, 0x74, 0x68,
- 0x72, 0x6F, 0x77, 0x61, 0x62, 0x6C, 0x65, 0x49,
- 0x6E, 0x66, 0x6F, 0x74, 0x00, 0x2B, 0x4C, 0x6F,
- 0x72, 0x67, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68,
- 0x65, 0x2F, 0x6C, 0x6F, 0x67, 0x34, 0x6A, 0x2F,
- 0x73, 0x70, 0x69, 0x2F, 0x54, 0x68, 0x72, 0x6F,
- 0x77, 0x61, 0x62, 0x6C, 0x65, 0x49, 0x6E, 0x66,
- 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E,
- 0x3B, 0x78, 0x70 };
-
- os.writeProlog("org.apache.log4j.spi.LoggingEvent",
- 8, classDesc, sizeof(classDesc), p);
+ 0x4C, 0x00, 0x0A, 0x74, 0x68, 0x72, 0x65,
+ 0x61, 0x64, 0x4E, 0x61, 0x6D, 0x65,
+ 0x74, 0x00, 0x12, 0x4C, 0x6A,
+ 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
+ 0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
+ 0x4C, 0x00, 0x0D, 0x74, 0x68,
+ 0x72, 0x6F, 0x77, 0x61, 0x62, 0x6C, 0x65, 0x49,
+ 0x6E, 0x66, 0x6F, 0x74, 0x00, 0x2B, 0x4C, 0x6F,
+ 0x72, 0x67, 0x2F, 0x61, 0x70, 0x61, 0x63, 0x68,
+ 0x65, 0x2F, 0x6C, 0x6F, 0x67, 0x34, 0x6A, 0x2F,
+ 0x73, 0x70, 0x69, 0x2F, 0x54, 0x68, 0x72, 0x6F,
+ 0x77, 0x61, 0x62, 0x6C, 0x65, 0x49, 0x6E, 0x66,
+ 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E,
+ 0x3B, 0x78, 0x70 };
+
+ os.writeProlog("org.apache.log4j.spi.LoggingEvent",
+ 8, (char*) classDesc, sizeof(classDesc), p);
}
void LoggingEvent::write(helpers::ObjectOutputStream& os, Pool& p) const {
diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
index f0caf3d..11c56c7 100644
--- a/src/main/cpp/objectoutputstream.cpp
+++ b/src/main/cpp/objectoutputstream.cpp
@@ -37,8 +37,8 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
objectHandle(objectHandleDefault),
classDescriptions(new ClassDescriptionMap())
{
- char start[] = { static_cast<char>(0xAC), static_cast<char>(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);
}
@@ -97,19 +97,19 @@ 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,
- static_cast<char>(0xBB), 0x0F, 0x25, 0x21, 0x4A, static_cast<char>(0xE4), static_cast<char>(0xB8), 0x03,
+ 0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03,
0x00, 0x02, 0x46, 0x00, 0x0A, 0x6C, 0x6F, 0x61,
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,
+ char data[] = { 0x3F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
TC_BLOCKDATA, 0x08, 0x00, 0x00, 0x00, 0x07 };
ByteBuffer dataBuf(data, sizeof(data));
os->write(dataBuf, p);