You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ANDREW LAZARUS <dr...@me.com> on 2012/11/21 06:13:01 UTC

C++11 does not allow char literals with highest bit set unless cast

This is Jira 400.

C++11 has tighter rules on char literals with high bit set. The following patches appear to restore compliance.

diff --git a/src/main/cpp/locationinfo.cpp b/src/main/cpp/locationinfo.cpp
index e76ea29..1daa3a5 100644
--- a/src/main/cpp/locationinfo.cpp
+++ b/src/main/cpp/locationinfo.cpp
@@ -153,8 +153,8 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
          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, 0xED, 0x99, 0xBB, 
-         0xE1, 0x4A, 0x91, 0xA5, 0x7C, 0x02, 0x00, 0x01, 
+         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, 0x00, 0x01, 
          0x4C, 0x00, 0x08, 0x66, 0x75, 0x6C, 0x6C, 0x49, 
          0x6E, 0x66, 0x6F, 
             0x74, 0x00, 0x12, 0x4C, 0x6A, 
diff --git a/src/main/cpp/loggingevent.cpp b/src/main/cpp/loggingevent.cpp
index 1c0d4be..edbf40b 100644
--- a/src/main/cpp/loggingevent.cpp
+++ b/src/main/cpp/loggingevent.cpp
@@ -242,7 +242,7 @@ void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p)  {
         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, 
+        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, 




Fwd: C++11 does not allow char literals with highest bit set unless cast

Posted by Christian Grobmeier <gr...@apache.org>.
Hi Andrew,

I applied all your changes and added you to the contributors section
of the pom file.
Usually we all are developing against the trunk (aka tip, in git language).

Also it would be great if you could send in an ICLA.
And (sorry) in future it would be good to have smaller patch files
that I we can have one commit per Jira. It will be matched by Fisheye
and should help to keep track on changes.

But hey - thank you for your work. Hopefully we see some more patches
from you in near future :-)

Cheers
Christian

On Fri, Nov 23, 2012 at 5:01 AM, ANDREW LAZARUS <dr...@me.com> wrote:
> No problem at all. I don’t speak either svn or git very well. I’ll modify a JIRA, and you should get the update notice.
> I do wonder, these patches are against the last official release, not the svn tip.
>
> I deleted from the diff some files that seem to be either part of the XCode build or have to do with where the files are on my drives.
>
> On Nov 22, 2012, at 01:18, Christian Grobmeier <gr...@apache.org> wrote:
>
>> Hi Andrew,
>>
>> just wanted to start with patching log4cxx with your code, but git
>> tells me the patches are somehow corrupt or do not apply.
>> I am not the big git guru, but maybe the mail servers have done
>> something nasty with the patch. Do you mind attaching the original
>> patch file to JIRA?
>>
>> If thats not possible I will fork the log4cxx git mirror to github and
>> accept your requests from there.
>>
>> Thanks!
>>
>> Cheers
>> Christian
>>
>> 2012/11/21 ANDREW LAZARUS <dr...@me.com>:
>>> Two more cases
>>>
>>> diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
>>> index 7cd696b..9567a85 100644
>>> --- a/src/main/cpp/objectoutputstream.cpp
>>> +++ b/src/main/cpp/objectoutputstream.cpp
>>> @@ -36,7 +36,7 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
>>>        objectHandle(0x7E0000),
>>>        classDescriptions(new ClassDescriptionMap())
>>> {
>>> -   char start[] = { 0xAC, 0xED, 0x00, 0x05 };
>>> +   char start[] = { static_cast<char>(0xAC), static_cast<char>(0xED), 0x00, 0x05 };
>>>    ByteBuffer buf(start, sizeof(start));
>>>    os->write(buf, p);
>>> }
>>> @@ -85,7 +85,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
>>>         0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
>>>         0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
>>>         0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
>>> -        0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03,
>>> +        static_cast<char>(0xBB), 0x0F, 0x25, 0x21, 0x4A, static_cast<char>(0xE4), static_cast<char>(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,
>>>
>>>
>



--
http://www.grobmeier.de
https://www.timeandbill.de

Re: C++11 does not allow char literals with highest bit set unless cast

Posted by ANDREW LAZARUS <dr...@me.com>.
No problem at all. I don’t speak either svn or git very well. I’ll modify a JIRA, and you should get the update notice.
I do wonder, these patches are against the last official release, not the svn tip.

I deleted from the diff some files that seem to be either part of the XCode build or have to do with where the files are on my drives.

On Nov 22, 2012, at 01:18, Christian Grobmeier <gr...@apache.org> wrote:

> Hi Andrew,
> 
> just wanted to start with patching log4cxx with your code, but git
> tells me the patches are somehow corrupt or do not apply.
> I am not the big git guru, but maybe the mail servers have done
> something nasty with the patch. Do you mind attaching the original
> patch file to JIRA?
> 
> If thats not possible I will fork the log4cxx git mirror to github and
> accept your requests from there.
> 
> Thanks!
> 
> Cheers
> Christian
> 
> 2012/11/21 ANDREW LAZARUS <dr...@me.com>:
>> Two more cases
>> 
>> diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
>> index 7cd696b..9567a85 100644
>> --- a/src/main/cpp/objectoutputstream.cpp
>> +++ b/src/main/cpp/objectoutputstream.cpp
>> @@ -36,7 +36,7 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
>>        objectHandle(0x7E0000),
>>        classDescriptions(new ClassDescriptionMap())
>> {
>> -   char start[] = { 0xAC, 0xED, 0x00, 0x05 };
>> +   char start[] = { static_cast<char>(0xAC), static_cast<char>(0xED), 0x00, 0x05 };
>>    ByteBuffer buf(start, sizeof(start));
>>    os->write(buf, p);
>> }
>> @@ -85,7 +85,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
>>         0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
>>         0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
>>         0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
>> -        0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03,
>> +        static_cast<char>(0xBB), 0x0F, 0x25, 0x21, 0x4A, static_cast<char>(0xE4), static_cast<char>(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,
>> 
>> 


Re: C++11 does not allow char literals with highest bit set unless cast

Posted by Christian Grobmeier <gr...@apache.org>.
Hi Andrew,

just wanted to start with patching log4cxx with your code, but git
tells me the patches are somehow corrupt or do not apply.
I am not the big git guru, but maybe the mail servers have done
something nasty with the patch. Do you mind attaching the original
patch file to JIRA?

If thats not possible I will fork the log4cxx git mirror to github and
accept your requests from there.

Thanks!

Cheers
Christian

2012/11/21 ANDREW LAZARUS <dr...@me.com>:
> Two more cases
>
> diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
> index 7cd696b..9567a85 100644
> --- a/src/main/cpp/objectoutputstream.cpp
> +++ b/src/main/cpp/objectoutputstream.cpp
> @@ -36,7 +36,7 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
>         objectHandle(0x7E0000),
>         classDescriptions(new ClassDescriptionMap())
>  {
> -   char start[] = { 0xAC, 0xED, 0x00, 0x05 };
> +   char start[] = { static_cast<char>(0xAC), static_cast<char>(0xED), 0x00, 0x05 };
>     ByteBuffer buf(start, sizeof(start));
>     os->write(buf, p);
>  }
> @@ -85,7 +85,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
>          0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
>          0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
>          0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
> -        0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03,
> +        static_cast<char>(0xBB), 0x0F, 0x25, 0x21, 0x4A, static_cast<char>(0xE4), static_cast<char>(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,
>
>

Re: C++11 does not allow char literals with highest bit set unless cast

Posted by ANDREW LAZARUS <dr...@me.com>.
Two more cases

diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
index 7cd696b..9567a85 100644
--- a/src/main/cpp/objectoutputstream.cpp
+++ b/src/main/cpp/objectoutputstream.cpp
@@ -36,7 +36,7 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
        objectHandle(0x7E0000),
        classDescriptions(new ClassDescriptionMap())
 {
-   char start[] = { 0xAC, 0xED, 0x00, 0x05 };
+   char start[] = { static_cast<char>(0xAC), static_cast<char>(0xED), 0x00, 0x05 };
    ByteBuffer buf(start, sizeof(start));
    os->write(buf, p);
 }
@@ -85,7 +85,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
         0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61, 
         0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61, 
         0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13, 
-        0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03, 
+        static_cast<char>(0xBB), 0x0F, 0x25, 0x21, 0x4A, static_cast<char>(0xE4), static_cast<char>(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,