diff src/xs_title.c @ 359:b1a858b8cb1a

Re-indentation all (non-generated) code.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 07 Nov 2005 09:50:04 +0000
parents dd201740a720
children 1222cff759c6
line wrap: on
line diff
--- a/src/xs_title.c	Mon Nov 07 09:49:04 2005 +0000
+++ b/src/xs_title.c	Mon Nov 07 09:50:04 2005 +0000
@@ -43,124 +43,141 @@
 	}
 
 
-gchar *xs_make_titlestring(gchar *pcFilename,
-				gint iSubTune,
-				gint iSidModel,
-				const gchar *formatString, const gchar *infoString0,
-				const gchar *infoString1, const gchar *infoString2)
+gchar *xs_make_titlestring(gchar * pcFilename,
+			   gint iSubTune,
+			   gint iSidModel,
+			   const gchar * formatString, const gchar * infoString0,
+			   const gchar * infoString1, const gchar * infoString2)
 {
- gchar *tmpFilename, *tmpFilePath, *tmpFileExt, *pcStr, *pcResult,
- 	tmpStr[VBUFSIZE], tmpBuf[VBUFSIZE];
- gint iIndex;
+	gchar *tmpFilename, *tmpFilePath, *tmpFileExt, *pcStr, *pcResult, tmpStr[VBUFSIZE], tmpBuf[VBUFSIZE];
+	gint iIndex;
 #ifdef HAVE_XMMSEXTRA
- TitleInput *ptInput;
+	TitleInput *ptInput;
 #endif
 
- /* Split the filename into path */
- tmpFilePath = g_strdup(pcFilename);
- tmpFilename = xs_strrchr(tmpFilePath, '/');
- if (tmpFilename)
-	tmpFilename[1] = 0;
-		
- /* Filename */
- tmpFilename = xs_strrchr(pcFilename, '/');
- if (tmpFilename)
-	tmpFilename = g_strdup(tmpFilename + 1);
+	/* Split the filename into path */
+	tmpFilePath = g_strdup(pcFilename);
+	tmpFilename = xs_strrchr(tmpFilePath, '/');
+	if (tmpFilename)
+		tmpFilename[1] = 0;
+
+	/* Filename */
+	tmpFilename = xs_strrchr(pcFilename, '/');
+	if (tmpFilename)
+		tmpFilename = g_strdup(tmpFilename + 1);
 	else
-	tmpFilename = g_strdup(pcFilename);
+		tmpFilename = g_strdup(pcFilename);
 
- tmpFileExt = xs_strrchr(tmpFilename, '.');
- tmpFileExt[0] = 0;
+	tmpFileExt = xs_strrchr(tmpFilename, '.');
+	tmpFileExt[0] = 0;
 
- /* Extension */
- tmpFileExt = xs_strrchr(pcFilename, '.');
+	/* Extension */
+	tmpFileExt = xs_strrchr(pcFilename, '.');
 
 
 #ifdef HAVE_XMMSEXTRA
- /* Check if the titles are overridden or not */
- if (!xs_cfg.titleOverride)
-	{
-	/* Use generic XMMS titles */
-	/* XMMS_NEW_TITLEINPUT(ptInput);
-	 * We duplicate and add typecast to the code here due to XMMS's braindead headers
-	 */
-	ptInput = (TitleInput *) g_malloc0(sizeof(TitleInput));
-	ptInput->__size = XMMS_TITLEINPUT_SIZE;
-	ptInput->__version = XMMS_TITLEINPUT_VERSION;
+	/* Check if the titles are overridden or not */
+	if (!xs_cfg.titleOverride) {
+		/* Use generic XMMS titles */
+		/* XMMS_NEW_TITLEINPUT(ptInput);
+		 * We duplicate and add typecast to the code here due to XMMS's braindead headers
+		 */
+		ptInput = (TitleInput *) g_malloc0(sizeof(TitleInput));
+		ptInput->__size = XMMS_TITLEINPUT_SIZE;
+		ptInput->__version = XMMS_TITLEINPUT_VERSION;
 
-	/* Create the input fields */
-	ptInput->file_name	= tmpFilename;
-	ptInput->file_ext	= tmpFileExt;
-	ptInput->file_path	= tmpFilePath;
+		/* Create the input fields */
+		ptInput->file_name = tmpFilename;
+		ptInput->file_ext = tmpFileExt;
+		ptInput->file_path = tmpFilePath;
 
-	ptInput->track_name	= g_strdup(infoString0);
-	ptInput->track_number	= iSubTune;
-	ptInput->album_name	= NULL;
-	ptInput->performer	= g_strdup(infoString1);
-	ptInput->date		= g_strdup((iSidModel == XS_SIDMODEL_6581) ? "SID6581" : "SID8580");
+		ptInput->track_name = g_strdup(infoString0);
+		ptInput->track_number = iSubTune;
+		ptInput->album_name = NULL;
+		ptInput->performer = g_strdup(infoString1);
+		ptInput->date = g_strdup((iSidModel == XS_SIDMODEL_6581) ? "SID6581" : "SID8580");
 
-	ptInput->year		= 0;
-	ptInput->genre		= g_strdup("SID-tune");
-	ptInput->comment	= g_strdup(infoString2);
+		ptInput->year = 0;
+		ptInput->genre = g_strdup("SID-tune");
+		ptInput->comment = g_strdup(infoString2);
 
-	/* Create the string */
-	pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), ptInput);
+		/* Create the string */
+		pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), ptInput);
 
