changeset 4103:7b9d5718a6dc

strncpy() -> g_strlcpy()
author Jonathan Schleifer <js-audacious@webkeks.org>
date Mon, 24 Dec 2007 13:01:15 +0100
parents 10e7c823462d
children 7b01df6730eb
files src/audacious/formatter.c src/audacious/intl/localcharset.c src/audacious/intl/log.c src/audacious/intl/os2compat.c src/audacious/intl/relocatable.c src/audacious/tuple_compiler.c src/audacious/ui_equalizer.c src/libid3tag/field.c
diffstat 8 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/formatter.c	Fri Dec 21 18:39:46 2007 +0100
+++ b/src/audacious/formatter.c	Mon Dec 24 13:01:15 2007 +0100
@@ -126,7 +126,7 @@
     for (p = format, q = buffer; *p; p++)
         if (*p == '%') {
             if (formatter->values[(int) *++p]) {
-                strncpy(q, formatter->values[(int) *p], len - 1);
+                g_strlcpy(q, formatter->values[(int) *p], len - 1);
                 q += strlen(q);
             }
             else {
--- a/src/audacious/intl/localcharset.c	Fri Dec 21 18:39:46 2007 +0100
+++ b/src/audacious/intl/localcharset.c	Mon Dec 24 13:01:15 2007 +0100
@@ -186,8 +186,8 @@
 		  res_size = 0;
 		  break;
 		}
-	      strncpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1, res_size - (l2 + 1));
-	      strncpy (res_ptr + res_size - (l2 + 1), buf2, res_size - (l1 + 1));
+	      g_strlcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1, res_size - (l2 + 1));
+	      g_strlcpy (res_ptr + res_size - (l2 + 1), buf2, res_size - (l1 + 1));
 	    }
 	  fclose (fp);
 	  if (res_size == 0)
--- a/src/audacious/intl/log.c	Fri Dec 21 18:39:46 2007 +0100
+++ b/src/audacious/intl/log.c	Mon Dec 24 13:01:15 2007 +0100
@@ -81,7 +81,7 @@
       last_logfilename = (char *) malloc (strlen (logfilename) + 1);
       if (last_logfilename == NULL)
 	return;
-      strncpy (last_logfilename, logfilename, strlen(logfilename) + 1);
+      g_strlcpy (last_logfilename, logfilename, strlen(logfilename) + 1);
       last_logfile = fopen (logfilename, "a");
       if (last_logfile == NULL)
 	return;
--- a/src/audacious/intl/os2compat.c	Fri Dec 21 18:39:46 2007 +0100
+++ b/src/audacious/intl/os2compat.c	Mon Dec 24 13:01:15 2007 +0100
@@ -94,5 +94,5 @@
     }
 
   if (strlen (_nlos2_localedir) <= MAXPATHLEN)
-    strncpy (libintl_nl_default_dirname, _nlos2_localedir, MAXPATHLEN + 1);
+    g_strlcpy (libintl_nl_default_dirname, _nlos2_localedir, MAXPATHLEN + 1);
 }
--- a/src/audacious/intl/relocatable.c	Fri Dec 21 18:39:46 2007 +0100
+++ b/src/audacious/intl/relocatable.c	Mon Dec 24 13:01:15 2007 +0100
@@ -427,7 +427,7 @@
 #endif
 	    {
 	      memcpy (result, curr_prefix, curr_prefix_len);
-	      strncpy (result + curr_prefix_len, pathname_tail, strlen(pathname_tail) + 1);
+	      g_strlcpy (result + curr_prefix_len, pathname_tail, strlen(pathname_tail) + 1);
 	      return result;
 	    }
 	}
--- a/src/audacious/tuple_compiler.c	Fri Dec 21 18:39:46 2007 +0100
+++ b/src/audacious/tuple_compiler.c	Mon Dec 24 13:01:15 2007 +0100
@@ -805,7 +805,7 @@
         *resmax = *reslen + MIN_ALLOC_BUF;
         *res = g_malloc(*resmax);
         
-        strncpy(*res, str, *resmax);
+        g_strlcpy(*res, str, *resmax);
       }
     }
     
--- a/src/audacious/ui_equalizer.c	Fri Dec 21 18:39:46 2007 +0100
+++ b/src/audacious/ui_equalizer.c	Mon Dec 24 13:01:15 2007 +0100
@@ -1094,7 +1094,7 @@
     vfs_fwrite("Winamp EQ library file v1.1\x1a!--", 1, 31, file);
 
     memset(name, 0, 257);
-    strncpy(name, "Entry1", 257);
+    g_strlcpy(name, "Entry1", 257);
     vfs_fwrite(name, 1, 257, file);
 
     for (i = 0; i < 10; i++)
--- a/src/libid3tag/field.c	Fri Dec 21 18:39:46 2007 +0100
+++ b/src/libid3tag/field.c	Mon Dec 24 13:01:15 2007 +0100
@@ -78,11 +78,11 @@
     break;
 
   case ID3_FIELD_TYPE_LANGUAGE:
-    strncpy(field->immediate.value, "XXX", sizeof(field->immediate.value));
+    g_strlcpy(field->immediate.value, "XXX", sizeof(field->immediate.value));
     break;
 
   case ID3_FIELD_TYPE_FRAMEID:
-    strncpy(field->immediate.value, "XXXX", sizeof(field->immediate.value));
+    g_strlcpy(field->immediate.value, "XXXX", sizeof(field->immediate.value));
     break;
 
   case ID3_FIELD_TYPE_DATE:
@@ -671,7 +671,7 @@
     if (strlen(language) != 3)
       return -1;
 
-    strncpy(field->immediate.value, language, sizeof(field->immediate.value));
+    g_strlcpy(field->immediate.value, language, sizeof(field->immediate.value));
   }
 
   return 0;