activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r908993 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp
Date Thu, 11 Feb 2010 14:29:34 GMT
Author: tabish
Date: Thu Feb 11 14:29:33 2010
New Revision: 908993

URL: http://svn.apache.org/viewvc?rev=908993&view=rev
Log:
Fix an error reported by Valgrind.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp?rev=908993&r1=908992&r2=908993&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp Thu Feb 11
14:29:33 2010
@@ -385,62 +385,62 @@
             } else {
 
                 switch( nextChar ) {
-                case '#':
-                case '!':
-                    if( firstChar ) {
-                        while( true ) {
-                            intVal = bis.read();
-                            if( intVal == -1 ) {
-                                break;
+                    case '#':
+                    case '!':
+                        if( firstChar ) {
+                            while( true ) {
+                                intVal = bis.read();
+                                if( intVal == -1 ) {
+                                    break;
+                                }
+
+                                nextChar = (char)( intVal & 0xFF );
+
+                                if( nextChar == '\r' || nextChar == '\n' ) {
+                                    break;
+                                }
                             }
+                            continue;
+                        }
+                        break;
+                    case '\n':
+                        if( mode == CONTINUE) { // Part of a \r\n sequence
+                            mode = IGNORE; // Ignore whitespace on the next line
+                            continue;
+                        }
+                        // fall into the next case
+                    case '\r':
+                        mode = NONE;
+                        firstChar = true;
+                        if( offset > 0 || ( offset == 0 && keyLength == 0 ) )
{
 
-                            nextChar = (char)( intVal & 0xFF );
-
-                            if( nextChar == '\r' || nextChar == '\n' ) {
-                                break;
+                            if( keyLength == -1 ) {
+                                keyLength = offset;
                             }
+                            std::string temp( buf.begin(), buf.begin() + offset );
+
+                            this->internal->properties.put( temp.substr( 0, keyLength
),
+                                                            temp.substr( keyLength ) );
                         }
-                        continue;
-                    }
-                    break;
-                case '\n':
-                    if( mode == CONTINUE) { // Part of a \r\n sequence
-                        mode = IGNORE; // Ignore whitespace on the next line
-                        continue;
-                    }
-                    // fall into the next case
-                case '\r':
-                    mode = NONE;
-                    firstChar = true;
-                    if( offset > 0 || ( offset == 0 && keyLength == 0 ) ) {
 
-                        if( keyLength == -1 ) {
+                        keyLength = -1;
+                        offset = 0;
+                        buf.clear();
+                        continue;
+                    case '\\':
+                        if( mode == KEY_DONE ) {
                             keyLength = offset;
                         }
-                        std::string temp( &buf[0], 0, offset );
-
-                        this->internal->properties.put( temp.substr( 0, keyLength ),
-                                                        temp.substr( keyLength ) );
-                    }
-
-                    keyLength = -1;
-                    offset = 0;
-                    buf.clear();
-                    continue;
-                case '\\':
-                    if( mode == KEY_DONE ) {
-                        keyLength = offset;
-                    }
-                    mode = SLASH;
-                    continue;
-                case ':':
-                case '=':
-                    if( keyLength == -1 ) { // if parsing the key
-                        mode = NONE;
-                        keyLength = offset;
+                        mode = SLASH;
                         continue;
-                    }
-                    break;
+                    case ':':
+                    case '=':
+                        if( keyLength == -1 ) { // if parsing the key
+                            mode = NONE;
+                            keyLength = offset;
+                            continue;
+                        }
+                        break;
                 }
                 if( Character::isWhitespace( nextChar ) ) {
                     if( mode == CONTINUE ) {
@@ -476,7 +476,7 @@
         }
 
         if( keyLength >= 0 ) {
-            std::string temp( &buf[0], 0, offset );
+            std::string temp( buf.begin(), buf.begin() + offset );
             this->internal->properties.put( temp.substr( 0, keyLength ), temp.substr(
keyLength ) );
         }
     }



Mime
View raw message