You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/11/26 11:44:40 UTC

svn commit: r479333 - in /incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util: Exceptions.cpp Exceptions.h Logger.cpp Logger.h

Author: jsdelfino
Date: Sun Nov 26 02:44:39 2006
New Revision: 479333

URL: http://svn.apache.org/viewvc?view=rev&rev=479333
Log:
Fixed memory violations in Logging, use a bigger static buffer for log messages, and removed TuscanyRuntimeException::operator char which returned a pointer to data on the stack.

Modified:
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp?view=diff&rev=479333&r1=479332&r2=479333
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.cpp Sun Nov 26 02:44:39 2006
@@ -296,19 +296,5 @@
             return except.PrintSelf(os);
         } // end ostream operator <<
 
-        SCA_API TuscanyRuntimeException::operator std::string() const
-        {
-            ostringstream os;
-            os << *this;
-            return os.str();
-        }
-        
-        SCA_API TuscanyRuntimeException::operator const char*() const
-        {
-            ostringstream os;
-            os << *this;
-            return os.str().c_str();
-        }
-        
     } // End namespace sca
 } // End namespace tuscany

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h?view=diff&rev=479333&r1=479332&r2=479333
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Exceptions.h Sun Nov 26 02:44:39 2006
@@ -128,9 +128,6 @@
              */
             SCA_API friend std::ostream& operator<< (std::ostream &os, const TuscanyRuntimeException &except);
             
-            operator std::string() const;
-            operator const char*() const;
-
         protected:
             
         private:

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp?view=diff&rev=479333&r1=479332&r2=479333
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.cpp Sun Nov 26 02:44:39 2006
@@ -100,13 +100,14 @@
             }
         }
 
+        char Logger::messageBuffer[4096];
+        
         void Logger::logArgs(int level, const char* msg, ...)
         {
             if (level <= loggingLevel)
             {
                 va_list variableArguments;
                 va_start(variableArguments, msg);
-                char messageBuffer[1024];
                 vsprintf(messageBuffer, msg, variableArguments);
                 logWriter->log(level, pid, messageBuffer);
                 va_end(variableArguments);
@@ -119,7 +120,6 @@
             {
                 va_list variableArguments;
                 va_start(variableArguments, msg);
-                char messageBuffer[1024];
                 vsprintf(messageBuffer, msg, variableArguments);
                 logWriter->log(0, pid, messageBuffer);
                 va_end(variableArguments);
@@ -131,7 +131,6 @@
             {
                 va_list variableArguments;
                 va_start(variableArguments, msg);
-                char messageBuffer[1024];
                 vsprintf(messageBuffer, msg, variableArguments);
                 logWriter->log(1, pid, messageBuffer);
                 va_end(variableArguments);
@@ -143,7 +142,6 @@
             {
                 va_list variableArguments;
                 va_start(variableArguments, msg);
-                char messageBuffer[1024];
                 vsprintf(messageBuffer, msg, variableArguments);
                 logWriter->log(2, pid, messageBuffer);
                 va_end(variableArguments);

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h?view=diff&rev=479333&r1=479332&r2=479333
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/util/Logger.h Sun Nov 26 02:44:39 2006
@@ -92,6 +92,12 @@
              * Retrieves the logging level set as an environment variable.
              */
             static int setLogging();
+            
+            /**
+             * Message buffer
+             */
+            static char messageBuffer[4096];
+            
         };
         
         class LogEntry



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org