diff src/xs_fileinfo.c @ 239:7833df935239

Added xs_pnstrcat() to ease forming of limited size strings.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 21 Dec 2004 15:03:05 +0000
parents 6f9764fbd693
children 0d2d379a83c0
line wrap: on
line diff
--- a/src/xs_fileinfo.c	Tue Dec 21 13:44:03 2004 +0000
+++ b/src/xs_fileinfo.c	Tue Dec 21 15:03:05 2004 +0000
@@ -156,7 +156,7 @@
  GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
  t_xs_tuneinfo *tmpInfo;
  t_xs_stil_subnode *tmpNode;
- gchar tmpStr[32], *tmpS;
+ gchar tmpStr[64];
  gint n;
 
  /* Current implementation leaves old fileinfo window untouched if
@@ -217,20 +217,21 @@
  /* Other menu items */
  for (n = 1; n <= tmpInfo->nsubTunes; n++)
 	{
+	
 	if (xs_fileinfostil)
 		{
+		snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: ", n);
 		tmpNode = &xs_fileinfostil->subTune[n];
 		if (tmpNode->pName)
-			tmpS = tmpNode->pName;
+			xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName);
 			else
 		if (tmpNode->pInfo)
-			tmpS = tmpNode->pInfo;
+			xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo);
 			else
-			tmpS = "---";
-
-		snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: %s", n, tmpS);
-		} else
+			xs_pnstrcat(tmpStr, sizeof(tmpStr), "---");
+		} else {
 		snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n);
+		}
 
 	tmpMenuItem = gtk_menu_item_new_with_label(tmpStr);
 	gtk_widget_show (tmpMenuItem);