OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_script.c versions 1.32 and 1.33
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_script.c 1.32 -> 1.33

--- rc_script.c  2003/06/26 18:45:14     1.32
+++ rc_script.c  2003/06/30 14:43:36     1.33
@@ -96,7 +96,7 @@
     assert(pDest && pSource); /* Parameters must be valid */
 
     /* Add 2 chars to ensure that a \0 precedes any strings */
-    nResize = strlen(*pDest) + strlen(*pSource) + sizeof (char) * 2;
+    nResize = strlen(*pDest) + strlen(*pSource) + sizeof (char);
     /* Don't trust realloc(3) in this case */
     if ((pvRealloc = calloc(1, (size_t)nResize)) == NULL)
         return(RC_THROW(RC_ERR_MEM));
@@ -114,11 +114,11 @@
     return(RC_THROW(RC_OK));
 }
 
-/****************************************************
-* scriptAppend(rc_script_t *, const char *, size_t) *
-* Append text to a script                           *
-****************************************************/
-rc_return_t scriptAppend(rc_script_t *pScript, const char *szInbuf, size_t Size)
+/*****************************************************
+* scriptnAppend(rc_script_t *, const char *, size_t) *
+* Append n characters of text to a script            *
+*****************************************************/
+rc_return_t scriptnAppend(rc_script_t *pScript, const char *szInbuf, size_t Size)
 {
     int nResize     = 0;
     void *pvRealloc = NULL;
@@ -133,7 +133,7 @@
         return(RC_THROW(RC_OK));
 
     /* Add 2 chars to ensure that a \0 precedes any strings */
-    nResize = strlen(*pScript) + Size + sizeof (char) * 2;
+    nResize = strlen(*pScript) + Size + sizeof (char);
     /* Don't trust realloc(3) in this case */
     if ((pvRealloc = calloc(1, (size_t)nResize)) == NULL)
         return(RC_THROW(RC_ERR_MEM));
@@ -141,7 +141,7 @@
     /* Coerce strings into one Script again */
     if (*pScript)
         strcpy(pvRealloc, *pScript);
-    strncat(pvRealloc, szInbuf, Size);
+    strncat(pvRealloc, szInbuf, Size + 1);
 
     /* Cleanup and deallocate memory */
     if (*pScript)
@@ -330,7 +330,7 @@
 
     /* Don't remove this! It encapsulates the script object, */
     /*                    which might not be a simple string */
-    return(*pScript);
+    return((const char *)*pScript);
 }
 
 /************************************************

CVSTrac 2.0.1