[MPlayer-cvslog] r37087 - in trunk/gui: skin/font.c skin/skin.c util/string.c util/string.h

ib subversion at mplayerhq.hu
Thu Mar 27 10:44:01 CET 2014


Author: ib
Date: Thu Mar 27 10:44:01 2014
New Revision: 37087

Log:
Cosmetic: Rename cut functions.

Rename cutItem() cutStr(),
cutItemString() cutString() and
cutItemToInt() cutInt().

Modified:
   trunk/gui/skin/font.c
   trunk/gui/skin/skin.c
   trunk/gui/util/string.c
   trunk/gui/util/string.h

Modified: trunk/gui/skin/font.c
==============================================================================
--- trunk/gui/skin/font.c	Thu Mar 27 10:28:47 2014	(r37086)
+++ trunk/gui/skin/font.c	Thu Mar 27 10:44:01 2014	(r37087)
@@ -133,8 +133,8 @@ int fntRead(char *path, char *fname)
             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 @@ int fntRead(char *path, char *fname)
             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 @@ int fntRead(char *path, char *fname)
             } 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);

Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c	Thu Mar 27 10:28:47 2014	(r37086)
+++ trunk/gui/skin/skin.c	Thu Mar 27 10:44:01 2014	(r37087)
@@ -315,11 +315,11 @@ static int item_base(char *in)
     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 @@ static int item_background(char *in)
     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 @@ static int item_button(char *in)
     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 @@ static int item_menu(char *in)
     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 @@ static int item_hpotmeter(char *in)
     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 @@ static int item_pimage(char *in)
     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 @@ static int item_font(char *in)
     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 @@ static int item_slabel(char *in)
     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 @@ static int item_dlabel(char *in)
     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 @@ int skinRead(char *sname)
         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++) {

Modified: trunk/gui/util/string.c
==============================================================================
--- trunk/gui/util/string.c	Thu Mar 27 10:28:47 2014	(r37086)
+++ trunk/gui/util/string.c	Thu Mar 27 10:44:01 2014	(r37087)
@@ -177,7 +177,7 @@ char *decomment(char *in)
  * @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 @@ void cutItemString(char *in, char *out, 
  *
  * @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);
 }

Modified: trunk/gui/util/string.h
==============================================================================
--- trunk/gui/util/string.h	Thu Mar 27 10:28:47 2014	(r37086)
+++ trunk/gui/util/string.h	Thu Mar 27 10:44:01 2014	(r37087)
@@ -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);


More information about the MPlayer-cvslog mailing list