[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[314] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-11-09 15:57:34
|
Revision: 314 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=314&view=rev Author: nickols_k Date: 2012-11-09 15:57:27 +0000 (Fri, 09 Nov 2012) Log Message: ----------- use more MPXP_Rc Modified Paths: -------------- mplayerxp/input/input.c mplayerxp/input/input.h mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpconf/codec-cfg.h mplayerxp/libmpdemux/tcp.c mplayerxp/mplayerxp.c Modified: mplayerxp/input/input.c =================================================================== --- mplayerxp/input/input.c 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/input/input.c 2012-11-09 15:57:27 UTC (rev 314) @@ -437,10 +437,10 @@ static int mp_input_default_cmd_func(int fd,char* buf, int l); static char* mp_input_get_key_name(int key); -int mp_input_add_cmd_fd(int fd, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { +MPXP_Rc mp_input_add_cmd_fd(int fd, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { if(num_cmd_fd == MP_MAX_CMD_FD) { MSG_ERR("Too much command fd, unable to register fd %d\n",fd); - return 0; + return MPXP_False; } memset(&cmd_fds[num_cmd_fd],0,sizeof(mp_input_fd_t)); @@ -450,7 +450,7 @@ if(!sel) cmd_fds[num_cmd_fd].flags = MP_FD_NO_SELECT; num_cmd_fd++; - return 1; + return MPXP_Ok; } void mp_input_rm_cmd_fd(int fd) { @@ -478,10 +478,10 @@ num_key_fd--; } -int mp_input_add_key_fd(int fd, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { +MPXP_Rc mp_input_add_key_fd(int fd, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { if(num_key_fd == MP_MAX_KEY_FD) { MSG_ERR("Too much key fd, unable to register fd %d\n",fd); - return 0; + return MPXP_False; } memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t)); @@ -491,11 +491,9 @@ if(!sel) key_fds[num_key_fd].flags |= MP_FD_NO_SELECT; num_key_fd++; - return 1; + return MPXP_Ok; } - - mp_cmd_t* mp_input_parse_cmd(char* str) { int i,l; char *ptr,*e; @@ -994,12 +992,12 @@ return NULL; } -int mp_input_queue_cmd(mp_cmd_t* cmd) { - if(cmd_queue_length >= CMD_QUEUE_SIZE) return 0; +MPXP_Rc mp_input_queue_cmd(mp_cmd_t* cmd) { + if(cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; cmd_queue[cmd_queue_end] = cmd; cmd_queue_end = (cmd_queue_end + 1) % CMD_QUEUE_SIZE; cmd_queue_length++; - return 1; + return MPXP_Ok; } static mp_cmd_t* mp_input_get_queued_cmd(int peek_only) { @@ -1436,7 +1434,7 @@ exit(0); } -int mp_input_check_interrupt(int tim) { +MPXP_Rc mp_input_check_interrupt(int tim) { mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(tim,0,1)) == NULL) return 0; switch(cmd->id) { @@ -1446,10 +1444,10 @@ case MP_CMD_PLAY_TREE_UP_STEP: case MP_CMD_PLAY_ALT_SRC_STEP: // The cmd will be executed when we are back in the main loop - return 1; //<-- memory leaks here + return MPXP_Ok; //<-- memory leaks here } // remove the cmd from the queue cmd = mp_input_get_cmd(tim,0,0); mp_cmd_free(cmd); - return 0; + return MPXP_False; } Modified: mplayerxp/input/input.h =================================================================== --- mplayerxp/input/input.h 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/input/input.h 2012-11-09 15:57:27 UTC (rev 314) @@ -1,6 +1,8 @@ #ifndef INPUT_H_INCLUDED #define INPUT_H_INCLUDED 1 +#include "xmpcore/xmp_enums.h" + // All commands id enum { MP_CMD_SEEK =0, @@ -150,14 +152,14 @@ // fd will be used. // The last arg can be NULL if nothing is needed to close the driver. The close // function can be used -extern int mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); +extern MPXP_Rc mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func); // This remove a cmd driver, you usally don't need to use it extern void mp_input_rm_cmd_fd(int fd); // The args are the sames as for the keys drivers. If you don't use any valid fd you MUST // give a read_func. -extern int mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); +extern MPXP_Rc mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); // As for the cmd one you usally don't need this function extern void mp_input_rm_key_fd(int fd); @@ -165,7 +167,7 @@ // This function can be used to reput a command in the system. It's used by libmpdemux // when it perform a blocking operation to resend the command it received to the main // loop. -extern int mp_input_queue_cmd(mp_cmd_t* cmd); +extern MPXP_Rc mp_input_queue_cmd(mp_cmd_t* cmd); // This function retrive the next avaible command waiting no more than time msec. // If pause is true, the next input will always return a pause command. @@ -190,7 +192,7 @@ extern void mp_input_uninit(void); // Interruptible usleep: (used by libmpdemux) -extern int mp_input_check_interrupt(int time); +extern MPXP_Rc mp_input_check_interrupt(int time); extern void mp_input_print_keys(void); extern void mp_input_print_cmds(void); Modified: mplayerxp/libmpconf/cfgparser.c =================================================================== --- mplayerxp/libmpconf/cfgparser.c 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/libmpconf/cfgparser.c 2012-11-09 15:57:27 UTC (rev 314) @@ -695,354 +695,330 @@ return config_read_option(config,config->opt_list,opt,param); } -int m_config_parse_config_file(m_config_t *config, char *conffile) +MPXP_Rc m_config_parse_config_file(m_config_t *config, char *conffile) { #define PRINT_LINENUM MSG_ERR("%s(%d): ", conffile, line_num) #define MAX_LINE_LEN 1000 #define MAX_OPT_LEN 100 #define MAX_PARAM_LEN 100 - FILE *fp; - char *line; - char opt[MAX_OPT_LEN + 1]; - char param[MAX_PARAM_LEN + 1]; - char c; /* for the "" and '' check */ - int tmp; - int line_num = 0; - int line_pos; /* line pos */ - int opt_pos; /* opt pos */ - int param_pos; /* param pos */ - int ret = 1; - int errors = 0; + FILE *fp; + char *line; + char opt[MAX_OPT_LEN + 1]; + char param[MAX_PARAM_LEN + 1]; + char c; /* for the "" and '' check */ + int tmp; + int line_num = 0; + int line_pos; /* line pos */ + int opt_pos; /* opt pos */ + int param_pos; /* param pos */ + MPXP_Rc ret = MPXP_Ok; + int errors = 0; #ifdef MP_DEBUG - assert(config != NULL); - // assert(conf_list != NULL); + assert(config != NULL); + // assert(conf_list != NULL); #endif - if (++config->recursion_depth > 1) - MSG_INFO("Reading config file: %s", conffile); + if (++config->recursion_depth > 1) MSG_INFO("Reading config file: %s", conffile); - if (config->recursion_depth > MAX_RECURSION_DEPTH) { - MSG_FATAL(": too deep 'include'. check your configfiles\n"); - ret = -1; - goto out; - } + if (config->recursion_depth > MAX_RECURSION_DEPTH) { + MSG_FATAL(": too deep 'include'. check your configfiles\n"); + ret = MPXP_False; + goto out; + } - if (init_conf(config, CONFIG_FILE) == -1) { - ret = -1; - goto out; - } + if (init_conf(config, CONFIG_FILE) == -1) { + ret = MPXP_False; + goto out; + } - if ((line = (char *) mp_malloc(MAX_LINE_LEN + 1)) == NULL) { - MSG_FATAL("\ncan't get memory for 'line': %s", strerror(errno)); - ret = -1; - goto out; - } + if ((line = (char *) mp_malloc(MAX_LINE_LEN + 1)) == NULL) { + MSG_FATAL("\ncan't get memory for 'line': %s", strerror(errno)); + ret = MPXP_False; + goto out; + } - if ((fp = fopen(conffile, "r")) == NULL) { - if (config->recursion_depth > 1) - MSG_ERR(": %s\n", strerror(errno)); - mp_free(line); - ret = 0; - goto out; + if ((fp = fopen(conffile, "r")) == NULL) { + if (config->recursion_depth > 1) MSG_ERR(": %s\n", strerror(errno)); + mp_free(line); + ret = MPXP_Ok; + goto out; + } + if (config->recursion_depth > 1) MSG_FATAL("\n"); + + while (fgets(line, MAX_LINE_LEN, fp)) { + if (errors >= 16) { + MSG_FATAL("too many errors\n"); + goto out; } - if (config->recursion_depth > 1) - MSG_FATAL("\n"); - while (fgets(line, MAX_LINE_LEN, fp)) { - if (errors >= 16) { - MSG_FATAL("too many errors\n"); - goto out; - } + line_num++; + line_pos = 0; - line_num++; - line_pos = 0; + /* skip whitespaces */ + while (isspace(line[line_pos])) ++line_pos; - /* skip whitespaces */ - while (isspace(line[line_pos])) - ++line_pos; + /* EOL / comment */ + if (line[line_pos] == '\0' || line[line_pos] == '#') continue; - /* EOL / comment */ - if (line[line_pos] == '\0' || line[line_pos] == '#') - continue; + /* read option. */ + for (opt_pos = 0; isprint(line[line_pos]) && + line[line_pos] != ' ' && + line[line_pos] != '#' && + line[line_pos] != '='; /* NOTHING */) { + opt[opt_pos++] = line[line_pos++]; + if (opt_pos >= MAX_OPT_LEN) { + PRINT_LINENUM; + MSG_ERR("too long option\n"); + errors++; + ret = MPXP_False; + goto nextline; + } + } + if (opt_pos == 0) { + PRINT_LINENUM; + MSG_ERR("parse error\n"); + ret = MPXP_False; + errors++; + continue; + } + opt[opt_pos] = '\0'; - /* read option. */ - for (opt_pos = 0; isprint(line[line_pos]) && - line[line_pos] != ' ' && - line[line_pos] != '#' && - line[line_pos] != '='; /* NOTHING */) { - opt[opt_pos++] = line[line_pos++]; - if (opt_pos >= MAX_OPT_LEN) { - PRINT_LINENUM; - MSG_ERR("too long option\n"); - errors++; - ret = -1; - goto nextline; - } - } - if (opt_pos == 0) { - PRINT_LINENUM; - MSG_ERR("parse error\n"); - ret = -1; - errors++; - continue; - } - opt[opt_pos] = '\0'; - #ifdef MP_DEBUG - PRINT_LINENUM; - MSG_DBG2("option: %s\n", opt); + PRINT_LINENUM; + MSG_DBG2("option: %s\n", opt); #endif - /* skip whitespaces */ - while (isspace(line[line_pos])) - ++line_pos; + /* skip whitespaces */ + while (isspace(line[line_pos])) ++line_pos; - /* check '=' */ - if (line[line_pos++] != '=') { - PRINT_LINENUM; - MSG_ERR("option without parameter\n"); - ret = -1; - errors++; - continue; - } + /* check '=' */ + if (line[line_pos++] != '=') { + PRINT_LINENUM; + MSG_ERR("option without parameter\n"); + ret = MPXP_False; + errors++; + continue; + } - /* whitespaces... */ - while (isspace(line[line_pos])) - ++line_pos; + /* whitespaces... */ + while (isspace(line[line_pos])) ++line_pos; - /* read the parameter */ - if (line[line_pos] == '"' || line[line_pos] == '\'') { - c = line[line_pos]; - ++line_pos; - for (param_pos = 0; line[line_pos] != c; /* NOTHING */) { - param[param_pos++] = line[line_pos++]; - if (param_pos >= MAX_PARAM_LEN) { - PRINT_LINENUM; - MSG_ERR("too long parameter\n"); - ret = -1; - errors++; - goto nextline; - } - } - line_pos++; /* skip the closing " or ' */ - } else { - for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos]) - && line[line_pos] != '#'; /* NOTHING */) { - param[param_pos++] = line[line_pos++]; - if (param_pos >= MAX_PARAM_LEN) { - PRINT_LINENUM; - MSG_ERR("too long parameter\n"); - ret = -1; - errors++; - goto nextline; - } - } + /* read the parameter */ + if (line[line_pos] == '"' || line[line_pos] == '\'') { + c = line[line_pos]; + ++line_pos; + for (param_pos = 0; line[line_pos] != c; /* NOTHING */) { + param[param_pos++] = line[line_pos++]; + if (param_pos >= MAX_PARAM_LEN) { + PRINT_LINENUM; + MSG_ERR("too long parameter\n"); + ret = MPXP_False; + errors++; + goto nextline; } - param[param_pos] = '\0'; - - /* did we read a parameter? */ - if (param_pos == 0) { - PRINT_LINENUM; - MSG_ERR("option without parameter\n"); - ret = -1; - errors++; - continue; + } + line_pos++; /* skip the closing " or ' */ + } else { + for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos]) + && line[line_pos] != '#'; /* NOTHING */) { + param[param_pos++] = line[line_pos++]; + if (param_pos >= MAX_PARAM_LEN) { + PRINT_LINENUM; + MSG_ERR("too long parameter\n"); + ret = MPXP_False; + errors++; + goto nextline; } + } + } + param[param_pos] = '\0'; + /* did we read a parameter? */ + if (param_pos == 0) { + PRINT_LINENUM; + MSG_ERR("option without parameter\n"); + ret = MPXP_False; + errors++; + continue; + } + #ifdef MP_DEBUG - PRINT_LINENUM; - MSG_DBG2("parameter: %s\n", param); + PRINT_LINENUM; + MSG_DBG2("parameter: %s\n", param); #endif - /* now, check if we have some more chars on the line */ - /* whitespace... */ - while (isspace(line[line_pos])) - ++line_pos; + /* now, check if we have some more chars on the line */ + /* whitespace... */ + while (isspace(line[line_pos])) ++line_pos; - /* EOL / comment */ - if (line[line_pos] != '\0' && line[line_pos] != '#') { - PRINT_LINENUM; - MSG_ERR("extra characters on line: %s\n", line+line_pos); - ret = -1; - } + /* EOL / comment */ + if (line[line_pos] != '\0' && line[line_pos] != '#') { + PRINT_LINENUM; + MSG_ERR("extra characters on line: %s\n", line+line_pos); + ret = MPXP_False; + } - tmp = m_config_set_option(config, opt, param); - switch (tmp) { - case ERR_NOT_AN_OPTION: - case ERR_MISSING_PARAM: - case ERR_OUT_OF_RANGE: - case ERR_NO_SUBCONF: - case ERR_FUNC_ERR: - PRINT_LINENUM; - MSG_ERR("%s\n", opt); - ret = -1; - errors++; - continue; - /* break */ - } -nextline: - ; + tmp = m_config_set_option(config, opt, param); + switch (tmp) { + case ERR_NOT_AN_OPTION: + case ERR_MISSING_PARAM: + case ERR_OUT_OF_RANGE: + case ERR_NO_SUBCONF: + case ERR_FUNC_ERR: + PRINT_LINENUM; + MSG_ERR("%s\n", opt); + ret = MPXP_False; + errors++; + continue; + /* break */ } +nextline: + ; + } - mp_free(line); - fclose(fp); + mp_free(line); + fclose(fp); out: - --config->recursion_depth; - return ret; + --config->recursion_depth; + return ret; } extern void show_help(void); extern void show_long_help(void); -int m_config_parse_command_line(m_config_t *config, int argc, char **argv, char **envp) +MPXP_Rc m_config_parse_command_line(m_config_t *config, int argc, char **argv, char **envp) { - int i; - int tmp; - char *opt; - int no_more_opts = 0; - UNUSED(envp); + int i; + int tmp; + char *opt; + int no_more_opts = 0; + UNUSED(envp); #ifdef MP_DEBUG - assert(config != NULL); - assert(config->pt != NULL); - assert(argv != NULL); - assert(envp != NULL); - assert(argc >= 1); + assert(config != NULL); + assert(config->pt != NULL); + assert(argv != NULL); + assert(envp != NULL); + assert(argc >= 1); #endif - - if (init_conf(config, COMMAND_LINE) == -1) - return -1; - if(config->last_parent == NULL) - config->last_parent = config->pt; - /* in order to work recursion detection properly in parse_config_file */ - ++config->recursion_depth; - for (i = 1; i < argc; i++) { - //next: - opt = argv[i]; - if(strcmp(opt,"--help")==0) { - show_help(); - exit(0); - } - if(strcmp(opt,"--long-help")==0) { - show_long_help(); - exit(0); - } - /* check for -- (no more options id.) except --help! */ - if ((*opt == '-') && (*(opt+1) == '-')) - { - no_more_opts = 1; - if (i+1 >= argc) - { - MSG_ERR( "You added '--' but no filenames presented!\n"); - goto err_out; - } - continue; - } - if((opt[0] == '{') && (opt[1] == '\0')) - { - play_tree_t* entry = play_tree_new(); - UNSET_GLOBAL(config); - if(config->last_entry == NULL) { - play_tree_set_child(config->last_parent,entry); - } else { - play_tree_append_entry(config->last_entry,entry); - config->last_entry = NULL; - } - config->last_parent = entry; - continue; - } + if (init_conf(config, COMMAND_LINE) == -1) return MPXP_False; + if(config->last_parent == NULL) config->last_parent = config->pt; + /* in order to work recursion detection properly in parse_config_file */ + ++config->recursion_depth; - if((opt[0] == '}') && (opt[1] == '\0')) - { - if( ! config->last_parent || ! config->last_parent->parent) { - MSG_ERR( "too much }-\n"); - goto err_out; - } - config->last_entry = config->last_parent; - config->last_parent = config->last_entry->parent; - continue; - } + for (i = 1; i < argc; i++) { + //next: + opt = argv[i]; + if(strcmp(opt,"--help")==0) { + show_help(); + exit(0); + } + if(strcmp(opt,"--long-help")==0) { + show_long_help(); + exit(0); + } + /* check for -- (no more options id.) except --help! */ + if ((*opt == '-') && (*(opt+1) == '-')) { + no_more_opts = 1; + if (i+1 >= argc) { + MSG_ERR( "You added '--' but no filenames presented!\n"); + goto err_out; + } + continue; + } + if((opt[0] == '{') && (opt[1] == '\0')) { + play_tree_t* entry = play_tree_new(); + UNSET_GLOBAL(config); + if(config->last_entry == NULL) { + play_tree_set_child(config->last_parent,entry); + } else { + play_tree_append_entry(config->last_entry,entry); + config->last_entry = NULL; + } + config->last_parent = entry; + continue; + } - if ((no_more_opts == 0) && (*opt == '-') && (*(opt+1) != 0)) /* option */ - { - /* remove leading '-' */ - char *assign,*item,*parm; - opt++; + if((opt[0] == '}') && (opt[1] == '\0')) { + if( ! config->last_parent || ! config->last_parent->parent) { + MSG_ERR( "too much }-\n"); + goto err_out; + } + config->last_entry = config->last_parent; + config->last_parent = config->last_entry->parent; + continue; + } - MSG_DBG2( "this_option: %s\n", opt); - parm = argv[i+1]; - item=opt; - assign = strchr(opt,'='); - if(assign) { - item = mp_malloc(assign-opt); - memcpy(item,opt,assign-opt); - item[assign-opt]='\0'; - parm = mp_strdup(assign+1); - } - tmp = m_config_set_option(config, item, parm); - if(!tmp && assign) - MSG_ERR("Option '%s' doesn't require arguments\n",item); - if(assign) { - mp_free(item); - mp_free(parm); - } - if(!tmp && assign) goto err_out; + if ((no_more_opts == 0) && (*opt == '-') && (*(opt+1) != 0)) /* option */ { + /* remove leading '-' */ + char *assign,*item,*parm; + opt++; - switch (tmp) { - case ERR_NOT_AN_OPTION: - case ERR_MISSING_PARAM: - case ERR_OUT_OF_RANGE: - case ERR_NO_SUBCONF: - case ERR_FUNC_ERR: - MSG_ERR( "Error '%s' while parsing option: '%s'!\n" + MSG_DBG2( "this_option: %s\n", opt); + parm = argv[i+1]; + item=opt; + assign = strchr(opt,'='); + if(assign) { + item = mp_malloc(assign-opt); + memcpy(item,opt,assign-opt); + item[assign-opt]='\0'; + parm = mp_strdup(assign+1); + } + tmp = m_config_set_option(config, item, parm); + if(!tmp && assign) MSG_ERR("Option '%s' doesn't require arguments\n",item); + if(assign) { + mp_free(item); + mp_free(parm); + } + if(!tmp && assign) goto err_out; + + switch (tmp) { + case ERR_NOT_AN_OPTION: + case ERR_MISSING_PARAM: + case ERR_OUT_OF_RANGE: + case ERR_NO_SUBCONF: + case ERR_FUNC_ERR: + MSG_ERR( "Error '%s' while parsing option: '%s'!\n" ,tmp==ERR_NOT_AN_OPTION?"no-option": tmp==ERR_MISSING_PARAM?"missing-param": tmp==ERR_OUT_OF_RANGE?"out-of-range": tmp==ERR_NO_SUBCONF?"no-subconfig": "func-error" ,opt); - goto err_out; - default: - i += tmp; - if(assign) i--; - break; - } - } - else /* filename */ - { - play_tree_t* entry = play_tree_new(); - MSG_DBG2("Adding file %s\n",argv[i]); - play_tree_add_file(entry,argv[i]); - if(strcasecmp(argv[i],"-") == 0) - m_config_set_option(config,"use-stdin",NULL); - /* opt is not an option -> treat it as a filename */ - UNSET_GLOBAL(config); // We start entry specific options - if(config->last_entry == NULL) - play_tree_set_child(config->last_parent,entry); - else - play_tree_append_entry(config->last_entry,entry); - config->last_entry = entry; - } + goto err_out; + default: + i += tmp; + if(assign) i--; + break; + } + } else /* filename */ { + play_tree_t* entry = play_tree_new(); + MSG_DBG2("Adding file %s\n",argv[i]); + play_tree_add_file(entry,argv[i]); + if(strcasecmp(argv[i],"-") == 0) m_config_set_option(config,"use-stdin",NULL); + /* opt is not an option -> treat it as a filename */ + UNSET_GLOBAL(config); // We start entry specific options + if(config->last_entry == NULL) play_tree_set_child(config->last_parent,entry); + else play_tree_append_entry(config->last_entry,entry); + config->last_entry = entry; } + } - --config->recursion_depth; - if(config->last_parent != config->pt) - MSG_ERR("Missing }- ?\n"); - UNSET_GLOBAL(config); - SET_RUNNING(config); - return 1; + --config->recursion_depth; + if(config->last_parent != config->pt) MSG_ERR("Missing }- ?\n"); + UNSET_GLOBAL(config); + SET_RUNNING(config); + return MPXP_Ok; #if 0 err_out_mem: - MSG_ERR( "can't allocate memory for filenames (%s)\n", strerror(errno)); + MSG_ERR( "can't allocate memory for filenames (%s)\n", strerror(errno)); #endif err_out: - --config->recursion_depth; - MSG_ERR( "command line: %s\n", argv[i]); - return -1; + --config->recursion_depth; + MSG_ERR( "command line: %s\n", argv[i]); + return MPXP_False; } - - int m_config_register_options(m_config_t *config,const config_t *args) { int list_len = 0; const config_t** conf_list = config->opt_list; @@ -1212,8 +1188,7 @@ } -int -m_config_switch_flag(m_config_t *config,const char* opt) { +int m_config_switch_flag(m_config_t *config,const char* opt) { const config_t *conf; #ifdef MP_DEBUG Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/libmpconf/cfgparser.h 2012-11-09 15:57:27 UTC (rev 314) @@ -1,9 +1,9 @@ /* * command line and config file parser */ - #ifndef __CONFIG_H -#define __CONFIG_H +#define __CONFIG_H 1 +#include "xmpcore/xmp_enums.h" /* config types */ enum { @@ -81,13 +81,13 @@ * 0 if can't open configfile * 1 on success */ -int m_config_parse_config_file(m_config_t *config, char *conffile); +MPXP_Rc m_config_parse_config_file(m_config_t *config, char *conffile); /* parse_command_line returns: * -1 on error (invalid option...) * 1 otherwise */ -int m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); +MPXP_Rc m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); m_config_t* m_config_new(play_tree_t* pt); Modified: mplayerxp/libmpconf/codec-cfg.h =================================================================== --- mplayerxp/libmpconf/codec-cfg.h 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/libmpconf/codec-cfg.h 2012-11-09 15:57:27 UTC (rev 314) @@ -28,31 +28,31 @@ #ifndef GUID_TYPE #define GUID_TYPE typedef struct { - uint32_t f1; - uint16_t f2; - uint16_t f3; - uint8_t f4[8]; + uint32_t f1; + uint16_t f2; + uint16_t f3; + uint8_t f4[8]; } GUID; #endif typedef struct codecs_st { - uint32_t fourcc[CODECS_MAX_FOURCC]; - uint32_t fourccmap[CODECS_MAX_FOURCC]; - uint32_t outfmt[CODECS_MAX_OUTFMT]; - unsigned char outflags[CODECS_MAX_OUTFMT]; - uint32_t infmt[CODECS_MAX_INFMT]; - unsigned char inflags[CODECS_MAX_INFMT]; - char codec_name[256]; - char s_info[256]; - char s_comment[256]; - char dll_name[256]; - GUID guid; - char driver_name[256]; - short flags; - short status; - short cpuflags; - short priority; + uint32_t fourcc[CODECS_MAX_FOURCC]; + uint32_t fourccmap[CODECS_MAX_FOURCC]; + uint32_t outfmt[CODECS_MAX_OUTFMT]; + unsigned char outflags[CODECS_MAX_OUTFMT]; + uint32_t infmt[CODECS_MAX_INFMT]; + unsigned char inflags[CODECS_MAX_INFMT]; + char codec_name[256]; + char s_info[256]; + char s_comment[256]; + char dll_name[256]; + GUID guid; + char driver_name[256]; + short flags; + short status; + short cpuflags; + short priority; } codecs_t; extern int parse_codec_cfg(const char *cfgfile); Modified: mplayerxp/libmpdemux/tcp.c =================================================================== --- mplayerxp/libmpdemux/tcp.c 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/libmpdemux/tcp.c 2012-11-09 15:57:27 UTC (rev 314) @@ -198,7 +198,7 @@ FD_SET( socket_server_fd, &set ); // When the connection will be made, we will have a writeable fd while((ret = select(FD_SETSIZE, NULL, &set, NULL, &tv)) == 0) { - if(count > 30 || mp_input_check_interrupt(500)) { + if(count > 30 || mp_input_check_interrupt(500)==MPXP_Ok) { if(count > 30) MSG_ERR("[tcp%s] Connecting timeout\n",IP_NAME); else Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-09 15:22:48 UTC (rev 313) +++ mplayerxp/mplayerxp.c 2012-11-09 15:57:27 UTC (rev 314) @@ -156,9 +156,9 @@ **************************************************************************/ static int cfg_inc_verbose(struct config *conf){ UNUSED(conf); ++mp_conf.verbose; return 0;} -static int cfg_include(struct config *conf, char *filename){ - UNUSED(conf); - return m_config_parse_config_file(mp_data->mconfig, filename); +static MPXP_Rc cfg_include(struct config *conf, char *filename){ + UNUSED(conf); + return m_config_parse_config_file(mp_data->mconfig, filename); } #include "cfg-mplayerxp.h" @@ -441,8 +441,7 @@ write(conffile_fd, default_config, strlen(default_config)); close(conffile_fd); } - if (m_config_parse_config_file(conf, conffile) < 0) - exit(1); + if (m_config_parse_config_file(conf, conffile) != MPXP_Ok) exit(1); mp_free(conffile); } } @@ -1677,7 +1676,7 @@ mp_register_options(mp_data->mconfig); parse_cfgfiles(mp_data->mconfig); - if(m_config_parse_command_line(mp_data->mconfig, argc, argv, envp) < 0) + if(m_config_parse_command_line(mp_data->mconfig, argc, argv, envp)!=MPXP_Ok) exit_player("Error parse command line"); // error parsing cmdline if(!mp_conf.xp) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |