changeset 36991:fa8b6892b0bf

Cosmetic: Rename cut functions. Rename cutItem() cutStr(), cutItemString() cutString() and cutItemToInt() cutInt().
author ib
date Thu, 27 Mar 2014 09:44:01 +0000
parents 89c6bf8bea6b
children c2dcedfe36de
files gui/skin/font.c gui/skin/skin.c gui/util/string.c gui/util/string.h
diffstat 4 files changed, 68 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/gui/skin/font.c	Thu Mar 27 09:28:47 2014 +0000
+++ b/gui/skin/font.c	Thu Mar 27 09:44:01 2014 +0000
@@ -133,8 +133,8 @@
             continue;
 
         n = (strncmp(buf, "\"=", 2) == 0 ? 1 : 0);
-        cutItem(buf, item, '=', n);
-        cutItem(buf, param, '=', n + 1);
+        cutStr(buf, item, '=', n);
+        cutStr(buf, param, '=', n + 1);
 
         if (item[0] == '"') {
             if (!item[1])
@@ -142,7 +142,7 @@
             else if (item[1] == '"')
                 item[1] = 0;
             else
-                cutItem(item, item, '"', 1);
+                cutStr(item, item, '"', 1);
 
             if (item[0] & 0x80) {
                 for (i = 0; i < EXTRA_CHRS; i++) {
@@ -159,16 +159,16 @@
             } else
                 i = item[0];
 
-            cutItem(param, buf, ',', 0);
+            cutStr(param, buf, ',', 0);
             Fonts[id]->Fnt[i].x = atoi(buf);
 
-            cutItem(param, buf, ',', 1);
+            cutStr(param, buf, ',', 1);
             Fonts[id]->Fnt[i].y = atoi(buf);
 
-            cutItem(param, buf, ',', 2);
+            cutStr(param, buf, ',', 2);
             Fonts[id]->Fnt[i].w = atoi(buf);
 
-            cutItem(param, buf, ',', 3);
+            cutStr(param, buf, ',', 3);
             Fonts[id]->Fnt[i].h = atoi(buf);
 
             mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[font]  char: '%s' params: %d,%d %dx%d\n", item, Fonts[id]->Fnt[i].x, Fonts[id]->Fnt[i].y, Fonts[id]->Fnt[i].w, Fonts[id]->Fnt[i].h);
--- a/gui/skin/skin.c	Thu Mar 27 09:28:47 2014 +0000
+++ b/gui/skin/skin.c	Thu Mar 27 09:44:01 2014 +0000
@@ -315,11 +315,11 @@
     is_bar   = (strcmp(currWinName, "playbar") == 0);
     is_menu  = (strcmp(currWinName, "menu") == 0);
 
-    cutItem(in, fname, ',', 0);
-    x = cutItemToInt(in, ',', 1);
-    y = cutItemToInt(in, ',', 2);
-    w = cutItemToInt(in, ',', 3);
-    h = cutItemToInt(in, ',', 4);
+    cutStr(in, fname, ',', 0);
+    x = cutInt(in, ',', 1);
+    y = cutInt(in, ',', 2);
+    w = cutInt(in, ',', 3);
+    h = cutInt(in, ',', 4);
 
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    image: %s", fname);
 
@@ -397,9 +397,9 @@
     if (in_window("menu"))
         return 1;
 
-    currWin->R = cutItemToInt(in, ',', 0);
-    currWin->G = cutItemToInt(in, ',', 1);
-    currWin->B = cutItemToInt(in, ',', 2);
+    currWin->R = cutInt(in, ',', 0);
+    currWin->G = cutInt(in, ',', 1);
+    currWin->B = cutInt(in, ',', 2);
 
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    background color: #%02x%02x%02x\n", currWin->R, currWin->G, currWin->B);
 
@@ -431,12 +431,12 @@
     if (in_window("menu"))
         return 1;
 
-    cutItem(in, fname, ',', 0);
-    x = cutItemToInt(in, ',', 1);
-    y = cutItemToInt(in, ',', 2);
-    w = cutItemToInt(in, ',', 3);
-    h = cutItemToInt(in, ',', 4);
-    cutItem(in, msg, ',', 5);
+    cutStr(in, fname, ',', 0);
+    x = cutInt(in, ',', 1);
+    y = cutInt(in, ',', 2);
+    w = cutInt(in, ',', 3);
+    h = cutInt(in, ',', 4);
+    cutStr(in, msg, ',', 5);
 
     message = appFindMessage(msg);
 
@@ -551,11 +551,11 @@
     if (in_window("playbar"))
         return 1;
 
-    x = cutItemToInt(in, ',', 0);
-    y = cutItemToInt(in, ',', 1);
-    w = cutItemToInt(in, ',', 2);
-    h = cutItemToInt(in, ',', 3);
-    cutItem(in, msg, ',', 4);
+    x = cutInt(in, ',', 0);
+    y = cutInt(in, ',', 1);
+    w = cutInt(in, ',', 2);
+    h = cutInt(in, ',', 3);
+    cutStr(in, msg, ',', 4);
 
     message = appFindMessage(msg);
 
@@ -612,17 +612,17 @@
     if (in_window("menu"))
         return 1;
 
-    cutItem(in, pfname, ',', 0);
-    pwidth  = cutItemToInt(in, ',', 1);
-    pheight = cutItemToInt(in, ',', 2);
-    cutItem(in, phfname, ',', 3);
-    ph = cutItemToInt(in, ',', 4);
-    d  = cutItemToInt(in, ',', 5);
-    x  = cutItemToInt(in, ',', 6);
-    y  = cutItemToInt(in, ',', 7);
-    w  = cutItemToInt(in, ',', 8);
-    h  = cutItemToInt(in, ',', 9);
-    cutItem(in, buf, ',', 10);
+    cutStr(in, pfname, ',', 0);
+    pwidth  = cutInt(in, ',', 1);
+    pheight = cutInt(in, ',', 2);
+    cutStr(in, phfname, ',', 3);
+    ph = cutInt(in, ',', 4);
+    d  = cutInt(in, ',', 5);
+    x  = cutInt(in, ',', 6);
+    y  = cutInt(in, ',', 7);
+    w  = cutInt(in, ',', 8);
+    h  = cutInt(in, ',', 9);
+    cutStr(in, buf, ',', 10);
 
     message = appFindMessage(buf);
 
@@ -754,14 +754,14 @@
     if (in_window("menu"))
         return 1;
 
-    cutItem(in, phfname, ',', 0);
-    ph = cutItemToInt(in, ',', 1);
-    d  = cutItemToInt(in, ',', 2);
-    x  = cutItemToInt(in, ',', 3);
-    y  = cutItemToInt(in, ',', 4);
-    w  = cutItemToInt(in, ',', 5);
-    h  = cutItemToInt(in, ',', 6);
-    cutItem(in, buf, ',', 7);
+    cutStr(in, phfname, ',', 0);
+    ph = cutInt(in, ',', 1);
+    d  = cutInt(in, ',', 2);
+    x  = cutInt(in, ',', 3);
+    y  = cutInt(in, ',', 4);
+    w  = cutInt(in, ',', 5);
+    h  = cutInt(in, ',', 6);
+    cutStr(in, buf, ',', 7);
 
     message = appFindMessage(buf);
 
@@ -827,8 +827,8 @@
     if (in_window("menu"))
         return 1;
 
-    cutItem(in, fnt, ',', 0);   // Note: This seems needless but isn't for compatibility
-                                // reasons with a meanwhile deprecated second parameter.
+    cutStr(in, fnt, ',', 0);   // Note: This seems needless but isn't for compatibility
+                               // reasons with a meanwhile deprecated second parameter.
     // legacy
     skin_legacy("fontid", in);
 
@@ -879,11 +879,11 @@
     if (in_window("menu"))
         return 1;
 
-    x = cutItemToInt(in, ',', 0);
-    y = cutItemToInt(in, ',', 1);
-    cutItem(in, fnt, ',', 2);
-    cutItem(in, txt, ',', 3);
-    cutItem(txt, txt, '"', 1);
+    x = cutInt(in, ',', 0);
+    y = cutInt(in, ',', 1);
+    cutStr(in, fnt, ',', 2);
+    cutStr(in, txt, ',', 3);
+    cutStr(txt, txt, '"', 1);
 
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    slabel: \"%s\"\n", txt);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     pos: %d,%d\n", x, y);
@@ -942,13 +942,13 @@
     if (in_window("menu"))
         return 1;
 
-    x = cutItemToInt(in, ',', 0);
-    y = cutItemToInt(in, ',', 1);
-    w = cutItemToInt(in, ',', 2);
-    a = cutItemToInt(in, ',', 3);
-    cutItem(in, fnt, ',', 4);
-    cutItem(in, txt, ',', 5);
-    cutItem(txt, txt, '"', 1);
+    x = cutInt(in, ',', 0);
+    y = cutInt(in, ',', 1);
+    w = cutInt(in, ',', 2);
+    a = cutInt(in, ',', 3);
+    cutStr(in, fnt, ',', 4);
+    cutStr(in, txt, ',', 5);
+    cutStr(txt, txt, '"', 1);
 
     // legacy
     skin_legacy("$l", txt);
@@ -1147,8 +1147,8 @@
         if (!*line)
             continue;
 
-        cutItem(line, item, '=', 0);
-        cutItem(line, param, '=', 1);
+        cutStr(line, item, '=', 0);
+        cutStr(line, param, '=', 1);
         strlower(item);
 
         for (i = 0; i < FF_ARRAY_ELEMS(skinItem); i++) {
--- a/gui/util/string.c	Thu Mar 27 09:28:47 2014 +0000
+++ b/gui/util/string.c	Thu Mar 27 09:44:01 2014 +0000
@@ -177,7 +177,7 @@
  * @param num number of separator characters to be skipped before extraction starts
  * @param maxout maximum length of extracted part (including the trailing null byte)
  */
-void cutItemString(char *in, char *out, char sep, int num, size_t maxout)
+void cutString(char *in, char *out, char sep, int num, size_t maxout)
 {
     int n;
     unsigned int i, c;
@@ -204,11 +204,11 @@
  *
  * @return extracted number (numeric part)
  */
-int cutItemToInt(char *in, char sep, int num)
+int cutInt(char *in, char sep, int num)
 {
     char tmp[64];
 
-    cutItem(in, tmp, sep, num);
+    cutStr(in, tmp, sep, num);
 
     return atoi(tmp);
 }
--- a/gui/util/string.h	Thu Mar 27 09:28:47 2014 +0000
+++ b/gui/util/string.h	Thu Mar 27 09:44:01 2014 +0000
@@ -23,14 +23,14 @@
 #include <stdio.h>
 
 /**
- * @brief Wraps #cutItemString():
+ * @brief Wraps #cutString():
  *        Extract a part of a string delimited by a separator character
  *        at most the size of @a out.
  */
-#define cutItem(in, out, sep, num) cutItemString(in, out, sep, num, sizeof(out))
+#define cutStr(in, out, sep, num) cutString(in, out, sep, num, sizeof(out))
 
-void cutItemString(char *in, char *out, char sep, int num, size_t maxout);
-int cutItemToInt(char *in, char sep, int num);
+int cutInt(char *in, char sep, int num);
+void cutString(char *in, char *out, char sep, int num, size_t maxout);
 char *decomment(char *in);
 char *fgetstr(char *str, int size, FILE *file);
 char *gstrchr(const char *str, int c);