[MPlayer-cvslog] CVS: main/libmenu menu.c, 1.14, 1.15 menu_cmdlist.c, 1.4, 1.5 menu_console.c, 1.13, 1.14 menu_filesel.c, 1.13, 1.14 menu_param.c, 1.5, 1.6 menu_pt.c, 1.5, 1.6 menu_txt.c, 1.3, 1.4 vf_menu.c, 1.14, 1.15
Reynaldo H. Verdejo CVS
syncmail at mplayerhq.hu
Thu Mar 30 08:41:00 CEST 2006
CVS change done by Reynaldo H. Verdejo CVS
Update of /cvsroot/mplayer/main/libmenu
In directory mail:/var2/tmp/cvs-serv30651/libmenu
Modified Files:
menu.c menu_cmdlist.c menu_console.c menu_filesel.c
menu_param.c menu_pt.c menu_txt.c vf_menu.c
Log Message:
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
Index: menu.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- menu.c 30 Mar 2006 02:52:54 -0000 1.14
+++ menu.c 30 Mar 2006 06:40:58 -0000 1.15
@@ -1,5 +1,7 @@
#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
#include <stdlib.h>
#include <stdio.h>
@@ -63,7 +65,7 @@
while(1) {
r = asx_get_element(parser,&buffer,&element,&body,&attribs);
if(r < 0) {
- printf("Syntax error at line %d\n",parser->line);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
asx_parser_free(parser);
return 0;
} else if(r == 0) {
@@ -73,7 +75,7 @@
// Has it a name ?
name = asx_get_attrib("name",attribs);
if(!name) {
- printf("Menu definitions need a name attrib (line %d)\n",parser->line);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuDefinitionsNeedANameAttrib,parser->line);
free(element);
if(body) free(body);
asx_free_attribs(attribs);
@@ -98,13 +100,13 @@
for(i = 0 ; attribs[2*i] ; i++) {
if(strcasecmp(attribs[2*i],"name") == 0) continue;
if(!m_struct_set(&minfo->priv_st,menu_list[mcount].cfg,attribs[2*i], attribs[2*i+1]))
- printf("Bad attrib %s=%s in menu %s at line %d\n",attribs[2*i],attribs[2*i+1],
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_BadAttrib,attribs[2*i],attribs[2*i+1],
name,parser->line);
}
mcount++;
memset(&menu_list[mcount],0,sizeof(menu_def_t));
} else {
- printf("Unknown menu type %s at line %d\n",element,parser->line);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuType,element,parser->line);
free(name);
if(body) free(body);
}
@@ -130,7 +132,7 @@
#endif
fd = open(cfg_file, O_RDONLY);
if(fd < 0) {
- printf("Can't open menu config file: %s\n",cfg_file);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantOpenConfigFile,cfg_file);
return 0;
}
buffer = malloc(bl);
@@ -138,7 +140,7 @@
int r;
if(bl - br < BUF_MIN) {
if(bl >= BUF_MAX) {
- printf("Menu config file is too big (> %d KB)\n",BUF_MAX/1024);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsTooBig,BUF_MAX/1024);
close(fd);
free(buffer);
return 0;
@@ -151,7 +153,7 @@
br += r;
}
if(!br) {
- printf("Menu config file is empty\n");
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsEmpty);
return 0;
}
buffer[br-1] = '\0';
@@ -208,7 +210,7 @@
break;
}
if(menu_list[i].name == NULL) {
- printf("Menu %s not found\n",name);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuNotFound,name);
return NULL;
}
m = calloc(1,sizeof(menu_t));
@@ -219,7 +221,7 @@
if(m->priv)
m_struct_free(m->priv_st,m->priv);
free(m);
- printf("Menu %s: init failed\n",name);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuInitFailed,name);
return NULL;
}
@@ -301,7 +303,7 @@
int font;
if(!draw_alpha) {
- printf("Unsupported outformat !!!!\n");
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
return;
}
@@ -332,7 +334,7 @@
draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt);
if(!draw_alpha) {
- printf("Unsupported outformat !!!!\n");
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
return;
}
Index: menu_cmdlist.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_cmdlist.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- menu_cmdlist.c 25 Mar 2006 17:32:10 -0000 1.4
+++ menu_cmdlist.c 30 Mar 2006 06:40:58 -0000 1.5
@@ -1,5 +1,7 @@
#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
#include <stdlib.h>
#include <stdio.h>
@@ -106,19 +108,19 @@
while(1) {
r = asx_get_element(parser,&args,&element,&body,&attribs);
if(r < 0) {
- printf("Syntax error at line %d\n",parser->line);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
asx_parser_free(parser);
return -1;
} else if(r == 0) {
asx_parser_free(parser);
if(!m)
- printf("No entry found in the menu definition\n");
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_NoEntryFoundInTheMenuDefinition);
return m ? 1 : 0;
}
// Has it a name ?
name = asx_get_attrib("name",attribs);
if(!name) {
- printf("List menu entry definitions need a name (line %d)\n",parser->line);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ListMenuEntryDefinitionsNeedAName,parser->line);
free(element);
if(body) free(body);
asx_free_attribs(attribs);
@@ -145,7 +147,7 @@
menu->close = close;
if(!args) {
- printf("List menu need an argument\n");
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ListMenuNeedAnArgument);
return 0;
}
Index: menu_console.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_console.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- menu_console.c 30 Mar 2006 02:52:54 -0000 1.13
+++ menu_console.c 30 Mar 2006 06:40:58 -0000 1.14
@@ -1,5 +1,7 @@
#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
#include <stdlib.h>
#include <stdio.h>
@@ -260,10 +262,10 @@
mpriv->prompt = mpriv->mp_prompt;
//add_line(mpriv,"Child process exited");
}
- else printf("waitpid error: %s\n",strerror(errno));
+ else mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WaitPidError,strerror(errno));
}
} else if(r < 0) {
- printf("select error\n");
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_SelectError);
return;
}
@@ -273,7 +275,7 @@
if(w) mpriv->add_line = 1;
r = read(mpriv->child_fd[i],buffer,255);
if(r < 0)
- printf("Read error on child's %s \n", i == 1 ? "stdout":"stderr");
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReadErrorOnChilds, i == 1 ? "stdout":"stderr");
else if(r>0) {
buffer[r] = '\0';
add_string(mpriv,buffer);
@@ -291,9 +293,9 @@
#ifndef __MINGW32__
int in[2],out[2],err[2];
- printf("Console run %s ...\n",cmd);
+ mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ConsoleRun,cmd);
if(mpriv->child) {
- printf("A child is alredy running\n");
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_AChildIsAlreadyRunning);
return 0;
}
@@ -303,7 +305,7 @@
mpriv->child = fork();
if(mpriv->child < 0) {
- printf("Fork failed !!!\n");
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ForkFailed);
close_pipe(in);
close_pipe(out);
close_pipe(err);
@@ -377,14 +379,14 @@
while(l > 0) {
int w = write(mpriv->child_fd[0],str,l);
if(w < 0) {
- printf("Write error\n");
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WriteError);
break;
}
l -= w;
str += w;
}
if(write(mpriv->child_fd[0],"\n",1) < 0)
- printf("Write error\n");
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WriteError);
enter_cmd(menu);
return;
}
Index: menu_filesel.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_filesel.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- menu_filesel.c 25 Mar 2006 17:32:10 -0000 1.13
+++ menu_filesel.c 30 Mar 2006 06:40:58 -0000 1.14
@@ -12,6 +12,8 @@
#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
#include "m_struct.h"
#include "m_option.h"
@@ -142,7 +144,7 @@
mpriv->p.title = replace_path(mpriv->title,mpriv->dir);
if ((dirp = opendir (mpriv->dir)) == NULL){
- printf("opendir error: %s", strerror(errno));
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_OpendirError, strerror(errno));
return 0;
}
@@ -155,7 +157,7 @@
if(n%20 == 0){ // Get some more mem
if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *)))
== NULL) {
- printf("realloc error: %s", strerror(errno));
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno));
n--;
goto bailout;
}
@@ -164,7 +166,7 @@
namelist[n] = (char *) malloc(strlen(dp->d_name) + 2);
if(namelist[n] == NULL){
- printf("malloc error: %s", strerror(errno));
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno));
n--;
goto bailout;
}
@@ -182,7 +184,7 @@
qsort(namelist, n, sizeof(char *), (kill_warn)compare);
if (n < 0) {
- printf("readdir error: %s\n",strerror(errno));
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReaddirError,strerror(errno));
return 0;
}
while(n--) {
@@ -193,7 +195,7 @@
e->d = 1;
menu_list_add_entry(menu,e);
}else{
- printf("malloc error: %s", strerror(errno));
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno));
}
free(namelist[n]);
}
@@ -237,7 +239,7 @@
}
menu_list_uninit(menu,free_entry);
if(!open_dir(menu,p)) {
- printf("Can't open directory %s\n",p);
+ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_CantOpenDirectory,p);
menu->cl = 1;
}
free(p);
Index: menu_param.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_param.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- menu_param.c 25 Mar 2006 20:49:36 -0000 1.5
+++ menu_param.c 30 Mar 2006 06:40:58 -0000 1.6
@@ -97,13 +97,13 @@
while(1) {
r = asx_get_element(parser,&args,&element,&body,&attribs);
if(r < 0) {
- mp_msg(MSGT_OSD_MENU,MSGL_ERR,"Syntax error at line %d\n",parser->line);
+ mp_msg(MSGT_OSD_MENU,MSGL_ERR,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
asx_parser_free(parser);
return -1;
} else if(r == 0) {
asx_parser_free(parser);
if(!m)
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,"No entry found in the menu definition\n");
+ mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_NoEntryFoundInTheMenuDefinition);
m = calloc(1,sizeof(struct list_entry_s));
m->p.txt = strdup("Back");
menu_list_add_entry(menu,m);
@@ -112,7 +112,7 @@
if(!strcmp(element,"menu")) {
name = asx_get_attrib("menu",attribs);
if(!name) {
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,"Submenu definition need a 'menu' attribut.\n");
+ mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_SubmenuDefinitionNeedAMenuAttribut);
goto next_element;
}
m = calloc(1,sizeof(struct list_entry_s));
@@ -127,8 +127,7 @@
name = asx_get_attrib("property",attribs);
opt = name ? mp_property_find(name) : NULL;
if(!opt) {
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,"Pref menu entry definitions need a valid 'property'"
- " attribut (line %d)\n",parser->line);
+ mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_PrefMenuEntryDefinitionsNeed,parser->line);
goto next_element;
}
m = calloc(1,sizeof(struct list_entry_s));
@@ -239,7 +238,7 @@
if(!args) {
- mp_msg(MSGT_OSD_MENU,MSGL_ERR,"Pref menu need an argument\n");
+ mp_msg(MSGT_OSD_MENU,MSGL_ERR,MSGTR_LIBMENU_PrefMenuNeedAnArgument);
return 0;
}
Index: menu_pt.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_pt.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- menu_pt.c 25 Mar 2006 17:32:10 -0000 1.5
+++ menu_pt.c 30 Mar 2006 06:40:58 -0000 1.6
@@ -5,6 +5,8 @@
//#include <libgen.h>
#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
#include "img_format.h"
#include "mp_image.h"
@@ -77,7 +79,7 @@
d--;
}
if(i == NULL) {
- printf("Can't find the target item ????\n");
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantfindTheTargetItem);
break;
}
}
@@ -87,7 +89,7 @@
if(c)
mp_input_queue_cmd(c);
else
- printf("Failed to build command %s\n",str);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToBuildCommand,str);
} break;
default:
menu_list_read_cmd(menu,cmd);
Index: menu_txt.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/menu_txt.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- menu_txt.c 26 Oct 2005 00:07:43 -0000 1.3
+++ menu_txt.c 30 Mar 2006 06:40:58 -0000 1.4
@@ -1,5 +1,7 @@
#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
#include <stdlib.h>
#include <stdio.h>
@@ -129,13 +131,13 @@
menu->read_key = read_key;
if(!mpriv->file) {
- printf("Menu txt need a txt file name (param file)\n");
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuTxtNeedATxtFileName);
return 0;
}
fd = fopen(mpriv->file,"r");
if(!fd) {
- printf("Menu txt can't open: %s\n",mpriv->file);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuTxtCantOpen,mpriv->file);
return 0;
}
@@ -166,7 +168,7 @@
mpriv->num_lines++;
}
if(pos >= BUF_SIZE-1) {
- printf("Warning too long line, splitting it\n");
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_WarningTooLongLineSplitting);
mpriv->lines = realloc(mpriv->lines,(mpriv->num_lines + 1)*sizeof(char*));
mpriv->lines[mpriv->num_lines] = strdup(buf);
mpriv->num_lines++;
@@ -174,7 +176,7 @@
}
}
- printf("Parsed %d lines\n",mpriv->num_lines);
+ mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ParsedLines,mpriv->num_lines);
return 1;
}
Index: vf_menu.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/vf_menu.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- vf_menu.c 25 Mar 2006 17:32:10 -0000 1.14
+++ vf_menu.c 30 Mar 2006 06:40:58 -0000 1.15
@@ -1,5 +1,7 @@
#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
#include <stdio.h>
#include <stdlib.h>
@@ -116,7 +118,7 @@
else if(strcmp(arg,"hide") == 0)
priv->current->show = 0;
else
- printf("Unknown menu command: '%s'\n",arg);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuCommand,arg);
return 1;
}
case MP_CMD_SET_MENU : {
@@ -124,7 +126,7 @@
menu_t* l = priv->current;
priv->current = menu_open(menu);
if(!priv->current) {
- printf("Failed to open menu '%s'\n",menu);
+ mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu);
priv->current = l;
priv->current->show = 0;
} else {
More information about the MPlayer-cvslog
mailing list