r3405 - trunk/libmutil/source

erik at minisip.org erik at minisip.org
Thu Aug 30 15:51:49 CEST 2007


Author: erik
Date: 2007-08-30 15:51:49 +0200 (Thu, 30 Aug 2007)
New Revision: 3405

Modified:
   trunk/libmutil/source/Exception.cxx
   trunk/libmutil/source/LibraryWin32.cxx
   trunk/libmutil/source/XMLParser.cxx
   trunk/libmutil/source/stringutils.cxx
Log:

 * itoa: silly bug in the W32 version that added spaces to the 
   resulting string
 * Exception: The copy constructor had a bug when not supporting 
   stack traces (true on W32)
 * libminisip assumes that the handle is NULL if a library could 
   not be loaded. This was not true for the W32 version.
 * Added an error check to the configuration file parser.


Modified: trunk/libmutil/source/Exception.cxx
===================================================================
--- trunk/libmutil/source/Exception.cxx	2007-08-30 13:29:59 UTC (rev 3404)
+++ trunk/libmutil/source/Exception.cxx	2007-08-30 13:51:49 UTC (rev 3405)
@@ -34,8 +34,13 @@
 		msg(e.msg), 
 		stackDepth(e.stackDepth)
 {
+#ifdef HAVE_EXECINFO_H
 	stack = new void*[MAX_STACK_TRACE_DEPTH];
 	memcpy(stack, e.stack, MAX_STACK_TRACE_DEPTH*sizeof(void*));
+#else
+	stack = NULL;
+	stackDepth = -1;
+#endif
 }
 
 /**

Modified: trunk/libmutil/source/LibraryWin32.cxx
===================================================================
--- trunk/libmutil/source/LibraryWin32.cxx	2007-08-30 13:29:59 UTC (rev 3404)
+++ trunk/libmutil/source/LibraryWin32.cxx	2007-08-30 13:51:49 UTC (rev 3405)
@@ -41,14 +41,18 @@
 	refCount++;
 	handle = new HMODULE;
 	*((HMODULE*)handle) = LoadLibrary( path.c_str() );
-
+	if ( (*((HMODULE*)handle))==NULL){
+		delete handle;
+		handle = NULL;
+	}	
 }
 
 Library::~Library(){
-	massert(handle);
-	BOOL ok = FreeLibrary( *((HMODULE*)handle) );
-	massert(ok);
-	handle = NULL;
+	if (handle){
+		BOOL ok = FreeLibrary( *((HMODULE*)handle) );
+		massert(ok);
+		handle = NULL;
+	}
 	refCount--;
 }
 

Modified: trunk/libmutil/source/XMLParser.cxx
===================================================================
--- trunk/libmutil/source/XMLParser.cxx	2007-08-30 13:29:59 UTC (rev 3404)
+++ trunk/libmutil/source/XMLParser.cxx	2007-08-30 13:51:49 UTC (rev 3405)
@@ -105,6 +105,8 @@
 		while (part[ii]!='['){
 			sindex= part[ii]+sindex;
 			ii--;
+			if (i==0)
+				throw XMLException("Parse error in key: Missing '['?");
 		}
 		part = part.substr(0,ii);
 		index = atoi(sindex.c_str());

Modified: trunk/libmutil/source/stringutils.cxx
===================================================================
--- trunk/libmutil/source/stringutils.cxx	2007-08-30 13:29:59 UTC (rev 3404)
+++ trunk/libmutil/source/stringutils.cxx	2007-08-30 13:51:49 UTC (rev 3405)
@@ -202,7 +202,7 @@
 	for (int j=0; j<16; j++)
 		buf[j]=0;
 #ifdef _MSC_VER
-	_snprintf_s( buf, 30, 29, "%11d", i);
+	_snprintf_s( buf, 30, 29, "%lld", i);
 #else
 	snprintf(buf, 30, "%lld",i);
 #endif



More information about the Minisip-devel mailing list