[MPlayer-cvslog] r34684 - in trunk/gui: cfg.c ui/widgets.c win32/wincfg.c
ib
subversion at mplayerhq.hu
Fri Feb 10 16:40:53 CET 2012
Author: ib
Date: Fri Feb 10 16:40:53 2012
New Revision: 34684
Log:
Prefer static const char arrays for string constants to #defines.
Modified:
trunk/gui/cfg.c
trunk/gui/ui/widgets.c
trunk/gui/win32/wincfg.c
Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c Fri Feb 10 16:24:27 2012 (r34683)
+++ trunk/gui/cfg.c Fri Feb 10 16:40:53 2012 (r34684)
@@ -44,11 +44,6 @@
#include "sub/font_load.h"
#include "sub/sub.h"
-#define GUI_CONFIGURATION "gui.conf"
-#define GUI_HISTORY "gui.history"
-#define GUI_PLAYLIST "gui.pl"
-#define GUI_URLLIST "gui.url"
-
m_config_t *gui_conf;
int gtkCacheOn;
@@ -103,6 +98,11 @@ char *skinName;
char *fsHistory[5];
+static const char gui_configuration[] = "gui.conf";
+static const char gui_history[] = "gui.history";
+static const char gui_playlist[] = "gui.pl";
+static const char gui_urllist[] = "gui.url";
+
static const m_option_t gui_opts[] = {
{ "cache", >kCacheOn, CONF_TYPE_FLAG, 0, 0, 1, NULL },
{ "cache_size", >kCacheSize, CONF_TYPE_INT, CONF_RANGE, 32, 1048576, NULL },
@@ -248,7 +248,7 @@ void cfg_read(void)
// configuration
- fname = get_path(GUI_CONFIGURATION);
+ fname = get_path(gui_configuration);
mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[cfg] file: %s\n", fname);
@@ -270,7 +270,7 @@ void cfg_read(void)
// playlist
- fname = get_path(GUI_PLAYLIST);
+ fname = get_path(gui_playlist);
file = fopen(fname, "rt");
if (file) {
@@ -305,7 +305,7 @@ void cfg_read(void)
// URL list
- fname = get_path(GUI_URLLIST);
+ fname = get_path(gui_urllist);
file = fopen(fname, "rt");
if (file) {
@@ -333,7 +333,7 @@ void cfg_read(void)
// directory history
- fname = get_path(GUI_HISTORY);
+ fname = get_path(gui_history);
file = fopen(fname, "rt");
if (file) {
@@ -357,7 +357,7 @@ void cfg_write(void)
// configuration
- fname = get_path(GUI_CONFIGURATION);
+ fname = get_path(gui_configuration);
file = fopen(fname, "wt+");
if (file) {
@@ -387,7 +387,7 @@ void cfg_write(void)
// playlist
- fname = get_path(GUI_PLAYLIST);
+ fname = get_path(gui_playlist);
file = fopen(fname, "wt+");
if (file) {
@@ -409,7 +409,7 @@ void cfg_write(void)
// URL list
- fname = get_path(GUI_URLLIST);
+ fname = get_path(gui_urllist);
file = fopen(fname, "wt+");
if (file) {
@@ -429,7 +429,7 @@ void cfg_write(void)
// directory history
- fname = get_path(GUI_HISTORY);
+ fname = get_path(gui_history);
file = fopen(fname, "wt+");
if (file) {
Modified: trunk/gui/ui/widgets.c
==============================================================================
--- trunk/gui/ui/widgets.c Fri Feb 10 16:24:27 2012 (r34683)
+++ trunk/gui/ui/widgets.c Fri Feb 10 16:40:53 2012 (r34684)
@@ -64,7 +64,7 @@ int gtkInitialized = 0;
#include "gtk/url.h"
#include "gtk/equalizer.h"
-#define GUI_ICON_NAME "mplayer"
+static const char gui_icon_name[] = "mplayer";
#define THRESHOLD 128 // transparency values equal to or above this will become
// opaque, all values below this will become transparent
@@ -79,7 +79,7 @@ static void gtkLoadIcon(GtkIconTheme *th
guchar *data;
int csize, i;
- pixbuf = gtk_icon_theme_load_icon(theme, GUI_ICON_NAME, size, 0, NULL);
+ pixbuf = gtk_icon_theme_load_icon(theme, gui_icon_name, size, 0, NULL);
if (pixbuf)
gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, gdk_colormap_get_system(), gdkIcon, gdkIconMask, THRESHOLD);
@@ -105,7 +105,7 @@ static void gtkLoadIcon(GtkIconTheme *th
g_object_unref(pixbuf);
} else
- mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_ICONERROR, GUI_ICON_NAME, size);
+ mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_ICONERROR, gui_icon_name, size);
// start up GTK which realizes the pixmaps
gtk_main_iteration_do(FALSE);
Modified: trunk/gui/win32/wincfg.c
==============================================================================
--- trunk/gui/win32/wincfg.c Fri Feb 10 16:24:27 2012 (r34683)
+++ trunk/gui/win32/wincfg.c Fri Feb 10 16:40:53 2012 (r34684)
@@ -38,7 +38,7 @@
#include "gui/interface.h"
#include "gui.h"
-#define GUI_CONFIGURATION "gui.conf"
+static const char gui_configuration[] = "gui.conf";
/* params */
int gtkAONorm = 0;
@@ -97,7 +97,7 @@ int cfg_gui_include(m_option_t *conf, co
void cfg_read(void)
{
- char *cfg = get_path(GUI_CONFIGURATION);
+ char *cfg = get_path(gui_configuration);
player_idle_mode = 1; // GUI is in idle mode by default
@@ -112,7 +112,7 @@ void cfg_read(void)
void cfg_write(void)
{
- char *cfg = get_path(GUI_CONFIGURATION);
+ char *cfg = get_path(gui_configuration);
FILE *f;
int i;
More information about the MPlayer-cvslog
mailing list