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:26:40 UTC

Typos in transcoder.cpp and ndc.cpp

Jira LOGCXX-402 and −403

ndc.cpp does not compile. Don’t know how that got into a release. XCode’s static analyzer found the bug in transcoder.cpp.n (One & not &&).
 
diff --git a/src/main/cpp/ndc.cpp b/src/main/cpp/ndc.cpp
index 4ab612d..89788c1 100644
--- a/src/main/cpp/ndc.cpp
+++ b/src/main/cpp/ndc.cpp
@@ -309,7 +309,7 @@ bool NDC::pop(CFStringRef& dst)
         Stack& stack = data->getStack();
         if(!stack.empty())
         {
-                dst = Transcoder::encode(stack.top().message);
+                dst = Transcoder::encode(getMessage(stack.top()));
                 stack.pop();
                 data->recycle();
                 return true;
@@ -326,7 +326,7 @@ bool NDC::peek(CFStringRef& dst)
         Stack& stack = data->getStack();
         if(!stack.empty())
         {
-                dst = Transcoder::encode(stack.top().message);
+                dst = Transcoder::encode(getMessage(stack.top()));
                 return true;
         }
         data->recycle();

diff --git a/src/main/cpp/transcoder.cpp b/src/main/cpp/transcoder.cpp
index 2b4801c..1ebe7cb 100644
--- a/src/main/cpp/transcoder.cpp
+++ b/src/main/cpp/transcoder.cpp
@@ -356,7 +356,7 @@ static void encodeUTF16(unsigned int sv, String& dst) {
         unsigned char u = (unsigned char) (sv >> 16);
         unsigned char w = (unsigned char) (u - 1);
         unsigned short hs = (0xD800 + ((w & 0xF) << 6) + ((sv & 0xFFFF) >> 10));
-        unsigned short ls = (0xDC00 + (sv && 0x3FF));
+        unsigned short ls = (0xDC00 + (sv & 0x3FF));
         dst.append(1, hs);
         dst.append(1, ls);
     }