diff src/xs_length.c @ 241:291715a519e2

Compile-time setting to enable/disable use of dynamically allocated buffers.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 21 Dec 2004 15:05:03 +0000
parents 608f31f6c095
children cab5ec6127ee
line wrap: on
line diff
--- a/src/xs_length.c	Tue Dec 21 15:04:04 2004 +0000
+++ b/src/xs_length.c	Tue Dec 21 15:05:03 2004 +0000
@@ -116,7 +116,7 @@
 gint xs_sldb_read(t_xs_sldb *db, gchar *dbFilename)
 {
  FILE *inFile;
- gchar inLine[XS_BUFSIZE];
+ gchar inLine[XS_BUF_SIZE];
  guint lineNum, linePos;
  gboolean iOK;
  t_xs_sldb_node *tmpNode;
@@ -134,7 +134,8 @@
 
  while (!feof(inFile))
  {
- fgets(inLine, sizeof(inLine), inFile);
+ fgets(inLine, XS_BUF_SIZE, inFile);
+ inLine[XS_BUF_SIZE-1] = 0;
  lineNum++;
 
  /* Check if it is datafield */
@@ -424,7 +425,7 @@
  t_xs_md5state inState;
  t_xs_psidv1_header psidH;
  t_xs_psidv2_header psidH2;
-#ifdef XS_SIDBUF_DYNAMIC
+#ifdef XS_BUF_DYNAMIC
  guint8 *songData;
 #else
  guint8 songData[XS_SIDBUF_SIZE];
@@ -468,7 +469,7 @@
  	psidH2.reserved		= xs_rd_be16(inFile);
  	}
 
-#ifdef XS_SIDBUF_DYNAMIC
+#ifdef XS_BUF_DYNAMIC
  /* Allocate buffer */
  songData = (guint8 *) g_malloc(XS_SIDBUF_SIZE * sizeof(guint8));
  if (!songData)
@@ -494,7 +495,7 @@
 	}
 
 
-#ifdef XS_SIDBUF_DYNAMIC
+#ifdef XS_BUF_DYNAMIC
  /* Free buffer */
  g_free(songData);
 #endif