[Opensrf-commits] r1497 - branches/rel_1_0/src/libopensrf

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Nov 16 22:19:45 EST 2008


Author: erickson
Date: 2008-11-16 22:19:43 -0500 (Sun, 16 Nov 2008)
New Revision: 1497

Modified:
   branches/rel_1_0/src/libopensrf/utils.c
Log:
backporting 1496, more cleanup

Modified: branches/rel_1_0/src/libopensrf/utils.c
===================================================================
--- branches/rel_1_0/src/libopensrf/utils.c	2008-11-17 03:17:50 UTC (rev 1496)
+++ branches/rel_1_0/src/libopensrf/utils.c	2008-11-17 03:19:43 UTC (rev 1497)
@@ -242,7 +242,7 @@
 			return -1;
 	}
 
-	strcat( gb->buf, data );
+	strcpy( gb->buf + gb->n_used, data );
 	gb->n_used = total_len;
 	return total_len;
 }
@@ -251,8 +251,9 @@
 int buffer_reset( growing_buffer *gb){
 	if( gb == NULL ) { return -1; }
 	if( gb->buf == NULL ) { return -1; }
-	osrf_clearbuf( gb->buf, sizeof(gb->buf) );
+	osrf_clearbuf( gb->buf, gb->size );
 	gb->n_used = 0;
+	gb->buf[ 0 ] = '\0';
 	return gb->n_used;
 }
 
@@ -322,6 +323,9 @@
 
 char* uescape( const char* string, int size, int full_escape ) {
 
+	if( NULL == string )
+		return NULL;
+	
 	growing_buffer* buf = buffer_init(size + 64);
 	int clen = 0;
 	int idx = 0;



More information about the opensrf-commits mailing list