[MPlayer-cvslog] r33135 - in trunk: Makefile gui/skin/font.c gui/skin/skin.c gui/skin/skin.h gui/util/string.c gui/util/string.h
ib
subversion at mplayerhq.hu
Mon Mar 28 17:51:20 CEST 2011
Author: ib
Date: Mon Mar 28 17:51:20 2011
New Revision: 33135
Log:
Move auxiliary string functions into separate file.
(Besides, name parameters more intelligibly.)
Added:
trunk/gui/util/string.c
trunk/gui/util/string.h
Modified:
trunk/Makefile
trunk/gui/skin/font.c
trunk/gui/skin/skin.c
trunk/gui/skin/skin.h
Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile Mon Mar 28 15:46:50 2011 (r33134)
+++ trunk/Makefile Mon Mar 28 17:51:20 2011 (r33135)
@@ -541,6 +541,7 @@ SRCS_MPLAYER-$(GUI_GTK) += gui/app.
gui/skin/font.c \
gui/skin/skin.c \
gui/util/cut.c \
+ gui/util/string.c \
gui/wm/ws.c \
gui/wm/wsxdnd.c \
Modified: trunk/gui/skin/font.c
==============================================================================
--- trunk/gui/skin/font.c Mon Mar 28 15:46:50 2011 (r33134)
+++ trunk/gui/skin/font.c Mon Mar 28 17:51:20 2011 (r33135)
@@ -24,6 +24,7 @@
#include "font.h"
#include "gui/interface.h"
#include "gui/util/cut.h"
+#include "gui/util/string.h"
#include "skin.h"
#include "libavutil/avstring.h"
Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c Mon Mar 28 15:46:50 2011 (r33134)
+++ trunk/gui/skin/skin.c Mon Mar 28 17:51:20 2011 (r33135)
@@ -25,6 +25,7 @@
#include "gui/interface.h"
#include "gui/mplayer/widgets.h"
#include "gui/util/cut.h"
+#include "gui/util/string.h"
#include "config.h"
#include "help_mp.h"
@@ -818,43 +819,6 @@ static _item skinItem[] = {
{ "menu", cmd_menu }
};
-char *strswap(char *in, char what, char whereof)
-{
- int i;
-
- if (!*in)
- return NULL;
-
- for (i = 0; in[i]; i++)
- if (in[i] == what)
- in[i] = whereof;
-
- return in;
-}
-
-char *trim(char *in)
-{
- int c = 0, id = 0, i;
-
- if (!*in)
- return NULL;
-
- while (c != (int)strlen(in)) {
- if (in[c] == '"')
- id = !id;
-
- if ((in[c] == ' ') && (!id)) {
- for (i = 0; i < (int)strlen(in) - c; i++)
- in[c + i] = in[c + i + 1];
- continue;
- }
-
- c++;
- }
-
- return in;
-}
-
static char *setname(char *item1, char *item2)
{
static char fn[512];
Modified: trunk/gui/skin/skin.h
==============================================================================
--- trunk/gui/skin/skin.h Mon Mar 28 15:46:50 2011 (r33134)
+++ trunk/gui/skin/skin.h Mon Mar 28 17:51:20 2011 (r33135)
@@ -23,7 +23,5 @@
int skinBPRead(char *fname, txSample *bf);
int skinRead(char *dname);
-char *strswap(char *in, char what, char whereof);
-char *trim(char *in);
#endif /* MPLAYER_GUI_SKIN_H */
Added: trunk/gui/util/string.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/gui/util/string.c Mon Mar 28 17:51:20 2011 (r33135)
@@ -0,0 +1,59 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stddef.h>
+#include <string.h>
+
+#include "string.h"
+
+char *strswap(char *in, char from, char to)
+{
+ int i;
+
+ if (!*in)
+ return NULL;
+
+ for (i = 0; in[i]; i++)
+ if (in[i] == from)
+ in[i] = to;
+
+ return in;
+}
+
+char *trim(char *in)
+{
+ int c = 0, id = 0, i;
+
+ if (!*in)
+ return NULL;
+
+ while (c != (int)strlen(in)) {
+ if (in[c] == '"')
+ id = !id;
+
+ if ((in[c] == ' ') && (!id)) {
+ for (i = 0; i < (int)strlen(in) - c; i++)
+ in[c + i] = in[c + i + 1];
+ continue;
+ }
+
+ c++;
+ }
+
+ return in;
+}
Added: trunk/gui/util/string.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/gui/util/string.h Mon Mar 28 17:51:20 2011 (r33135)
@@ -0,0 +1,25 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_GUI_STRING_H
+#define MPLAYER_GUI_STRING_H
+
+char *strswap(char *in, char from, char to);
+char *trim(char *in);
+
+#endif /* MPLAYER_GUI_STRING_H */
More information about the MPlayer-cvslog
mailing list