diff src/util.c @ 59:e612b263934f noffle

[svn] Changed some variable types and used some casts to avoid compiler warnings about signedness. In general, int should be used for parameters for allowing a signedness assertion in the function.
author enz
date Fri, 12 May 2000 17:52:41 +0100
parents 125d79c9e586
children bf8c97460fd7
line wrap: on
line diff
--- a/src/util.c	Fri May 12 17:52:07 2000 +0100
+++ b/src/util.c	Fri May 12 17:52:41 2000 +0100
@@ -1,7 +1,7 @@
 /*
   util.c
 
-  $Id: util.c 60 2000-05-09 22:28:38Z uh1763 $
+  $Id: util.c 65 2000-05-12 16:52:41Z enz $
 */
 
 #if HAVE_CONFIG_H
@@ -195,12 +195,12 @@
 }
 
 void
-Utl_cpyStrN( Str dst, const char *src, size_t n )
+Utl_cpyStrN( Str dst, const char *src, int n )
 {
     if ( n > MAXCHAR )
     	n = MAXCHAR;
     dst[ 0 ] = '\0';
-    strncat( dst, src, n );
+    strncat( dst, src, (size_t)n );
 }
 
 void
@@ -210,11 +210,15 @@
 }
 
 void
-Utl_catStrN( Str dst, const char *src, size_t n )
+Utl_catStrN( Str dst, const char *src, int n )
 {
-    if ( n > MAXCHAR - strlen( dst ) )
-    	n = MAXCHAR - strlen( dst );
-    strncat( dst, src, n );
+    size_t un;
+
+    ASSERT( n >= 0 );
+    un = (size_t)n;
+    if ( un > MAXCHAR - strlen( dst ) )
+    	 un = MAXCHAR - strlen( dst );
+    strncat( dst, src, un );
 }
 
 void