swebb2066 commented on code in PR #464:
URL: https://github.com/apache/logging-log4cxx/pull/464#discussion_r1931488146


##########
src/main/cpp/simpledateformat.cpp:
##########
@@ -599,38 +599,29 @@ class RFC822TimeZoneToken : public PatternToken
                        else
                        {
                                apr_int32_t off = tm.tm_gmtoff;
-                               size_t basePos = s.length();
-                               s.append( LOG4CXX_STR( "+0000" ) );
+                               s.reserve(s.length() + 5);
 
                                if ( off < 0 )
                                {
-                                       s[basePos] = 0x2D; // '-'
+                                       s.push_back( '-' );
                                        off = -off;
+                               }else{
+                                       s.push_back( '+' );
                                }
 
                                LogString hours;
                                StringHelper::toString( off / 3600, p, hours );
-                               size_t hourPos = basePos + 2;
-
-                               //
-                               //   assumes that point values for 0-9 are same 
between char and wchar_t
-                               //
-                               for ( size_t i = hours.length(); i-- > 0; )
-                               {
-                                       s[hourPos--] = hours[i];
+                               if( hours.size() == 1 ){
+                                       s.push_back( '0' );

Review Comment:
   Support LOG4CXX_CHAR=wchar_t



##########
src/main/cpp/simpledateformat.cpp:
##########
@@ -599,38 +599,29 @@ class RFC822TimeZoneToken : public PatternToken
                        else
                        {
                                apr_int32_t off = tm.tm_gmtoff;
-                               size_t basePos = s.length();
-                               s.append( LOG4CXX_STR( "+0000" ) );
+                               s.reserve(s.length() + 5);
 
                                if ( off < 0 )
                                {
-                                       s[basePos] = 0x2D; // '-'
+                                       s.push_back( '-' );
                                        off = -off;
+                               }else{
+                                       s.push_back( '+' );

Review Comment:
   Support LOG4CXX_CHAR=wchar_t



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to