-	/* Dispose all allocated memory */
-	g_free(ptInput->track_name);
-	g_free(ptInput->performer);
-	g_free(ptInput->comment);
-	g_free(ptInput->date);
-	g_free(ptInput->genre);
-	g_free(ptInput);
-	}
-	else
+		/* Dispose all allocated memory */
+		g_free(ptInput->track_name);
+		g_free(ptInput->performer);
+		g_free(ptInput->comment);
+		g_free(ptInput->date);
+		g_free(ptInput->genre);
+		g_free(ptInput);
+	} else
 #endif
 	{
-	/* Create the string */
-	pcStr = xs_cfg.titleFormat;
-	iIndex = 0;
-	while (*pcStr && (iIndex < VBUFSIZE))
-	{
-	if (*pcStr == '%')
-		{
-		pcStr++;
-		switch (*pcStr) {
-		case '%': VPUTCH('%'); break;
-		case 'f': VPUTSTR(tmpFilename); break;
-		case 'F': VPUTSTR(tmpFilePath); break;
-		case 'e': VPUTSTR(tmpFileExt); break;
-		case 'p': VPUTSTR(infoString1); break;
-		case 't': VPUTSTR(infoString0); break;
-		case 'c': VPUTSTR(infoString2); break;
-		case 's': VPUTSTR(formatString); break;
-		case 'm':
-			switch (iSidModel) {
-			case XS_SIDMODEL_6581: VPUTSTR("SID6581"); break;
-			case XS_SIDMODEL_8580: VPUTSTR("SID8580"); break;
-			default: VPUTSTR("Unknown SID"); break;
+		/* Create the string */
+		pcStr = xs_cfg.titleFormat;
+		iIndex = 0;
+		while (*pcStr && (iIndex < VBUFSIZE)) {
+			if (*pcStr == '%') {
+				pcStr++;
+				switch (*pcStr) {
+				case '%':
+					VPUTCH('%');
+					break;
+				case 'f':
+					VPUTSTR(tmpFilename);
+					break;
+				case 'F':
+					VPUTSTR(tmpFilePath);
+					break;
+				case 'e':
+					VPUTSTR(tmpFileExt);
+					break;
+				case 'p':
+					VPUTSTR(infoString1);
+					break;
+				case 't':
+					VPUTSTR(infoString0);
+					break;
+				case 'c':
+					VPUTSTR(infoString2);
+					break;
+				case 's':
+					VPUTSTR(formatString);
+					break;
+				case 'm':
+					switch (iSidModel) {
+					case XS_SIDMODEL_6581:
+						VPUTSTR("SID6581");
+						break;
+					case XS_SIDMODEL_8580:
+						VPUTSTR("SID8580");
+						break;
+					default:
+						VPUTSTR("Unknown SID");
+						break;
+					}
+					break;
+				case 'n':
+					snprintf(tmpStr, VBUFSIZE, "%i", iSubTune);
+					VPUTSTR(tmpStr);
+					break;
+				}
+			} else {
+				VPUTCH(*pcStr);
 			}
-			break;
-		case 'n':
-			snprintf(tmpStr, VBUFSIZE, "%i", iSubTune);
-			VPUTSTR(tmpStr);
-			break;
+			pcStr++;
 		}
-		} else {
-		VPUTCH(*pcStr);
-		}
-	pcStr++;
+
+		tmpBuf[iIndex] = 0;
+
+		/* Make resulting string */
+		pcResult = g_strdup(tmpBuf);
 	}
 
-	tmpBuf[iIndex] = 0;
-
-	/* Make resulting string */
-	pcResult = g_strdup(tmpBuf);
-	}
+	/* Free temporary strings */
+	g_free(tmpFilename);
+	g_free(tmpFilePath);
 
- /* Free temporary strings */
- g_free(tmpFilename);
- g_free(tmpFilePath);
-	
- return pcResult;
+	return pcResult;
 }