From e5229206974cf394bd475b69fb061a704f63e028 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 25 Feb 2010 22:27:53 +0000 Subject: [PATCH 01/14] Make local-only cddb functions static. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30735 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_cddb.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c index 1f8d44a005..98d276cb4b 100644 --- a/stream/stream_cddb.c +++ b/stream/stream_cddb.c @@ -86,7 +86,7 @@ stream_t* open_cdda(char *dev, char *track); static cd_toc_t cdtoc[100]; static int cdtoc_last_track; -int read_toc(const char *dev) +static int read_toc(const char *dev) { int first = 0, last = -1; int i; @@ -256,7 +256,7 @@ int cdd_identify(const char *dev) return cdtoc_last_track; } -unsigned int cddb_sum(int n) +static unsigned int cddb_sum(int n) { unsigned int ret; @@ -268,7 +268,7 @@ unsigned int cddb_sum(int n) return ret; } -unsigned long cddb_discid(int tot_trks) +static unsigned long cddb_discid(int tot_trks) { unsigned int i, t = 0, n = 0; @@ -284,7 +284,7 @@ unsigned long cddb_discid(int tot_trks) -int cddb_http_request(char *command, +static int cddb_http_request(char *command, int (*reply_parser)(HTTP_header_t*, cddb_data_t*), cddb_data_t *cddb_data) { @@ -341,7 +341,7 @@ int cddb_http_request(char *command, return ret; } -int cddb_read_cache(cddb_data_t *cddb_data) +static int cddb_read_cache(cddb_data_t *cddb_data) { char file_name[100]; struct stat stats; @@ -387,7 +387,7 @@ int cddb_read_cache(cddb_data_t *cddb_data) return 0; } -int cddb_write_cache(cddb_data_t *cddb_data) +static int cddb_write_cache(cddb_data_t *cddb_data) { // We have the file, save it for cache. struct stat file_stat; @@ -441,7 +441,7 @@ int cddb_write_cache(cddb_data_t *cddb_data) return 0; } -int cddb_read_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) +static int cddb_read_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { unsigned long disc_id; char category[100]; @@ -500,7 +500,7 @@ int cddb_read_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) return 0; } -int cddb_request_titles(cddb_data_t *cddb_data) +static int cddb_request_titles(cddb_data_t *cddb_data) { char command[1024]; sprintf(command, "cddb+read+%s+%08lx", @@ -508,7 +508,7 @@ int cddb_request_titles(cddb_data_t *cddb_data) return cddb_http_request(command, cddb_read_parse, cddb_data); } -int cddb_parse_matches_list(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) +static int cddb_parse_matches_list(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { char album_title[100]; char *ptr = NULL; @@ -547,7 +547,7 @@ int cddb_parse_matches_list(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) return 0; } -int cddb_query_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) +static int cddb_query_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { char album_title[100]; char *ptr = NULL; @@ -614,7 +614,7 @@ blues c711930d Santana / Supernatural return -1; } -int cddb_proto_level_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) +static int cddb_proto_level_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { int max; int ret, status; @@ -646,12 +646,12 @@ int cddb_proto_level_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) return -1; } -int cddb_get_proto_level(cddb_data_t *cddb_data) +static int cddb_get_proto_level(cddb_data_t *cddb_data) { return cddb_http_request("stat", cddb_proto_level_parse, cddb_data); } -int cddb_freedb_sites_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) +static int cddb_freedb_sites_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { int ret, status; @@ -675,12 +675,12 @@ int cddb_freedb_sites_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) return -1; } -int cddb_get_freedb_sites(cddb_data_t *cddb_data) +static int cddb_get_freedb_sites(cddb_data_t *cddb_data) { return cddb_http_request("sites", cddb_freedb_sites_parse, cddb_data); } -void cddb_create_hello(cddb_data_t *cddb_data) +static void cddb_create_hello(cddb_data_t *cddb_data) { char host_name[51]; char *user_name; @@ -703,7 +703,7 @@ void cddb_create_hello(cddb_data_t *cddb_data) user_name, host_name, "MPlayer", VERSION); } -int cddb_retrieve(cddb_data_t *cddb_data) +static int cddb_retrieve(cddb_data_t *cddb_data) { char offsets[1024], command[1024]; char *ptr; @@ -813,7 +813,7 @@ int cddb_resolve(const char *dev, char **xmcd_file) /*************** * xmcd parser * ***************/ -char *xmcd_parse_dtitle(cd_info_t *cd_info, char *line) +static char *xmcd_parse_dtitle(cd_info_t *cd_info, char *line) { char *ptr, *album; ptr = strstr(line, "DTITLE="); @@ -838,7 +838,7 @@ char *xmcd_parse_dtitle(cd_info_t *cd_info, char *line) return ptr; } -char *xmcd_parse_dgenre(cd_info_t *cd_info, char *line) +static char *xmcd_parse_dgenre(cd_info_t *cd_info, char *line) { char *ptr; ptr = strstr(line, "DGENRE="); @@ -853,7 +853,7 @@ char *xmcd_parse_dgenre(cd_info_t *cd_info, char *line) return ptr; } -char *xmcd_parse_ttitle(cd_info_t *cd_info, char *line) +static char *xmcd_parse_ttitle(cd_info_t *cd_info, char *line) { unsigned int track_nb; unsigned long sec, off; From b99077dc4c5a160ad3f70b0ae33c63bd62e19a96 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 25 Feb 2010 22:29:00 +0000 Subject: [PATCH 02/14] Remove unused function declaration. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30736 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_cddb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c index 98d276cb4b..3ecad98183 100644 --- a/stream/stream_cddb.c +++ b/stream/stream_cddb.c @@ -81,8 +81,6 @@ #define DEFAULT_FREEDB_SERVER "freedb.freedb.org" #define DEFAULT_CACHE_DIR "/.cddb/" -stream_t* open_cdda(char *dev, char *track); - static cd_toc_t cdtoc[100]; static int cdtoc_last_track; From 42096a34d53b725eabfe90a59b1e3c2cee6cda9c Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 25 Feb 2010 22:32:28 +0000 Subject: [PATCH 03/14] Make more option-parsing related function arguments const. Prerequisite for making stream_open filename const in a proper way. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30737 b3059339-0415-0410-9bf9-f77b7e298cf2 --- m_config.c | 8 ++++---- m_option.c | 58 +++++++++++++++++++++++++++--------------------------- m_option.h | 22 ++++++++++----------- m_struct.c | 2 +- m_struct.h | 2 +- 5 files changed, 46 insertions(+), 46 deletions(-) diff --git a/m_config.c b/m_config.c index 19a78264e6..2c2ca0fc08 100644 --- a/m_config.c +++ b/m_config.c @@ -37,10 +37,10 @@ #define MAX_PROFILE_DEPTH 20 static int -parse_profile(const m_option_t *opt, const char *name, char *param, void *dst, int src); +parse_profile(const m_option_t *opt, const char *name, const char *param, void *dst, int src); static void -set_profile(const m_option_t *opt, void* dst, void* src); +set_profile(const m_option_t *opt, void* dst, const void* src); static int show_profile(m_option_t *opt, char* name, char *param); @@ -515,7 +515,7 @@ m_config_set_profile(m_config_t* config, m_profile_t* p) { } static int -parse_profile(const m_option_t *opt, const char *name, char *param, void *dst, int src) +parse_profile(const m_option_t *opt, const char *name, const char *param, void *dst, int src) { m_config_t* config = opt->priv; char** list = NULL; @@ -551,7 +551,7 @@ parse_profile(const m_option_t *opt, const char *name, char *param, void *dst, i } static void -set_profile(const m_option_t *opt, void *dst, void *src) { +set_profile(const m_option_t *opt, void *dst, const void *src) { m_config_t* config = opt->priv; m_profile_t* p; char** list = NULL; diff --git a/m_option.c b/m_option.c index 35e2b775c9..6a5565eca0 100644 --- a/m_option.c +++ b/m_option.c @@ -57,7 +57,7 @@ const m_option_t* m_option_list_find(const m_option_t* list,const char* name) { // Default function that just does a memcpy -static void copy_opt(const m_option_t* opt,void* dst,void* src) { +static void copy_opt(const m_option_t* opt,void* dst,const void* src) { if(dst && src) memcpy(dst,src,opt->type->size); } @@ -93,7 +93,7 @@ static char* dup_printf(const char *fmt, ...) { #define VAL(x) (*(int*)(x)) -static int parse_flag(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_flag(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { if (src == M_CONFIG_FILE) { if(!param) return M_OPT_MISSING_PARAM; if (!strcasecmp(param, "yes") || /* any other language? */ @@ -153,7 +153,7 @@ const m_option_type_t m_option_type_flag = { // Integer -static int parse_int(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_int(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { long long tmp_int; char *endptr; src = 0; @@ -226,7 +226,7 @@ const m_option_type_t m_option_type_int64 = { #undef VAL #define VAL(x) (*(double*)(x)) -static int parse_double(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_double(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { double tmp_float; char* endptr; src = 0; @@ -296,7 +296,7 @@ const m_option_type_t m_option_type_double = { #undef VAL #define VAL(x) (*(float*)(x)) -static int parse_float(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_float(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { double tmp; int r= parse_double(opt, name, param, &tmp, src); if(r==1 && dst) VAL(dst) = tmp; @@ -325,7 +325,7 @@ const m_option_type_t m_option_type_float = { #undef VAL #define VAL(x) (*(off_t*)(x)) -static int parse_position(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_position(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { off_t tmp_off; char dummy; @@ -381,7 +381,7 @@ const m_option_type_t m_option_type_position = { #undef VAL #define VAL(x) (*(char**)(x)) -static int parse_str(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_str(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { if (param == NULL) @@ -413,7 +413,7 @@ static char* print_str(const m_option_t* opt, const void* val) { return (val && VAL(val) && strlen(VAL(val)) > 0) ? strdup(VAL(val)) : NULL; } -static void copy_str(const m_option_t* opt,void* dst, void* src) { +static void copy_str(const m_option_t* opt,void* dst, const void* src) { if(dst && src) { #ifndef NO_FREE if(VAL(dst)) free(VAL(dst)); //FIXME!!! @@ -561,10 +561,10 @@ static char *get_nextsep(char *ptr, char sep, int modify) { return ptr; } -static int parse_str_list(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_str_list(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { int n = 0,len = strlen(opt->name); char *str; - char *ptr = param, *last_ptr, **res; + char *ptr = (char *)param, *last_ptr, **res; int op = OP_NONE; if(opt->name[len-1] == '*' && ((int)strlen(name) > len - 1)) { @@ -648,7 +648,7 @@ static int parse_str_list(const m_option_t* opt,const char *name, char *param, v return 1; } -static void copy_str_list(const m_option_t* opt,void* dst, void* src) { +static void copy_str_list(const m_option_t* opt,void* dst, const void* src) { int n; char **d,**s; @@ -743,7 +743,7 @@ static void free_func_pf(void* src) { } // Parser for func_param and func_full -static int parse_func_pf(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_func_pf(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { m_func_save_t *s,*p; if(!dst) @@ -764,7 +764,7 @@ static int parse_func_pf(const m_option_t* opt,const char *name, char *param, vo return 1; } -static void copy_func_pf(const m_option_t* opt,void* dst, void* src) { +static void copy_func_pf(const m_option_t* opt,void* dst, const void* src) { m_func_save_t *d = NULL, *s,* last = NULL; if(!(dst && src)) return; @@ -790,7 +790,7 @@ static void copy_func_pf(const m_option_t* opt,void* dst, void* src) { /////////////////// Func_param -static void set_func_param(const m_option_t* opt, void* dst, void* src) { +static void set_func_param(const m_option_t* opt, void* dst, const void* src) { m_func_save_t* s; if(!src) return; @@ -819,7 +819,7 @@ const m_option_type_t m_option_type_func_param = { /////////////////// Func_full -static void set_func_full(const m_option_t* opt, void* dst, void* src) { +static void set_func_full(const m_option_t* opt, void* dst, const void* src) { m_func_save_t* s; if(!src) return; @@ -849,13 +849,13 @@ const m_option_type_t m_option_type_func_full = { #undef VAL #define VAL(x) (*(int*)(x)) -static int parse_func(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_func(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { if(dst) VAL(dst) += 1; return 0; } -static void set_func(const m_option_t* opt,void* dst, void* src) { +static void set_func(const m_option_t* opt,void* dst, const void* src) { int i; if(opt->priv) ((m_opt_default_func_t)opt->priv)(opt,opt->name); for(i = 0 ; i < VAL(src) ; i++) @@ -877,7 +877,7 @@ const m_option_type_t m_option_type_func = { /////////////////// Print -static int parse_print(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_print(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { if(opt->type == CONF_TYPE_PRINT_INDIRECT) mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", *(char **) opt->p); else if(opt->type == CONF_TYPE_PRINT_FUNC) @@ -934,7 +934,7 @@ const m_option_type_t m_option_type_print_func = { #undef VAL #define VAL(x) (*(char***)(x)) -static int parse_subconf(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_subconf(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { char *subparam; char *subopt; int nr = 0,i,r; @@ -1104,7 +1104,7 @@ static struct { { NULL, 0 } }; -static int parse_imgfmt(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_imgfmt(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { uint32_t fmt = 0; int i; @@ -1194,7 +1194,7 @@ static struct { { NULL, 0 } }; -static int parse_afmt(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_afmt(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { uint32_t fmt = 0; int i; @@ -1257,7 +1257,7 @@ static double parse_timestring(const char *str) } -static int parse_time(const m_option_t* opt,const char *name, char *param, void* dst, int src) +static int parse_time(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { double time; @@ -1292,7 +1292,7 @@ const m_option_type_t m_option_type_time = { // Time or size (-endpos) -static int parse_time_size(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +static int parse_time_size(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { m_time_size_t ts; char unit[4]; double end_at; @@ -1523,7 +1523,7 @@ static int get_obj_params(const char* opt_name, const char* name,char* params, } static int parse_obj_params(const m_option_t* opt,const char *name, - char *param, void* dst, int src) { + const char *param, void* dst, int src) { char** opts; int r; m_obj_params_t* p = opt->priv; @@ -1637,7 +1637,7 @@ static int parse_obj_settings(const char* opt,char* str,const m_obj_list_t* list static void free_obj_settings_list(void* dst); -static int obj_settings_list_del(const char *opt_name,char *param,void* dst, int src) { +static int obj_settings_list_del(const char *opt_name,const char *param,void* dst, int src) { char** str_list = NULL; int r,i,idx_max = 0; char* rem_id = "_removed_marker_"; @@ -1696,7 +1696,7 @@ static int obj_settings_list_del(const char *opt_name,char *param,void* dst, int } static int parse_obj_settings_list(const m_option_t* opt,const char *name, - char *param, void* dst, int src) { + const char *param, void* dst, int src) { int n = 0,r,len = strlen(opt->name); char *str; char *ptr, *last_ptr; @@ -1849,7 +1849,7 @@ static void free_obj_settings_list(void* dst) { VAL(dst) = NULL; } -static void copy_obj_settings_list(const m_option_t* opt,void* dst, void* src) { +static void copy_obj_settings_list(const m_option_t* opt,void* dst, const void* src) { m_obj_settings_t *d,*s; int n; @@ -1893,7 +1893,7 @@ const m_option_type_t m_option_type_obj_settings_list = { static int parse_obj_presets(const m_option_t* opt,const char *name, - char *param, void* dst, int src) { + const char *param, void* dst, int src) { m_obj_presets_t* obj_p = (m_obj_presets_t*)opt->priv; m_struct_t *in_desc,*out_desc; int s,i; @@ -1965,7 +1965,7 @@ const m_option_type_t m_option_type_obj_presets = { }; static int parse_custom_url(const m_option_t* opt,const char *name, - char *url, void* dst, int src) { + const char *url, void* dst, int src) { int pos1, pos2, r, v6addr = 0; char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL, *ptr4=NULL; m_struct_t* desc = opt->priv; diff --git a/m_option.h b/m_option.h index 3aa7ba930a..a70d8638d2 100644 --- a/m_option.h +++ b/m_option.h @@ -68,7 +68,7 @@ extern const m_option_type_t m_option_type_func; typedef void (*m_opt_default_func_t)(const m_option_t *, const char*); /// Callback used by m_option_type_func_full options. -typedef int (*m_opt_func_full_t)(const m_option_t *, const char *, char *); +typedef int (*m_opt_func_full_t)(const m_option_t *, const char *, const char *); /// Callback used by m_option_type_func_param options. typedef int (*m_opt_func_param_t)(const m_option_t *, const char *); @@ -198,9 +198,9 @@ extern const m_obj_params_t m_span_params_def; /// Option type description struct m_option_type { - char* name; + const char* name; /// Syntax description, etc - char* comments; + const char* comments; /// Size needed for the data. unsigned int size; /// See \ref OptionTypeFlags. @@ -218,7 +218,7 @@ struct m_option_type { * \return On error a negative value is returned, on success the number of arguments * consumed. For details see \ref OptionParserReturn. */ - int (*parse)(const m_option_t* opt,const char *name, char *param, void* dst, int src); + int (*parse)(const m_option_t* opt,const char *name, const char *param, void* dst, int src); /// Print back a value in string form. /** \param opt The option to print. @@ -241,21 +241,21 @@ struct m_option_type { * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*save)(const m_option_t* opt,void* dst, void* src); + void (*save)(const m_option_t* opt,void* dst, const void* src); /// Set the value in the program (dst) from a save slot. /** \param opt The option to copy. * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*set)(const m_option_t* opt,void* dst, void* src); + void (*set)(const m_option_t* opt,void* dst, const void* src); /// Copy the data between two save slots. If NULL and size is > 0 a memcpy will be used. /** \param opt The option to copy. * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*copy)(const m_option_t* opt,void* dst, void* src); + void (*copy)(const m_option_t* opt,void* dst, const void* src); //@} /// Free the data allocated for a save slot. @@ -483,7 +483,7 @@ const m_option_t* m_option_list_find(const m_option_t* list,const char* name); /// Helper to parse options, see \ref m_option_type::parse. inline static int -m_option_parse(const m_option_t* opt,const char *name, char *param, void* dst, int src) { +m_option_parse(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { return opt->type->parse(opt,name,param,dst,src); } @@ -498,21 +498,21 @@ m_option_print(const m_option_t* opt, const void* val_ptr) { /// Helper around \ref m_option_type::save. inline static void -m_option_save(const m_option_t* opt,void* dst, void* src) { +m_option_save(const m_option_t* opt,void* dst, const void* src) { if(opt->type->save) opt->type->save(opt,dst,src); } /// Helper around \ref m_option_type::set. inline static void -m_option_set(const m_option_t* opt,void* dst, void* src) { +m_option_set(const m_option_t* opt,void* dst, const void* src) { if(opt->type->set) opt->type->set(opt,dst,src); } /// Helper around \ref m_option_type::copy. inline static void -m_option_copy(const m_option_t* opt,void* dst, void* src) { +m_option_copy(const m_option_t* opt,void* dst, const void* src) { if(opt->type->copy) opt->type->copy(opt,dst,src); else if(opt->type->size > 0) diff --git a/m_struct.c b/m_struct.c index 8accb4080f..7813340e42 100644 --- a/m_struct.c +++ b/m_struct.c @@ -68,7 +68,7 @@ m_struct_alloc(const m_struct_t* st) { } int -m_struct_set(const m_struct_t* st, void* obj, char* field, char* param) { +m_struct_set(const m_struct_t* st, void* obj, const char* field, const char* param) { const m_option_t* f = m_struct_get_field(st,field); if(!f) { diff --git a/m_struct.h b/m_struct.h index 220fa3a672..bcf09dc86f 100644 --- a/m_struct.h +++ b/m_struct.h @@ -88,7 +88,7 @@ m_struct_alloc(const m_struct_t* st); * \return 0 on error, 1 on success. */ int -m_struct_set(const m_struct_t* st, void* obj, char* field, char* param); +m_struct_set(const m_struct_t* st, void* obj, const char* field, const char* param); /// Reset a field (or all if field == NULL) to defaults. /** \param st Struct definition. From 136c046e06cd5c614aafcef111040c6e8e6dd373 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 25 Feb 2010 22:44:02 +0000 Subject: [PATCH 04/14] Add cast to proper type. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30738 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_ogg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpdemux/demux_ogg.c b/libmpdemux/demux_ogg.c index dd8f5e9aab..dabac757d9 100644 --- a/libmpdemux/demux_ogg.c +++ b/libmpdemux/demux_ogg.c @@ -1251,7 +1251,7 @@ demuxer_t* init_avi_with_ogg(demuxer_t* demuxer) { demux_packet_t *dp; sh_audio_t *sh_audio = demuxer->audio->sh; int np; - uint8_t *extradata = sh_audio->wf + 1; + uint8_t *extradata = (uint8_t *)(sh_audio->wf + 1); int i; unsigned char *p = NULL,*buf; int plen; From 72d18a204fa7cd3b2ed92edcb54cb5190b40dfc1 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 25 Feb 2010 22:47:04 +0000 Subject: [PATCH 05/14] Mark stream open filename parameter as const, the filename string is not modified by these functions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30739 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/open.c | 2 +- stream/stream.c | 6 +++--- stream/stream.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stream/open.c b/stream/open.c index c207516184..2fa4c9fc99 100644 --- a/stream/open.c +++ b/stream/open.c @@ -47,7 +47,7 @@ int dvd_title=0; // Open a new stream (stdin/file/vcd/url) -stream_t* open_stream(char* filename,char** options, int* file_format){ +stream_t* open_stream(const char* filename,char** options, int* file_format){ // Check if playlist or unknown if (*file_format != DEMUXER_TYPE_PLAYLIST){ *file_format=DEMUXER_TYPE_UNKNOWN; diff --git a/stream/stream.c b/stream/stream.c index bcd1f907c3..daecc09d2c 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -140,7 +140,7 @@ static const stream_info_t* const auto_open_streams[] = { NULL }; -static stream_t* open_stream_plugin(const stream_info_t* sinfo, char* filename, +static stream_t* open_stream_plugin(const stream_info_t* sinfo, const char* filename, int mode, char** options, int* file_format, int* ret, char** redirected_url) { @@ -208,7 +208,7 @@ static stream_t* open_stream_plugin(const stream_info_t* sinfo, char* filename, } -stream_t* open_stream_full(char* filename,int mode, char** options, int* file_format) { +stream_t* open_stream_full(const char* filename,int mode, char** options, int* file_format) { int i,j,l,r; const stream_info_t* sinfo; stream_t* s; @@ -250,7 +250,7 @@ stream_t* open_stream_full(char* filename,int mode, char** options, int* file_fo return NULL; } -stream_t* open_output_stream(char* filename,char** options) { +stream_t* open_output_stream(const char* filename, char** options) { int file_format; //unused if(!filename) { mp_msg(MSGT_OPEN,MSGL_ERR,"open_output_stream(), NULL filename, report this bug\n"); diff --git a/stream/stream.h b/stream/stream.h index fa12186696..f1a3667343 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -339,9 +339,9 @@ int stream_control(stream_t *s, int cmd, void *arg); stream_t* new_stream(int fd,int type); void free_stream(stream_t *s); stream_t* new_memory_stream(unsigned char* data,int len); -stream_t* open_stream(char* filename,char** options,int* file_format); -stream_t* open_stream_full(char* filename,int mode, char** options, int* file_format); -stream_t* open_output_stream(char* filename,char** options); +stream_t* open_stream(const char* filename,char** options,int* file_format); +stream_t* open_stream_full(const char* filename,int mode, char** options, int* file_format); +stream_t* open_output_stream(const char* filename,char** options); /// Set the callback to be used by libstream to check for user /// interruption during long blocking operations (cache filling, etc). void stream_set_interrupt_callback(int (*cb)(int)); From 2b7b000b80a52b2ea9825e655ac7226dc0351acf Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 25 Feb 2010 22:51:23 +0000 Subject: [PATCH 06/14] Add const to ass_read_stream fname argument, the string is not modified. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30740 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass_mp.c | 2 +- libass/ass_mp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libass/ass_mp.c b/libass/ass_mp.c index 77d1538aa9..2da7cbca03 100644 --- a/libass/ass_mp.c +++ b/libass/ass_mp.c @@ -218,7 +218,7 @@ ass_track_t* ass_read_subdata(ass_library_t* library, sub_data* subdata, double return track; } -ass_track_t* ass_read_stream(ass_library_t* library, char *fname, char *charset) { +ass_track_t* ass_read_stream(ass_library_t* library, const char *fname, char *charset) { int i; char *buf = NULL; ass_track_t *track; diff --git a/libass/ass_mp.h b/libass/ass_mp.h index 5d81b55e4f..2ae62ff040 100644 --- a/libass/ass_mp.h +++ b/libass/ass_mp.h @@ -59,7 +59,7 @@ extern int ass_hinting; ass_track_t* ass_default_track(ass_library_t* library); int ass_process_subtitle(ass_track_t* track, subtitle* sub); ass_track_t* ass_read_subdata(ass_library_t* library, sub_data* subdata, double fps); -ass_track_t* ass_read_stream(ass_library_t* library, char *fname, char *charset); +ass_track_t* ass_read_stream(ass_library_t* library, const char *fname, char *charset); void ass_configure(ass_renderer_t* priv, int w, int h, int hinting); void ass_configure_fonts(ass_renderer_t* priv); From e3e75ca06668778d014e539085032a44d1fe518c Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 25 Feb 2010 22:53:04 +0000 Subject: [PATCH 07/14] Reorder vos: prioritize -vo gl above -vo x11 and -vo matrixview down with aa, caca etc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30741 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/video_out.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libvo/video_out.c b/libvo/video_out.c index 0d2dc713e5..b285458c87 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -186,17 +186,16 @@ const vo_functions_t* const video_out_drivers[] = #ifdef CONFIG_XV &video_out_xv, #endif +#ifdef CONFIG_GL + &video_out_gl, +#endif #ifdef CONFIG_X11 &video_out_x11, &video_out_xover, #endif #ifdef CONFIG_GL - &video_out_gl, &video_out_gl2, #endif -#ifdef CONFIG_MATRIXVIEW - &video_out_matrixview, -#endif #ifdef CONFIG_DGA &video_out_dga, #endif @@ -213,6 +212,9 @@ const vo_functions_t* const video_out_drivers[] = #ifdef CONFIG_SVGALIB &video_out_svga, #endif +#ifdef CONFIG_MATRIXVIEW + &video_out_matrixview, +#endif #ifdef CONFIG_AA &video_out_aa, #endif From b3d891ebd7d99f858506c5d2120bc2fd81fbe2ba Mon Sep 17 00:00:00 2001 From: jrash Date: Fri, 26 Feb 2010 11:15:56 +0000 Subject: [PATCH 08/14] sync with en/mplayer.1 rev. 30677 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30742 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/zh_CN/mplayer.1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DOCS/man/zh_CN/mplayer.1 b/DOCS/man/zh_CN/mplayer.1 index ed9178a45a..4ea42df5d6 100644 --- a/DOCS/man/zh_CN/mplayer.1 +++ b/DOCS/man/zh_CN/mplayer.1 @@ -1,4 +1,4 @@ -.\" sync with en/mplayer.1 rev. 30611 +.\" sync with en/mplayer.1 rev. 30677 .\" Encoding: UTF-8 .\" Reminder of hard terms which need better/final solution later: .\" /capture; playtree in parent list; colorkey; retrace; desync; downmix; @@ -1446,6 +1446,9 @@ MPlayer 不阻止你装载产生于不同 AVI 的索引文件, .TP .B \-mc <每帧秒数> 每帧的最大 A-V 同步修正(以秒为单位)。 +.br +对于 mencoder,\-mc 0 应当总是与 \-noskip 一同使用,否则几乎必然导致音视频 +不同步。 . .TP .B \-mf <选项1:选项2:...> From fad137d7fe3bfef6a258518a1e86a4d811d3b4b5 Mon Sep 17 00:00:00 2001 From: attila Date: Fri, 26 Feb 2010 12:49:49 +0000 Subject: [PATCH 09/14] mention that on windows, you've to use the netstream.exe to build the netstream binary git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30743 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/README | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TOOLS/README b/TOOLS/README index 37a7a03afd..eaa75bf0de 100644 --- a/TOOLS/README +++ b/TOOLS/README @@ -542,10 +542,11 @@ are not usable remotely because they are implemented at the demuxer level. Be aware that currently the server is not secure at all. -Compile the server by running 'make TOOLS/netstream' from the root of mplayer -source and then copy the netstream binary to the right place on your system -(usually /usr/local/bin on Unix). Start the netstream server on the computer you -intend to access remotely. There are no command line arguments. +Compile the server by running 'make TOOLS/netstream' ('make TOOLS/netstream.exe' +on windows) from the root of mplayer source and then copy the netstream binary +to the right place on your system (usually /usr/local/bin on Unix). Start the +netstream server on the computer you intend to access remotely. There are no +command line arguments. Play the second track of a VCD on the server with: From b63759b175cf9ddd9735ca0d2f803fe62f69c3c3 Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 26 Feb 2010 15:01:37 +0000 Subject: [PATCH 10/14] Do not cast the results of malloc/calloc/realloc. These functions return void*, which is compatible with any pointer, so there is no need for casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30744 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/bmovl-test.c | 2 +- TOOLS/vfw2menc.c | 4 ++-- asxparser.c | 10 +++++----- gui/win32/dialogs.c | 2 +- gui/win32/widgetrender.c | 2 +- libao2/ao_coreaudio.c | 10 +++++----- libmenu/menu_filesel.c | 14 +++++++------- libmpcodecs/ad_libmad.c | 2 +- libmpcodecs/ae.c | 2 +- libmpcodecs/ae_toolame.c | 2 +- libmpcodecs/mp_image.h | 2 +- libmpcodecs/vd_mpng.c | 2 +- libmpcodecs/vd_mtga.c | 2 +- libmpcodecs/vd_sgi.c | 2 +- libmpcodecs/ve_vfw.c | 2 +- libmpcodecs/vf_eq2.c | 6 +++--- libmpdemux/demux_aac.c | 2 +- libmpdemux/demux_roq.c | 4 ++-- libmpdemux/demux_ts.c | 10 +++++----- libmpdemux/demuxer.c | 3 +-- libmpdemux/demuxer.h | 8 ++++---- libmpdemux/ebml.c | 2 +- libmpdemux/muxer_lavf.c | 2 +- libmpdemux/muxer_mpeg.c | 18 +++++++++--------- libmpdemux/video.c | 2 +- libvo/sub.c | 12 ++++++------ libvo/video_out.c | 2 +- libvo/vo_fbdev2.c | 2 +- loader/dmo/buffer.c | 4 ++-- loader/dmo/dmo.c | 2 +- loader/drv.c | 4 ++-- loader/dshow/allocator.c | 6 +++--- loader/dshow/cmediasample.c | 8 ++++---- loader/dshow/inputpin.c | 24 ++++++++++++------------ loader/elfdll.c | 6 +++--- loader/ext.c | 14 +++++++------- loader/ldt_keeper.c | 2 +- loader/module.c | 6 +++--- loader/registry.c | 2 +- loader/win32.c | 4 ++-- m_option.c | 2 +- mp3lib/equalizer.c | 2 +- osdep/mmap-os2.c | 2 +- playtree.c | 12 ++++++------ playtreeparser.c | 10 +++++----- stream/http.c | 6 +++--- stream/stream_netstream.h | 3 +-- stream/tvi_def.h | 4 ++-- stream/tvi_dshow.c | 21 ++++++++++----------- subreader.c | 4 ++-- 50 files changed, 139 insertions(+), 142 deletions(-) diff --git a/TOOLS/bmovl-test.c b/TOOLS/bmovl-test.c index b6d0f55022..04c1e7dd71 100644 --- a/TOOLS/bmovl-test.c +++ b/TOOLS/bmovl-test.c @@ -104,7 +104,7 @@ int main(int argc, char **argv) { blit(fifo, image->pixels, image->w, image->h, i, i, 0, 1); // Create a 75x75 bitmap - bitmap = (unsigned char*)malloc(75*75*4); + bitmap = malloc(75 * 75 * 4); // Paint bitmap red, 50% transparent and blit at position 50,50 paint(bitmap, (75*75*4), 255, 0, 0, 128); diff --git a/TOOLS/vfw2menc.c b/TOOLS/vfw2menc.c index b15b773a05..bdeb960351 100644 --- a/TOOLS/vfw2menc.c +++ b/TOOLS/vfw2menc.c @@ -72,7 +72,7 @@ static int save_settings(HDRVR hDriver, const char *filename) return -1; } - pv = (char *) malloc(cb); + pv = malloc(cb); if (SendDriverMessage(hDriver, ICM_GETSTATE, (LPARAM) pv, (LPARAM) &cb) != ICERR_OK) { printf("ICM_GETSTATE failed\n"); @@ -112,7 +112,7 @@ static int load_settings(HDRVR hDriver, const char *filename) return -1; } - pv = (char *) malloc(info.st_size); + pv = malloc(info.st_size); fd = fopen(filename, "rb"); if (!fd) diff --git a/asxparser.c b/asxparser.c index 931482e339..9ea11435ae 100644 --- a/asxparser.c +++ b/asxparser.c @@ -44,7 +44,7 @@ asx_list_add(void* list_ptr,void* entry){ if(list != NULL) for( ; list[c] != NULL; c++) ; - list = (void*)realloc(list,sizeof(void*)*(c+2)); + list = realloc(list, sizeof(void*) * (c + 2)); list[c] = entry; list[c+1] = NULL; @@ -77,7 +77,7 @@ asx_list_remove(void* list_ptr,void* entry,ASX_FreeFunc free_func) { if(c > e) // If c==e the memmove is not needed memmove(list+e,list+e+1,(c-e)*sizeof(void*)); - list = (void*)realloc(list,(c-1)*sizeof(void*)); + list = realloc(list, (c - 1) * sizeof(void*)); list[c-1] = NULL; *(void***)list_ptr = list; @@ -186,7 +186,7 @@ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs) { val[ptr2-ptr1] = '\0'; n_attrib++; - attribs = (char**)realloc(attribs,(2*n_attrib+1)*sizeof(char*)); + attribs = realloc(attribs, (2 * n_attrib + 1) * sizeof(char*)); attribs[n_attrib*2-2] = attrib; attribs[n_attrib*2-1] = val; @@ -241,7 +241,7 @@ asx_get_element(ASX_Parser_t* parser,char** _buffer, memmove(parser->ret_stack,parser->ret_stack+i, (parser->ret_stack_size - i)*sizeof(ASX_LineSave_t)); parser->ret_stack_size -= i; if(parser->ret_stack_size > 0) - parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); + parser->ret_stack = realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); else { free(parser->ret_stack); parser->ret_stack = NULL; @@ -422,7 +422,7 @@ asx_get_element(ASX_Parser_t* parser,char** _buffer, parser->last_body = body; parser->ret_stack_size++; - parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); + parser->ret_stack = realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); if(parser->ret_stack_size > 1) memmove(parser->ret_stack+1,parser->ret_stack,(parser->ret_stack_size-1)*sizeof(ASX_LineSave_t)); parser->ret_stack[0].buffer = ret; diff --git a/gui/win32/dialogs.c b/gui/win32/dialogs.c index 60a8d8c759..edd63d570c 100644 --- a/gui/win32/dialogs.c +++ b/gui/win32/dialogs.c @@ -715,7 +715,7 @@ static LRESULT CALLBACK SkinBrowserWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, { if (guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void *) guiSetStop); if (skinName) free(skinName); - skinName = (char *) malloc(len+1); + skinName = malloc(len + 1); SendMessage(listbox, LB_GETTEXT, (WPARAM) index, (LPARAM) skinName); /* fill out the full pathname to the skin */ strcpy(skinspath, get_path("skins")); diff --git a/gui/win32/widgetrender.c b/gui/win32/widgetrender.c index 0ac2e730ea..4dcd105b8b 100644 --- a/gui/win32/widgetrender.c +++ b/gui/win32/widgetrender.c @@ -185,7 +185,7 @@ static char *generatetextfromlabel(widget *item) /* cuts text to buflen scrolling from right to left */ static void scrolltext(char *text, unsigned int buflen, float *value) { - char *buffer = (char *) malloc(buflen + 1); + char *buffer = malloc(buflen + 1); unsigned int x,i; if(*value < buflen) x = 0; else x = *value - buflen; diff --git a/libao2/ao_coreaudio.c b/libao2/ao_coreaudio.c index 36456f3cc6..dffab4dd2e 100644 --- a/libao2/ao_coreaudio.c +++ b/libao2/ao_coreaudio.c @@ -291,7 +291,7 @@ int b_alive; } /* Retrieve the name of the device. */ - psz_name = (char *)malloc(i_param_size); + psz_name = malloc(i_param_size); err = AudioDeviceGetProperty(devid_def, 0, 0, kAudioDevicePropertyDeviceName, &i_param_size, psz_name); @@ -513,7 +513,7 @@ static int OpenSPDIF(void) } i_streams = i_param_size / sizeof(AudioStreamID); - p_streams = (AudioStreamID *)malloc(i_param_size); + p_streams = malloc(i_param_size); if (p_streams == NULL) { ao_msg(MSGT_AO, MSGL_WARN, "out of memory\n" ); @@ -549,7 +549,7 @@ static int OpenSPDIF(void) } i_formats = i_param_size / sizeof(AudioStreamBasicDescription); - p_format_list = (AudioStreamBasicDescription *)malloc(i_param_size); + p_format_list = malloc(i_param_size); if (p_format_list == NULL) { ao_msg(MSGT_AO, MSGL_WARN, "could not malloc the memory\n" ); @@ -742,7 +742,7 @@ static int AudioDeviceSupportsDigital( AudioDeviceID i_dev_id ) } i_streams = i_param_size / sizeof(AudioStreamID); - p_streams = (AudioStreamID *)malloc(i_param_size); + p_streams = malloc(i_param_size); if (p_streams == NULL) { ao_msg(MSGT_AO,MSGL_V, "out of memory\n"); @@ -791,7 +791,7 @@ static int AudioStreamSupportsDigital( AudioStreamID i_stream_id ) } i_formats = i_param_size / sizeof(AudioStreamBasicDescription); - p_format_list = (AudioStreamBasicDescription *)malloc(i_param_size); + p_format_list = malloc(i_param_size); if (p_format_list == NULL) { ao_msg(MSGT_AO,MSGL_V, "could not malloc the memory\n" ); diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c index e6978d7fc2..06f6089806 100644 --- a/libmenu/menu_filesel.c +++ b/libmenu/menu_filesel.c @@ -193,7 +193,7 @@ static char **get_extensions(menu_t *menu){ if(!fp) return NULL; - extensions = (char **) malloc(sizeof(*extensions)); + extensions = malloc(sizeof(*extensions)); *extensions = NULL; while(fgets(ext,sizeof(ext),fp)) { @@ -204,9 +204,9 @@ static char **get_extensions(menu_t *menu){ ext[s-1] = '\0'; s--; } - e = (char *) malloc(s+1); - extensions = (char **) realloc(extensions, ++n * sizeof(*extensions)); - extensions = (char **) realloc(extensions, ++n * sizeof(*extensions)); + e = malloc(s+1); + extensions = realloc(extensions, ++n * sizeof(*extensions)); + extensions = realloc(extensions, ++n * sizeof(*extensions)); strcpy (e, ext); for (l=extensions; *l; l++); *l++ = e; @@ -262,7 +262,7 @@ static int open_dir(menu_t* menu,char* args) { } } - namelist = (char **) malloc(sizeof(char *)); + namelist = malloc(sizeof(char *)); extensions = get_extensions(menu); n=0; @@ -290,7 +290,7 @@ static int open_dir(menu_t* menu,char* args) { continue; } if(n%20 == 0){ // Get some more mem - if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *))) + if((tp = realloc(namelist, (n+20) * sizeof (char *))) == NULL) { mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno)); n--; @@ -299,7 +299,7 @@ static int open_dir(menu_t* menu,char* args) { namelist=tp; } - namelist[n] = (char *) malloc(strlen(dp->d_name) + 2); + namelist[n] = malloc(strlen(dp->d_name) + 2); if(namelist[n] == NULL){ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno)); n--; diff --git a/libmpcodecs/ad_libmad.c b/libmpcodecs/ad_libmad.c index 21fc25fac7..103a05f4a9 100644 --- a/libmpcodecs/ad_libmad.c +++ b/libmpcodecs/ad_libmad.c @@ -52,7 +52,7 @@ typedef struct mad_decoder_s { static int preinit(sh_audio_t *sh){ - mad_decoder_t *this = (mad_decoder_t *) malloc(sizeof(mad_decoder_t)); + mad_decoder_t *this = malloc(sizeof(mad_decoder_t)); memset(this,0,sizeof(mad_decoder_t)); sh->context = this; diff --git a/libmpcodecs/ae.c b/libmpcodecs/ae.c index acf16319a9..1669359981 100644 --- a/libmpcodecs/ae.c +++ b/libmpcodecs/ae.c @@ -59,7 +59,7 @@ audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params if(! params) return NULL; - encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t)); + encoder = calloc(1, sizeof(audio_encoder_t)); memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); encoder->stream = stream; diff --git a/libmpcodecs/ae_toolame.c b/libmpcodecs/ae_toolame.c index 7e64b2a41f..2a0e9f7941 100644 --- a/libmpcodecs/ae_toolame.c +++ b/libmpcodecs/ae_toolame.c @@ -165,7 +165,7 @@ int mpae_init_toolame(audio_encoder_t *encoder) else mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_toolame, Toolame can't encode > 2 channels, exiting\n"); - ctx = (mpae_toolame_ctx *) calloc(1, sizeof(mpae_toolame_ctx)); + ctx = calloc(1, sizeof(mpae_toolame_ctx)); if(ctx == NULL) { mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_toolame, couldn't alloc a %d bytes context, exiting\n", sizeof(mpae_toolame_ctx)); diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h index ba69e720ef..65b155e037 100644 --- a/libmpcodecs/mp_image.h +++ b/libmpcodecs/mp_image.h @@ -209,7 +209,7 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ #endif static inline mp_image_t* new_mp_image(int w,int h){ - mp_image_t* mpi=(mp_image_t*)malloc(sizeof(mp_image_t)); + mp_image_t* mpi = malloc(sizeof(mp_image_t)); if(!mpi) return NULL; // error! memset(mpi,0,sizeof(mp_image_t)); mpi->width=mpi->w=w; diff --git a/libmpcodecs/vd_mpng.c b/libmpcodecs/vd_mpng.c index 919364742e..13dcfdbf78 100644 --- a/libmpcodecs/vd_mpng.c +++ b/libmpcodecs/vd_mpng.c @@ -162,7 +162,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ if (out_fmt==IMGFMT_BGR8) { png_get_PLTE( png,info,&pal,&cols ); - mpi->planes[1] = (char*)realloc(mpi->planes[1], 4*cols); + mpi->planes[1] = realloc(mpi->planes[1], 4*cols); p = mpi->planes[1]; for (i = 0; i < cols; i++) { *p++ = pal[i].blue; diff --git a/libmpcodecs/vd_mtga.c b/libmpcodecs/vd_mtga.c index f6eee54cbe..310d6e2702 100644 --- a/libmpcodecs/vd_mtga.c +++ b/libmpcodecs/vd_mtga.c @@ -92,7 +92,7 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...) /* init driver */ static int init(sh_video_t *sh) { - sh->context = (TGAInfo *) calloc(1, sizeof(TGAInfo)); + sh->context = calloc(1, sizeof(TGAInfo)); last_w = -1; return 1; diff --git a/libmpcodecs/vd_sgi.c b/libmpcodecs/vd_sgi.c index 07dd8ff60d..e951542a8b 100644 --- a/libmpcodecs/vd_sgi.c +++ b/libmpcodecs/vd_sgi.c @@ -84,7 +84,7 @@ control(sh_video_t* sh, int cmd, void *arg, ...) static int init(sh_video_t *sh) { - sh->context = (SGIInfo *) calloc(1, sizeof(SGIInfo)); + sh->context = calloc(1, sizeof(SGIInfo)); last_x = -1; return 1; diff --git a/libmpcodecs/ve_vfw.c b/libmpcodecs/ve_vfw.c index c43d389ba9..27c5c83d80 100644 --- a/libmpcodecs/ve_vfw.c +++ b/libmpcodecs/ve_vfw.c @@ -139,7 +139,7 @@ mp_msg(MSGT_WIN32,MSGL_INFO,"\n"); mp_msg(MSGT_WIN32,MSGL_ERR,"Cannot open Compressor data file!\n"); return NULL; } - drvdata = (char *) malloc(st.st_size); + drvdata = malloc(st.st_size); if (fread(drvdata, st.st_size, 1, fd) != 1) { mp_msg(MSGT_WIN32,MSGL_ERR,"Cannot read Compressor data file!\n"); fclose(fd); diff --git a/libmpcodecs/vf_eq2.c b/libmpcodecs/vf_eq2.c index 099acc85a0..fe4a89fb13 100644 --- a/libmpcodecs/vf_eq2.c +++ b/libmpcodecs/vf_eq2.c @@ -255,11 +255,11 @@ int put_image (vf_instance_t *vf, mp_image_t *src, double pts) img_n = eq2->buf_w[0]*eq2->buf_h[0]; if(src->num_planes>1){ img_c = eq2->buf_w[1]*eq2->buf_h[1]; - eq2->buf[0] = (unsigned char *) realloc (eq2->buf[0], img_n + 2*img_c); + eq2->buf[0] = realloc (eq2->buf[0], img_n + 2*img_c); eq2->buf[1] = eq2->buf[0] + img_n; eq2->buf[2] = eq2->buf[1] + img_c; } else - eq2->buf[0] = (unsigned char *) realloc (eq2->buf[0], img_n); + eq2->buf[0] = realloc (eq2->buf[0], img_n); } dst = vf_get_image (vf->next, src->imgfmt, MP_IMGTYPE_EXPORT, 0, src->w, src->h); @@ -457,7 +457,7 @@ int vf_open(vf_instance_t *vf, char *args) vf->put_image = put_image; vf->uninit = uninit; - vf->priv = (vf_eq2_t *) malloc (sizeof (vf_eq2_t)); + vf->priv = malloc (sizeof (vf_eq2_t)); eq2 = vf->priv; for (i = 0; i < 3; i++) { diff --git a/libmpdemux/demux_aac.c b/libmpdemux/demux_aac.c index cfbedfc8c1..54493fb466 100644 --- a/libmpdemux/demux_aac.c +++ b/libmpdemux/demux_aac.c @@ -47,7 +47,7 @@ static int demux_aac_init(demuxer_t *demuxer) if(!priv) return 0; - priv->buf = (uint8_t*) malloc(8); + priv->buf = malloc(8); if(!priv->buf) { free(priv); diff --git a/libmpdemux/demux_roq.c b/libmpdemux/demux_roq.c index 5c13d9739a..e51fab6717 100644 --- a/libmpdemux/demux_roq.c +++ b/libmpdemux/demux_roq.c @@ -191,7 +191,7 @@ static demuxer_t* demux_open_roq(demuxer_t* demuxer) } // index the chunk - roq_data->chunks = (roq_chunk_t *)realloc(roq_data->chunks, + roq_data->chunks = realloc(roq_data->chunks, (roq_data->total_chunks + 1) * sizeof (roq_chunk_t)); roq_data->chunks[roq_data->total_chunks].chunk_type = CHUNK_TYPE_AUDIO; roq_data->chunks[roq_data->total_chunks].chunk_offset = @@ -214,7 +214,7 @@ static demuxer_t* demux_open_roq(demuxer_t* demuxer) { // index a new chunk if it's a codebook or quad VQ not following a // codebook - roq_data->chunks = (roq_chunk_t *)realloc(roq_data->chunks, + roq_data->chunks = realloc(roq_data->chunks, (roq_data->total_chunks + 1) * sizeof (roq_chunk_t)); roq_data->chunks[roq_data->total_chunks].chunk_type = CHUNK_TYPE_VIDEO; roq_data->chunks[roq_data->total_chunks].chunk_offset = diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c index d27ae76596..0a79dcded5 100644 --- a/libmpdemux/demux_ts.c +++ b/libmpdemux/demux_ts.c @@ -320,7 +320,7 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es) if(es->extradata && es->extradata_len) { - sh->wf = (WAVEFORMATEX *) malloc(sizeof (WAVEFORMATEX) + es->extradata_len); + sh->wf = malloc(sizeof (WAVEFORMATEX) + es->extradata_len); sh->wf->cbSize = es->extradata_len; memcpy(sh->wf + 1, es->extradata, es->extradata_len); } @@ -344,7 +344,7 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es) if(sh->format == VIDEO_AVC && es->extradata && es->extradata_len) { int w = 0, h = 0; - sh->bih = (BITMAPINFOHEADER *) calloc(1, sizeof(BITMAPINFOHEADER) + es->extradata_len); + sh->bih = calloc(1, sizeof(BITMAPINFOHEADER) + es->extradata_len); sh->bih->biSize= sizeof(BITMAPINFOHEADER) + es->extradata_len; sh->bih->biCompression = sh->format; memcpy(sh->bih + 1, es->extradata, es->extradata_len); @@ -680,7 +680,7 @@ static off_t ts_detect_streams(demuxer_t *demuxer, tsdemux_init_t *param) pptr = &pes_priv1[es.pid]; if(pptr->pos < 64*1024) { - tmpbuf = (char*) realloc(pptr->buf, pptr->pos + es.size); + tmpbuf = realloc(pptr->buf, pptr->pos + es.size); if(tmpbuf != NULL) { pptr->buf = tmpbuf; @@ -1678,7 +1678,7 @@ static int collect_section(ts_section_t *section, int is_start, unsigned char *b { if(! section->buffer) { - section->buffer = (uint8_t*) malloc(4096+256); + section->buffer = malloc(4096 + 256); if(section->buffer == NULL) return 0; } @@ -2697,7 +2697,7 @@ static int fill_extradata(mp4_decoder_config_t * mp4_dec, ES_stream_t *tss) if(mp4_dec->buf_size > tss->extradata_alloc) { - tmp = (uint8_t *) realloc(tss->extradata, mp4_dec->buf_size); + tmp = realloc(tss->extradata, mp4_dec->buf_size); if(!tmp) return 0; tss->extradata = tmp; diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 9935a4a896..0553429790 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -1306,8 +1306,7 @@ int demux_info_add(demuxer_t *demuxer, const char *opt, const char *param) } } - info = demuxer->info = (char **) realloc(info, - (2 * (n + 2)) * sizeof(char *)); + info = demuxer->info = realloc(info, (2 * (n + 2)) * sizeof(char *)); info[2 * n] = strdup(opt); info[2 * n + 1] = strdup(param); memset(&info[2 * (n + 1)], 0, 2 * sizeof(char *)); diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index 699e5a56b9..4be7e5a5a0 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -261,7 +261,7 @@ typedef struct { } demux_program_t; static inline demux_packet_t* new_demux_packet(int len){ - demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t)); + demux_packet_t* dp = malloc(sizeof(demux_packet_t)); dp->len=len; dp->next=NULL; dp->pts=MP_NOPTS_VALUE; @@ -272,7 +272,7 @@ static inline demux_packet_t* new_demux_packet(int len){ dp->refcount=1; dp->master=NULL; dp->buffer=NULL; - if (len > 0 && (dp->buffer = (unsigned char *)malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) + if (len > 0 && (dp->buffer = malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) memset(dp->buffer + len, 0, 8); else dp->len = 0; @@ -283,7 +283,7 @@ static inline void resize_demux_packet(demux_packet_t* dp, int len) { if(len > 0) { - dp->buffer=(unsigned char *)realloc(dp->buffer,len+8); + dp->buffer = realloc(dp->buffer, len + 8); } else { @@ -298,7 +298,7 @@ static inline void resize_demux_packet(demux_packet_t* dp, int len) } static inline demux_packet_t* clone_demux_packet(demux_packet_t* pack){ - demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t)); + demux_packet_t* dp = malloc(sizeof(demux_packet_t)); while(pack->master) pack=pack->master; // find the master memcpy(dp,pack,sizeof(demux_packet_t)); dp->next=NULL; diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c index a007bd4ad4..d22314fa8d 100644 --- a/libmpdemux/ebml.c +++ b/libmpdemux/ebml.c @@ -230,7 +230,7 @@ ebml_read_ascii (stream_t *s, uint64_t *length) if (length) *length = len + l; - str = (char *) malloc (len+1); + str = malloc (len + 1); if (stream_read(s, str, len) != (int) len) { free (str); diff --git a/libmpdemux/muxer_lavf.c b/libmpdemux/muxer_lavf.c index f531423979..90367f4258 100644 --- a/libmpdemux/muxer_lavf.c +++ b/libmpdemux/muxer_lavf.c @@ -340,7 +340,7 @@ int muxer_init_muxer_lavf(muxer_t *muxer) "will play these INCORRECT files as if nothing were wrong!\n" "*******************************************************************************\n"); - priv = (muxer_priv_t *) calloc(1, sizeof(muxer_priv_t)); + priv = calloc(1, sizeof(muxer_priv_t)); if(priv == NULL) return 0; diff --git a/libmpdemux/muxer_mpeg.c b/libmpdemux/muxer_mpeg.c index 27f360d00d..817361ad7a 100644 --- a/libmpdemux/muxer_mpeg.c +++ b/libmpdemux/muxer_mpeg.c @@ -339,13 +339,13 @@ static mpeg_frame_t *init_frames(uint16_t num, size_t size) mpeg_frame_t *tmp; uint16_t i; - tmp = (mpeg_frame_t *) calloc(num, sizeof(mpeg_frame_t)); + tmp = calloc(num, sizeof(mpeg_frame_t)); if(tmp == NULL) return NULL; for(i=0; i < num; i++) { - tmp[i].buffer = (uint8_t *) calloc(1, size); + tmp[i].buffer = calloc(1, size); if(tmp[i].buffer == NULL) return NULL; tmp[i].size = 0; @@ -386,14 +386,14 @@ static muxer_stream_t* mpegfile_new_stream(muxer_t *muxer,int type){ mp_msg(MSGT_MUXER, MSGL_ERR, "Unknown stream type!\n"); return NULL; } - s = (muxer_stream_t*) calloc(1, sizeof(muxer_stream_t)); + s = calloc(1, sizeof(muxer_stream_t)); if(!s) return NULL; // no mem!? if (!(s->b_buffer = malloc(priv->packet_size))) goto init_fail; s->b_buffer_size = priv->packet_size; s->b_buffer_ptr = 0; s->b_buffer_len = 0; - s->priv = (muxer_headers_t*) calloc(1, sizeof(muxer_headers_t)); + s->priv = calloc(1, sizeof(muxer_headers_t)); if(s->priv == NULL) goto init_fail; spriv = (muxer_headers_t *) s->priv; @@ -1964,7 +1964,7 @@ static int fill_last_frame(muxer_headers_t *spriv, uint8_t *ptr, int len) { if(spriv->framebuf[idx].size > SIZE_MAX - (size_t)len) return 0; - spriv->framebuf[idx].buffer = (uint8_t*) realloc(spriv->framebuf[idx].buffer, spriv->framebuf[idx].size + len); + spriv->framebuf[idx].buffer = realloc(spriv->framebuf[idx].buffer, spriv->framebuf[idx].size + len); if(! spriv->framebuf[idx].buffer) return 0; spriv->framebuf[idx].alloc_size = spriv->framebuf[idx].size + len; @@ -1983,7 +1983,7 @@ static int add_frame(muxer_headers_t *spriv, uint64_t idur, uint8_t *ptr, int le idx = spriv->framebuf_used; if(idx >= spriv->framebuf_cnt) { - spriv->framebuf = (mpeg_frame_t*) realloc_struct(spriv->framebuf, (spriv->framebuf_cnt+1), sizeof(mpeg_frame_t)); + spriv->framebuf = realloc_struct(spriv->framebuf, (spriv->framebuf_cnt+1), sizeof(mpeg_frame_t)); if(spriv->framebuf == NULL) { mp_msg(MSGT_MUXER, MSGL_FATAL, "Couldn't realloc frame buffer(idx), abort\n"); @@ -1994,7 +1994,7 @@ static int add_frame(muxer_headers_t *spriv, uint64_t idur, uint8_t *ptr, int le spriv->framebuf[spriv->framebuf_cnt].alloc_size = 0; spriv->framebuf[spriv->framebuf_cnt].pos = 0; - spriv->framebuf[spriv->framebuf_cnt].buffer = (uint8_t*) malloc(len); + spriv->framebuf[spriv->framebuf_cnt].buffer = malloc(len); if(spriv->framebuf[spriv->framebuf_cnt].buffer == NULL) { mp_msg(MSGT_MUXER, MSGL_FATAL, "Couldn't realloc frame buffer(frame), abort\n"); @@ -2500,7 +2500,7 @@ static void generate_flags(uint8_t *bff_mask, int source, int target) int muxer_init_muxer_mpeg(muxer_t *muxer) { muxer_priv_t *priv; - priv = (muxer_priv_t *) calloc(1, sizeof(muxer_priv_t)); + priv = calloc(1, sizeof(muxer_priv_t)); if(priv == NULL) return 0; priv->update_system_header = 1; @@ -2716,7 +2716,7 @@ int muxer_init_muxer_mpeg(muxer_t *muxer) priv->drop = conf_drop; - priv->buff = (uint8_t *) malloc(priv->packet_size); + priv->buff = malloc(priv->packet_size); if((priv->buff == NULL)) { mp_msg(MSGT_MUXER, MSGL_ERR, "\nCouldn't allocate %d bytes, exit\n", priv->packet_size); diff --git a/libmpdemux/video.c b/libmpdemux/video.c index fc79da6c6e..a7b1ca1232 100644 --- a/libmpdemux/video.c +++ b/libmpdemux/video.c @@ -382,7 +382,7 @@ switch(video_codec){ } if(mp_vc1_decode_sequence_header(&picture, &videobuffer[4], videobuf_len-4)) { - sh_video->bih = (BITMAPINFOHEADER *) calloc(1, sizeof(BITMAPINFOHEADER) + videobuf_len); + sh_video->bih = calloc(1, sizeof(BITMAPINFOHEADER) + videobuf_len); if(sh_video->bih == NULL) { mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't alloc %d bytes for VC-1 extradata!\n", sizeof(BITMAPINFOHEADER) + videobuf_len); return 0; diff --git a/libvo/sub.c b/libvo/sub.c index 79780ce974..b7e9ccdd6b 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -726,7 +726,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ render_one_glyph(sub_font, c); if (c == ' ') { - struct osd_text_t *tmp_ott = (struct osd_text_t *) calloc(1, sizeof(struct osd_text_t)); + struct osd_text_t *tmp_ott = calloc(1, sizeof(struct osd_text_t)); if (osl == NULL) { osl = cp_ott = tmp_ott; @@ -739,7 +739,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ } tmp_ott->osd_length = xsize; tmp_ott->text_length = char_position; - tmp_ott->text = (int *) malloc(char_position * sizeof(int)); + tmp_ott->text = malloc(char_position * sizeof(int)); for (counter = 0; counter < char_position; ++counter) tmp_ott->text[counter] = char_seq[counter]; char_position = 0; @@ -769,7 +769,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ // osl holds an ordered (as they appear in the lines) chain of the subtitle words { - struct osd_text_t *tmp_ott = (struct osd_text_t *) calloc(1, sizeof(struct osd_text_t)); + struct osd_text_t *tmp_ott = calloc(1, sizeof(struct osd_text_t)); if (osl == NULL) { osl = cp_ott = tmp_ott; @@ -782,7 +782,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ } tmp_ott->osd_length = xsize; tmp_ott->text_length = char_position; - tmp_ott->text = (int *) malloc(char_position * sizeof(int)); + tmp_ott->text = malloc(char_position * sizeof(int)); for (counter = 0; counter < char_position; ++counter) tmp_ott->text[counter] = char_seq[counter]; char_position = 0; @@ -794,7 +794,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ int value = 0, exit = 0, minimum = 0; // otp will contain the chain of the osd subtitle lines coming from the single vo_sub line. - otp = tmp_otp = (struct osd_text_p *) calloc(1, sizeof(struct osd_text_p)); + otp = tmp_otp = calloc(1, sizeof(struct osd_text_p)); tmp_otp->ott = osl; for (tmp_ott = tmp_otp->ott; exit == 0; ) { do { @@ -802,7 +802,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ tmp_ott = tmp_ott->next; } while ((tmp_ott != NULL) && (value + tmp_ott->osd_kerning + tmp_ott->osd_length <= xlimit)); if (tmp_ott != NULL) { - struct osd_text_p *tmp = (struct osd_text_p *) calloc(1, sizeof(struct osd_text_p)); + struct osd_text_p *tmp = calloc(1, sizeof(struct osd_text_p)); tmp_otp->value = value; tmp_otp->next = tmp; diff --git a/libvo/video_out.c b/libvo/video_out.c index b285458c87..d721e0a526 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -482,7 +482,7 @@ range_t *str2range(char *s) for (i = 0; *endptr; i++) { if (*s == ',') goto out_err; - if (!(r = (range_t *) realloc(r, sizeof(*r) * (i + 2)))) { + if (!(r = realloc(r, sizeof(*r) * (i + 2)))) { mp_msg(MSGT_GLOBAL, MSGL_WARN,"can't realloc 'r'\n"); return NULL; } diff --git a/libvo/vo_fbdev2.c b/libvo/vo_fbdev2.c index 55527a660c..0e8f3743cd 100644 --- a/libvo/vo_fbdev2.c +++ b/libvo/vo_fbdev2.c @@ -300,7 +300,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, ( (out_height - in_height) / 2 ) * fb_line_len; #ifndef USE_CONVERT2FB - if (!(next_frame = (uint8_t *) realloc(next_frame, in_width * in_height * fb_pixel_size))) { + if (!(next_frame = realloc(next_frame, in_width * in_height * fb_pixel_size))) { mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't malloc next_frame: %s\n", strerror(errno)); return 1; } diff --git a/loader/dmo/buffer.c b/loader/dmo/buffer.c index 70883b9abe..78428e249f 100644 --- a/loader/dmo/buffer.c +++ b/loader/dmo/buffer.c @@ -69,12 +69,12 @@ IMPLEMENT_IUNKNOWN(CMediaBuffer) CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, unsigned long len, int copy) { - CMediaBuffer* This = (CMediaBuffer*) malloc(sizeof(CMediaBuffer)); + CMediaBuffer* This = malloc(sizeof(CMediaBuffer)); if (!This) return NULL; - This->vt = (IMediaBuffer_vt*) malloc(sizeof(IMediaBuffer_vt)); + This->vt = malloc(sizeof(IMediaBuffer_vt)); if (!This->vt) { CMediaBuffer_Destroy(This); diff --git a/loader/dmo/dmo.c b/loader/dmo/dmo.c index f8898efcb5..0ca7cf3206 100644 --- a/loader/dmo/dmo.c +++ b/loader/dmo/dmo.c @@ -36,7 +36,7 @@ DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id, { HRESULT hr = 0; const char* em = NULL; - DMO_Filter* This = (DMO_Filter*) malloc(sizeof(DMO_Filter)); + DMO_Filter* This = malloc(sizeof(DMO_Filter)); if (!This) return NULL; diff --git a/loader/drv.c b/loader/drv.c index 43d9485646..9479e6944d 100644 --- a/loader/drv.c +++ b/loader/drv.c @@ -75,7 +75,7 @@ void SetCodecPath(const char* path) needs_free=0; return; } - def_path = (char*) malloc(strlen(path)+1); + def_path = malloc(strlen(path)+1); strcpy(def_path, path); needs_free=1; } @@ -153,7 +153,7 @@ HDRVR DrvOpen(LPARAM lParam2) #endif printf("Loading codec DLL: '%s'\n",filename); - hDriver = (NPDRVR) malloc(sizeof(DRVR)); + hDriver = malloc(sizeof(DRVR)); if (!hDriver) return (HDRVR) 0; memset((void*)hDriver, 0, sizeof(DRVR)); diff --git a/loader/dshow/allocator.c b/loader/dshow/allocator.c index 8ead279a37..b75f1bebfb 100644 --- a/loader/dshow/allocator.c +++ b/loader/dshow/allocator.c @@ -58,7 +58,7 @@ static inline int avm_list_print(avm_list_t* head) static inline avm_list_t* avm_list_add_head(avm_list_t* head, void* member) { - avm_list_t* n = (avm_list_t*) malloc(sizeof(avm_list_t)); + avm_list_t* n = malloc(sizeof(avm_list_t)); n->member = member; if (!head) @@ -310,7 +310,7 @@ IMPLEMENT_IUNKNOWN(MemAllocator) MemAllocator* MemAllocatorCreate() { - MemAllocator* This = (MemAllocator*) malloc(sizeof(MemAllocator)); + MemAllocator* This = malloc(sizeof(MemAllocator)); if (!This) return NULL; @@ -323,7 +323,7 @@ MemAllocator* MemAllocatorCreate() This->props.cbAlign = 1; This->props.cbPrefix = 0; - This->vt = (IMemAllocator_vt*) malloc(sizeof(IMemAllocator_vt)); + This->vt = malloc(sizeof(IMemAllocator_vt)); if (!This->vt) { diff --git a/loader/dshow/cmediasample.c b/loader/dshow/cmediasample.c index c594bae787..efa3ef89cd 100644 --- a/loader/dshow/cmediasample.c +++ b/loader/dshow/cmediasample.c @@ -313,7 +313,7 @@ static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This, char* c = cms->own_block; Debug printf("CMediaSample - buffer overflow %ld %d %p %p\n", __MIDL_0010, ((CMediaSample*)This)->size, cms->own_block, cms->block); - cms->own_block = (char*) realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL); + cms->own_block = realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL); if (c == cms->block) cms->block = cms->own_block; cms->size = __MIDL_0010; @@ -510,7 +510,7 @@ static void CMediaSample_ResetPointer(CMediaSample* This) */ CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int size) { - CMediaSample* This = (CMediaSample*) malloc(sizeof(CMediaSample)); + CMediaSample* This = malloc(sizeof(CMediaSample)); if (!This) return NULL; @@ -524,8 +524,8 @@ CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int size) //if (size < 0x1000) // size = (size + 0xfff) & ~0xfff; - This->vt = (IMediaSample_vt*) malloc(sizeof(IMediaSample_vt)); - This->own_block = (char*) malloc((size_t)size + SAFETY_ACEL); + This->vt = malloc(sizeof(IMediaSample_vt)); + This->own_block = malloc((size_t)size + SAFETY_ACEL); This->media_type.pbFormat = 0; This->media_type.pUnk = 0; diff --git a/loader/dshow/inputpin.c b/loader/dshow/inputpin.c index 5c9b832f7a..3227339bee 100644 --- a/loader/dshow/inputpin.c +++ b/loader/dshow/inputpin.c @@ -167,7 +167,7 @@ IMPLEMENT_IUNKNOWN(CEnumPins) */ static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp) { - CEnumPins* This = (CEnumPins*) malloc(sizeof(CEnumPins)); + CEnumPins* This = malloc(sizeof(CEnumPins)); if (!This) return NULL; @@ -177,7 +177,7 @@ static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp) This->pin2 = pp; This->counter = 0; - This->vt = (IEnumPins_vt*) malloc(sizeof(IEnumPins_vt)); + This->vt = malloc(sizeof(IEnumPins_vt)); if (!This->vt) { free(This); @@ -539,7 +539,7 @@ IMPLEMENT_IUNKNOWN(CInputPin) */ CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt) { - CInputPin* This = (CInputPin*) malloc(sizeof(CInputPin)); + CInputPin* This = malloc(sizeof(CInputPin)); if (!This) return NULL; @@ -548,7 +548,7 @@ CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt) This->parent = p; CopyMediaType(&(This->type),amt); - This->vt= (IPin_vt*) malloc(sizeof(IPin_vt)); + This->vt= malloc(sizeof(IPin_vt)); if (!This->vt) { @@ -879,7 +879,7 @@ IMPLEMENT_IUNKNOWN(CBaseFilter) */ CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent) { - CBaseFilter* This = (CBaseFilter*) malloc(sizeof(CBaseFilter)); + CBaseFilter* This = malloc(sizeof(CBaseFilter)); if (!This) return NULL; @@ -888,7 +888,7 @@ CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent) This->pin = (IPin*) CInputPinCreate(This, type); This->unused_pin = (IPin*) CRemotePinCreate(This, parent->GetPin(parent)); - This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); + This->vt = malloc(sizeof(IBaseFilter_vt)); if (!This->vt || !This->pin || !This->unused_pin) { CBaseFilter_Destroy(This); @@ -1214,7 +1214,7 @@ static GUID CBaseFilter2_interf3 = */ CBaseFilter2* CBaseFilter2Create() { - CBaseFilter2* This = (CBaseFilter2*) malloc(sizeof(CBaseFilter2)); + CBaseFilter2* This = malloc(sizeof(CBaseFilter2)); if (!This) return NULL; @@ -1222,7 +1222,7 @@ CBaseFilter2* CBaseFilter2Create() This->refcount = 1; This->pin = (IPin*) CRemotePin2Create(This); - This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); + This->vt = malloc(sizeof(IBaseFilter_vt)); if (!This->pin || !This->vt) { @@ -1374,7 +1374,7 @@ IMPLEMENT_IUNKNOWN(CRemotePin) */ CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin) { - CRemotePin* This = (CRemotePin*) malloc(sizeof(CRemotePin)); + CRemotePin* This = malloc(sizeof(CRemotePin)); if (!This) return NULL; @@ -1385,7 +1385,7 @@ CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin) This->remote_pin = rpin; This->refcount = 1; - This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); + This->vt = malloc(sizeof(IPin_vt)); if (!This->vt) { @@ -1464,7 +1464,7 @@ IMPLEMENT_IUNKNOWN(CRemotePin2) */ CRemotePin2* CRemotePin2Create(CBaseFilter2* p) { - CRemotePin2* This = (CRemotePin2*) malloc(sizeof(CRemotePin2)); + CRemotePin2* This = malloc(sizeof(CRemotePin2)); if (!This) return NULL; @@ -1474,7 +1474,7 @@ CRemotePin2* CRemotePin2Create(CBaseFilter2* p) This->parent = p; This->refcount = 1; - This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); + This->vt = malloc(sizeof(IPin_vt)); if (!This->vt) { diff --git a/loader/elfdll.c b/loader/elfdll.c index 1927640505..e4a0190f89 100644 --- a/loader/elfdll.c +++ b/loader/elfdll.c @@ -197,7 +197,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) // wm->binfmt.pe.pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(hModule, dir->VirtualAddress); - wm->filename = (char*) malloc(strlen(path)+1); + wm->filename = malloc(strlen(path)+1); strcpy(wm->filename, path); wm->modname = strrchr( wm->filename, '\\' ); if (!wm->modname) wm->modname = wm->filename; @@ -216,7 +216,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) if(local_wm) { - local_wm->next = (modref_list*) malloc(sizeof(modref_list)); + local_wm->next = malloc(sizeof(modref_list)); local_wm->next->prev=local_wm; local_wm->next->next=NULL; local_wm->next->wm=wm; @@ -224,7 +224,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) } else { - local_wm = (modref_list*) malloc(sizeof(modref_list)); + local_wm = malloc(sizeof(modref_list)); local_wm->next=local_wm->prev=NULL; local_wm->wm=wm; } diff --git a/loader/ext.c b/loader/ext.c index 23c0292c6c..9c00d1988b 100644 --- a/loader/ext.c +++ b/loader/ext.c @@ -197,7 +197,7 @@ WIN_BOOL WINAPI IsBadReadPtr(LPCVOID data, UINT size) LPSTR HEAP_strdupA(HANDLE heap, DWORD flags, LPCSTR string) { // return strdup(string); - char* answ = (char*) malloc(strlen(string) + 1); + char* answ = malloc(strlen(string) + 1); strcpy(answ, string); return answ; } @@ -208,7 +208,7 @@ LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string) if(string==0) return 0; size=strlen(string); - answer = (WCHAR*) malloc(sizeof(WCHAR) * (size + 1)); + answer = malloc(sizeof(WCHAR) * (size + 1)); for(i=0; i<=size; i++) answer[i]=(short)string[i]; return answer; @@ -222,7 +222,7 @@ LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string) size=0; while(string[size]) size++; - answer = (char*) malloc(size + 2); + answer = malloc(size + 2); for(i=0; i<=size; i++) answer[i]=(char)string[i]; return answer; @@ -372,12 +372,12 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr, { if(fm==0) { - fm = (file_mapping*) malloc(sizeof(file_mapping)); + fm = malloc(sizeof(file_mapping)); fm->prev=NULL; } else { - fm->next = (file_mapping*) malloc(sizeof(file_mapping)); + fm->next = malloc(sizeof(file_mapping)); fm->next->prev=fm; fm=fm->next; } @@ -385,7 +385,7 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr, fm->handle=answer; if(name) { - fm->name = (char*) malloc(strlen(name)+1); + fm->name = malloc(strlen(name)+1); strcpy(fm->name, name); } else @@ -510,7 +510,7 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protec } else { - virt_alloc *new_vm = (virt_alloc*) malloc(sizeof(virt_alloc)); + virt_alloc *new_vm = malloc(sizeof(virt_alloc)); new_vm->mapping_size=size; new_vm->address=(char*)answer; new_vm->prev=vm; diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c index 0fcc98d53c..92a7df88a5 100644 --- a/loader/ldt_keeper.c +++ b/loader/ldt_keeper.c @@ -182,7 +182,7 @@ ldt_fs_t* Setup_LDT_Keeper(void) { struct modify_ldt_ldt_s array; int ret; - ldt_fs_t* ldt_fs = (ldt_fs_t*) malloc(sizeof(ldt_fs_t)); + ldt_fs_t* ldt_fs = malloc(sizeof(ldt_fs_t)); if (!ldt_fs) return NULL; diff --git a/loader/module.c b/loader/module.c index 3eb024460a..79c01270d3 100644 --- a/loader/module.c +++ b/loader/module.c @@ -241,7 +241,7 @@ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ) //local_wm=wm; if(local_wm) { - local_wm->next = (modref_list*) malloc(sizeof(modref_list)); + local_wm->next = malloc(sizeof(modref_list)); local_wm->next->prev=local_wm; local_wm->next->next=NULL; local_wm->next->wm=wm; @@ -854,7 +854,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t // memory management: case 0x150011: //NewPtrClear case 0x150012: //NewPtrSysClear - reg->eax=(uint32_t)malloc(((uint32_t *)stack_base)[1]); + reg->eax = malloc(((uint32_t *)stack_base)[1]); memset((void *)reg->eax,0,((uint32_t *)stack_base)[1]); #ifdef DEBUG_QTX_API printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); @@ -862,7 +862,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t return 1; case 0x15000F: //NewPtr case 0x150010: //NewPtrSys - reg->eax=(uint32_t)malloc(((uint32_t *)stack_base)[1]); + reg->eax = malloc(((uint32_t *)stack_base)[1]); #ifdef DEBUG_QTX_API printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); #endif diff --git a/loader/registry.c b/loader/registry.c index 37a262270e..9964eeb9ff 100644 --- a/loader/registry.c +++ b/loader/registry.c @@ -277,7 +277,7 @@ static struct reg_value* insert_reg_value(int handle, const char* name, int type { if(regs==0) create_registry(); - regs=(struct reg_value*)realloc(regs, sizeof(struct reg_value)*(reg_size+1)); + regs = realloc(regs, sizeof(struct reg_value) * (reg_size +1 )); //regs=(struct reg_value*)my_realloc(regs, sizeof(struct reg_value)*(reg_size+1)); v=regs+reg_size; reg_size++; diff --git a/loader/win32.c b/loader/win32.c index fbd4d5a4e5..f560ffdfb4 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -358,7 +358,7 @@ void* mreq_private(int size, int to_zero, int type); void* mreq_private(int size, int to_zero, int type) { int nsize = size + sizeof(alloc_header); - alloc_header* header = (alloc_header* ) malloc(nsize); + alloc_header* header = malloc(nsize); if (!header) return 0; if (to_zero) @@ -4716,7 +4716,7 @@ static HPALETTE WINAPI expCreatePalette(CONST LOGPALETTE *lpgpl) dbgprintf("CreatePalette(%x) => NULL\n", lpgpl); i = sizeof(LOGPALETTE)+((lpgpl->palNumEntries-1)*sizeof(PALETTEENTRY)); - test = (HPALETTE)malloc(i); + test = malloc(i); memcpy((void *)test, lpgpl, i); return test; diff --git a/m_option.c b/m_option.c index 6a5565eca0..8224ba7f35 100644 --- a/m_option.c +++ b/m_option.c @@ -1011,7 +1011,7 @@ static int parse_subconf(const m_option_t* opt,const char *name, const char *par subparam[0] == 0 ? NULL : subparam,NULL,src); if(r < 0) return r; if(dst) { - lst = (char**)realloc(lst,2 * (nr+2) * sizeof(char*)); + lst = realloc(lst,2 * (nr+2) * sizeof(char*)); lst[2*nr] = strdup(subopt); lst[2*nr+1] = subparam[0] == 0 ? NULL : strdup(subparam); memset(&lst[2*(nr+1)],0,2*sizeof(char*)); diff --git a/mp3lib/equalizer.c b/mp3lib/equalizer.c index acb5bc18e0..78db17ef67 100644 --- a/mp3lib/equalizer.c +++ b/mp3lib/equalizer.c @@ -5,7 +5,7 @@ void init_spline(float *x, float *y, int n, float *y2) int i, k; float p, qn, sig, un, *u; - u = (float *) malloc(n * sizeof (float)); + u = malloc(n * sizeof (float)); y2[0] = u[0] = 0.0; diff --git a/osdep/mmap-os2.c b/osdep/mmap-os2.c index 7646296cd9..a1e0c29e3f 100644 --- a/osdep/mmap-os2.c +++ b/osdep/mmap-os2.c @@ -84,7 +84,7 @@ void *mmap( void *addr, size_t len, int prot, int flags, int fildes, off_t off ) return MAP_FAILED; } - new_mmap = ( os2_mmap * )malloc( sizeof( os2_mmap )); + new_mmap = malloc( sizeof( os2_mmap )); new_mmap->addr = ret; new_mmap->len = len; new_mmap->flags = flags; diff --git a/playtree.c b/playtree.c index f6f068ec33..4ff88f241e 100644 --- a/playtree.c +++ b/playtree.c @@ -283,7 +283,7 @@ play_tree_add_file(play_tree_t* pt,char* file) { for(n = 0 ; pt->files[n] != NULL ; n++) /* NOTHING */; } - pt->files = (char**)realloc(pt->files,(n+2)*sizeof(char*)); + pt->files = realloc(pt->files, (n + 2) * sizeof(char*)); if(pt->files ==NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",(n+2)*(int)sizeof(char*)); return; @@ -322,7 +322,7 @@ play_tree_remove_file(play_tree_t* pt,char* file) { if(n > 1) { memmove(&pt->files[f],&pt->files[f+1],(n-f)*sizeof(char*)); - pt->files = (char**)realloc(pt->files,n*sizeof(char*)); + pt->files = realloc(pt->files, n * sizeof(char*)); if(pt->files == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",(n+2)*(int)sizeof(char*)); return -1; @@ -347,7 +347,7 @@ play_tree_set_param(play_tree_t* pt, char* name, char* val) { if(pt->params) for ( ; pt->params[n].name != NULL ; n++ ) { } - pt->params = (play_tree_param_t*)realloc(pt->params,(n+2)*sizeof(play_tree_param_t)); + pt->params = realloc(pt->params, (n + 2) * sizeof(play_tree_param_t)); if(pt->params == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't realloc params (%d bytes of memory)\n",(n+2)*(int)sizeof(play_tree_param_t)); return; @@ -382,7 +382,7 @@ play_tree_unset_param(play_tree_t* pt, char* name) { if(n > 1) { memmove(&pt->params[ni],&pt->params[ni+1],(n-ni)*sizeof(play_tree_param_t)); - pt->params = (play_tree_param_t*)realloc(pt->params,n*sizeof(play_tree_param_t)); + pt->params = realloc(pt->params, n * sizeof(play_tree_param_t)); if(pt->params == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",n*(int)sizeof(play_tree_param_t)); return -1; @@ -707,7 +707,7 @@ play_tree_iter_up_step(play_tree_iter_t* iter, int d,int with_nodes) { iter->stack_size--; iter->loop = iter->status_stack[iter->stack_size]; if(iter->stack_size > 0) - iter->status_stack = (int*)realloc(iter->status_stack,iter->stack_size*sizeof(int)); + iter->status_stack = realloc(iter->status_stack, iter->stack_size * sizeof(int)); else { free(iter->status_stack); iter->status_stack = NULL; @@ -745,7 +745,7 @@ play_tree_iter_down_step(play_tree_iter_t* iter, int d,int with_nodes) { play_tree_iter_push_params(iter); iter->stack_size++; - iter->status_stack = (int*)realloc(iter->status_stack,iter->stack_size*sizeof(int)); + iter->status_stack = realloc(iter->status_stack, iter->stack_size * sizeof(int)); if(iter->status_stack == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",iter->stack_size*(int)sizeof(int)); return PLAY_TREE_ITER_ERROR; diff --git a/playtreeparser.c b/playtreeparser.c index 33a23e6353..c9a6695b86 100644 --- a/playtreeparser.c +++ b/playtreeparser.c @@ -81,7 +81,7 @@ play_tree_parser_get_line(play_tree_parser_t* p) { if(resize) { r = p->iter - p->buffer; - p->buffer = (char*)realloc(p->buffer,p->buffer_size+BUF_STEP); + p->buffer = realloc(p->buffer, p->buffer_size + BUF_STEP); p->iter = p->buffer + r; p->buffer_size += BUF_STEP; resize = 0; @@ -113,7 +113,7 @@ play_tree_parser_get_line(play_tree_parser_t* p) { line_end = (end > p->iter && *(end-1) == '\r') ? end-1 : end; if(line_end - p->iter >= 0) - p->line = (char*)realloc(p->line,line_end - p->iter+1); + p->line = realloc(p->line, line_end - p->iter + 1); else return NULL; if(line_end - p->iter > 0) @@ -252,7 +252,7 @@ pls_read_entry(char* line,pls_entry_t** _e,int* _max_entry,char** val) { mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No entry index in entry %s\nAssuming %d\n",line,num); } if(num > max_entry) { - e = (pls_entry_t*)realloc(e,num*sizeof(pls_entry_t)); + e = realloc(e, num * sizeof(pls_entry_t)); memset(&e[max_entry],0,(num-max_entry)*sizeof(pls_entry_t)); max_entry = num; } @@ -713,12 +713,12 @@ play_tree_add_basepath(play_tree_t* pt, char* bp) { if (pt->files[i][0] == '\\') { if (pt->files[i][1] == '\\') continue; - pt->files[i] = (char*)realloc(pt->files[i],2+fl+1); + pt->files[i] = realloc(pt->files[i], 2 + fl + 1); memmove(pt->files[i] + 2,pt->files[i],fl+1); memcpy(pt->files[i],bp,2); continue; } - pt->files[i] = (char*)realloc(pt->files[i],bl+fl+1); + pt->files[i] = realloc(pt->files[i], bl + fl + 1); memmove(pt->files[i] + bl,pt->files[i],fl+1); memcpy(pt->files[i],bp,bl); } diff --git a/stream/http.c b/stream/http.c index bda6c060c7..d79f7632ca 100644 --- a/stream/http.c +++ b/stream/http.c @@ -332,7 +332,7 @@ http_response_append( HTTP_header_t *http_hdr, char *response, int length ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Bad size in memory (re)allocation\n"); return -1; } - http_hdr->buffer = (char*)realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 ); + http_hdr->buffer = realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 ); if( http_hdr->buffer==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory (re)allocation failed\n"); return -1; @@ -428,7 +428,7 @@ http_response_parse( HTTP_header_t *http_hdr ) { while( *ptr!='\r' && *ptr!='\n' ) ptr++; len = ptr-hdr_ptr; if( len==0 ) break; - field = (char*)realloc(field, len+1); + field = realloc(field, len+1); if( field==NULL ) { mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n"); return -1; @@ -520,7 +520,7 @@ char * http_get_field( HTTP_header_t *http_hdr, const char *field_name ) { if( http_hdr==NULL || field_name==NULL ) return NULL; http_hdr->field_search_pos = http_hdr->first_field; - http_hdr->field_search = (char*)realloc( http_hdr->field_search, strlen(field_name)+1 ); + http_hdr->field_search = realloc( http_hdr->field_search, strlen(field_name)+1 ); if( http_hdr->field_search==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); return NULL; diff --git a/stream/stream_netstream.h b/stream/stream_netstream.h index a81bc37c83..4d3e30e849 100644 --- a/stream/stream_netstream.h +++ b/stream/stream_netstream.h @@ -89,8 +89,7 @@ static int net_read(int fd, char* buf, int len) { static mp_net_stream_packet_t* read_packet(int fd) { uint16_t len; - mp_net_stream_packet_t* pack = - (mp_net_stream_packet_t*)malloc(sizeof(mp_net_stream_packet_t)); + mp_net_stream_packet_t* pack = malloc(sizeof(mp_net_stream_packet_t)); if(!net_read(fd,(char*)pack,sizeof(mp_net_stream_packet_t))) { free(pack); diff --git a/stream/tvi_def.h b/stream/tvi_def.h index 261a8ee4cd..43de8c6423 100644 --- a/stream/tvi_def.h +++ b/stream/tvi_def.h @@ -47,11 +47,11 @@ static const tvi_functions_t functions = static tvi_handle_t *new_handle(void) { - tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t)); + tvi_handle_t *h = malloc(sizeof(tvi_handle_t)); if (!h) return NULL; - h->priv = (priv_t *)malloc(sizeof(priv_t)); + h->priv = malloc(sizeof(priv_t)); if (!h->priv) { free(h); diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c index 9aec47ed54..354c0f541b 100644 --- a/stream/tvi_dshow.c +++ b/stream/tvi_dshow.c @@ -796,19 +796,19 @@ static HRESULT init_ringbuffer(grabber_ringbuffer_t * rb, int buffersize, mp_msg(MSGT_TV, MSGL_DBG2, "tvi_dshow: Capture buffer: %d blocks of %d bytes.\n", rb->buffersize, rb->blocksize); - rb->ringbuffer = (char **) malloc(rb->buffersize * sizeof(char *)); + rb->ringbuffer = malloc(rb->buffersize * sizeof(char *)); if (!rb) return E_POINTER; memset(rb->ringbuffer, 0, rb->buffersize * sizeof(char *)); for (i = 0; i < rb->buffersize; i++) { - rb->ringbuffer[i] = (char *) malloc(rb->blocksize * sizeof(char)); + rb->ringbuffer[i] = malloc(rb->blocksize * sizeof(char)); if (!rb->ringbuffer[i]) { destroy_ringbuffer(rb); return E_OUTOFMEMORY; } } - rb->dpts = (double*) malloc(rb->buffersize * sizeof(double)); + rb->dpts = malloc(rb->buffersize * sizeof(double)); if (!rb->dpts) { destroy_ringbuffer(rb); return E_OUTOFMEMORY; @@ -817,7 +817,7 @@ static HRESULT init_ringbuffer(grabber_ringbuffer_t * rb, int buffersize, rb->tail = 0; rb->count = 0; rb->tStart = -1; - rb->pMutex = (CRITICAL_SECTION *) malloc(sizeof(CRITICAL_SECTION)); + rb->pMutex = malloc(sizeof(CRITICAL_SECTION)); if (!rb->pMutex) { destroy_ringbuffer(rb); return E_OUTOFMEMORY; @@ -966,7 +966,7 @@ static HRESULT load_freq_table(int nCountry, int nInputType, } *pnFirst = plFreqTable[0]; *pnLen = (int) (plFreqTable[1] - plFreqTable[0] + 1); - *pplFreqTable = (long *) malloc((*pnLen) * sizeof(long)); + *pplFreqTable = malloc((*pnLen) * sizeof(long)); if (!*pplFreqTable) { FreeLibrary(hDLL); return E_FAIL; @@ -1273,7 +1273,7 @@ static void get_capabilities(priv_t * priv) OLE_CALL_ARGS(priv->pCrossbar, get_PinCounts, &lOutputPins, &lInputPins); - tv_available_inputs = (long *) malloc(sizeof(long) * lInputPins); + tv_available_inputs = malloc(sizeof(long) * lInputPins); tv_available_inputs_count = 0; mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_AvailableVideoInputs); @@ -2063,11 +2063,11 @@ static HRESULT get_available_formats_stream(chain_t *chain) } done = 0; - arpmt = (AM_MEDIA_TYPE **) malloc((count + 1) * sizeof(AM_MEDIA_TYPE *)); + arpmt = malloc((count + 1) * sizeof(AM_MEDIA_TYPE *)); if (arpmt) { memset(arpmt, 0, (count + 1) * sizeof(AM_MEDIA_TYPE *)); - pBuf = (void **) malloc((count + 1) * sizeof(void *)); + pBuf = malloc((count + 1) * sizeof(void *)); if (pBuf) { memset(pBuf, 0, (count + 1) * sizeof(void *)); @@ -2170,8 +2170,7 @@ static HRESULT get_available_formats_pin(ICaptureGraphBuilder2 * pBuilder, OLE_CALL(pEnum,Reset); count = i; - arpmt = - (AM_MEDIA_TYPE **) malloc((count + 1) * sizeof(AM_MEDIA_TYPE *)); + arpmt = malloc((count + 1) * sizeof(AM_MEDIA_TYPE *)); if (!arpmt) return E_OUTOFMEMORY; memset(arpmt, 0, (count + 1) * sizeof(AM_MEDIA_TYPE *)); @@ -2184,7 +2183,7 @@ static HRESULT get_available_formats_pin(ICaptureGraphBuilder2 * pBuilder, OLE_RELEASE_SAFE(pEnum); - pBuf = (void **) malloc((count + 1) * sizeof(void *)); + pBuf = malloc((count + 1) * sizeof(void *)); if (!pBuf) { for (i = 0; i < count; i++) if (arpmt[i]) diff --git a/subreader.c b/subreader.c index ddbd2839df..bbabda8511 100644 --- a/subreader.c +++ b/subreader.c @@ -1655,7 +1655,7 @@ if ((suboverlap_enabled == 2) || if (higher_line >= SUB_MAX_TEXT) { // the 'block' has too much lines, so we don't overlap the // subtitles - second = (subtitle *) realloc(second, (sub_num + sub_to_add + 1) * sizeof(subtitle)); + second = realloc(second, (sub_num + sub_to_add + 1) * sizeof(subtitle)); for (j = 0; j <= sub_to_add; ++j) { int ls; memset(&second[sub_num + j], '\0', sizeof(subtitle)); @@ -1675,7 +1675,7 @@ if ((suboverlap_enabled == 2) || // we read the placeholder structure and create the new // subs. - second = (subtitle *) realloc(second, (sub_num + 1) * sizeof(subtitle)); + second = realloc(second, (sub_num + 1) * sizeof(subtitle)); memset(&second[sub_num], '\0', sizeof(subtitle)); second[sub_num].start = local_start; second[sub_num].end = local_end; From 57186ad0be5b82d34b3da260438fe8e4424a9736 Mon Sep 17 00:00:00 2001 From: ptt Date: Fri, 26 Feb 2010 15:33:45 +0000 Subject: [PATCH 11/14] it's synced up to r30515 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30745 b3059339-0415-0410-9bf9-f77b7e298cf2 --- help/help_mp-it.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/help/help_mp-it.h b/help/help_mp-it.h index 5ecfab9c0a..82e1187600 100644 --- a/help/help_mp-it.h +++ b/help/help_mp-it.h @@ -2,7 +2,7 @@ // Updated by: Roberto Togni // Updated by: PaulTT -// Updated to help_mp-en.h r30044 +// Updated to help_mp-en.h r30515 // ========================= MPlayer help =========================== From 2b2fbe120e4113f68ad679d05af9ea47a001092d Mon Sep 17 00:00:00 2001 From: ptt Date: Fri, 26 Feb 2010 15:47:42 +0000 Subject: [PATCH 12/14] new sentences on new lines, cropdetect filter git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30746 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index ee7db43c37..03ffa36184 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -5811,11 +5811,11 @@ Use 2 to get only even dimensions (needed for 4:2:2 video). 16 is best when encoding to most video codecs. .br .IPs -Counter that determines after how many frames cropdetect will reset -the previously detected largest video area and start over to detect -the current optimal crop area. This can be useful when channel -logos distort the video area. 0 indicates never reset and return -the largest area encountered during playback. (default: 0). +Counter that determines after how many frames cropdetect will reset the +previously detected largest video area and start over to detect the current +optimal crop area (default: 0). +This can be useful when channel logos distort the video area. +0 indicates never reset and return the largest area encountered during playback. .RE .PD 1 . From ba641b827543ccf7a2d6d09811f2cd202e85d181 Mon Sep 17 00:00:00 2001 From: ptt Date: Fri, 26 Feb 2010 17:05:30 +0000 Subject: [PATCH 13/14] synced to r30610 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30747 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/it/mplayer.1 | 89 +++++++++++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 32 deletions(-) diff --git a/DOCS/man/it/mplayer.1 b/DOCS/man/it/mplayer.1 index c9811f6a25..391ad7571f 100644 --- a/DOCS/man/it/mplayer.1 +++ b/DOCS/man/it/mplayer.1 @@ -1,4 +1,4 @@ -.\" synced with r30336 +.\" synced with r30610 .\" Encoding: iso-8859-1 .\" MPlayer (C) 2000-2010 MPlayer Team .\" Questa pagina di manuale stata fatta da Gabucino, Diego Biurrun, @@ -462,8 +462,6 @@ Attiva/\:disattiva il televideo. Va alla pagina televideo successiva/\:precedente. .RE .PD 1 -.PP -.RS . .TP .B controlli da mouse @@ -2942,7 +2940,7 @@ driver di uscita audio PulseAudio .PD 0 .RSs .IPs "[][:]" -specifica l'host e facoltativamente il sink di uscita da usare. +Specifica l'host e facoltativamente il sink di uscita da usare. Una stringa vuota usa una connessione locale, "localhost" usa un trasferimento via rete (molto probabilmente non quello che vuoi). .RE @@ -2987,6 +2985,22 @@ dispositivi disponibili. .PD 1 . .TP +.B kai (solo OS/2) +driver di uscita video OS/2 KAI +.PD 0 +.RSs +.IPs uniaud +Forza la modalit UNIAUD. +.IPs dart +Forza la modalit DART. +.IPs (no)share +Apre l'audio in modalit condivisa o esclusiva. +.IPs bufsize= +Imposta la dimensione del buffer a in campioni (default: 2048). +.RE +.PD 1 +. +.TP .B dart (solo OS/2) driver di uscita video OS/2 DART .PD 0 @@ -3716,8 +3730,10 @@ Usa nochroma\-deint per usare solo la luminanza ed accellerare il deinterlacciamento avanzato. Utile con memoria video lenta. .IPs pullup -Cerca di applicare il telecine inverso, richiede un deinterlacciamento -temporale adattivo al movimento. +Cerca di evitare il deinterlacciamento per i fotogrammi progressivi, utile per +guardare contenuto in telecine, ha bisogno di hardware video veloce per alte +risoluzioni. +Funziona solo con un deinterlacciamento temporale adattivo al movimento. .IPs colorspace Seleziona lo spazio colore per la conversione da YUV a RGB (default: 1, BT.601). In linea di massima si dovrebbero usare BT.601 per contenuto con una @@ -4030,8 +4046,9 @@ Nella maggior parte dei casi software verso RGB. .IPs yuv= Seleziona il tipo di conversione da YUV a RGB. +Il default una selezione automatica tra i valori 0 e 2. .RSss -0: Usa conversione software (default). +0: Usa conversione software. Compatibile con tutte le versioni di OpenGL. Fornisce controllo di luminosit, contrasto e saturazione. .br @@ -4715,7 +4732,7 @@ Specifica le opzioni avanzate dei filtri audio: .IPs force=<0\-7> Forza l'inserimento del filtro audio a uno dei seguenti: .RSss -0: Inserimento completamente automatico dei filtri. +0: Inserimento completamente automatico dei filtri (identico a 1 per ora). .br 1: Ottimizza per la precisione (default). .br @@ -6055,7 +6072,7 @@ Posizione dell'immagine da mantenere, il default .PD 1 . .TP -.B cropdetect[=limite:arrotondamento] +.B cropdetect[=limite:arrotondamento[:azzeramento]] Calcola i parametri necessari per applicare automaticamente il filtro 'crop' e stampa i parametri raccomandati su stdout. .PD 0 @@ -6069,6 +6086,14 @@ Valore per cui devono essere divisibili i valori di larghezza/\:altezza (default Lo scostamento viene regolato automaticamente per centrare il video. Utilizza 2 per avere solo dimensioni pari (necessario per i filmati in formato 4:2:2). Con molti codec video conviene utilizzare 16 quando si effettua la codifica. +.br +.IPs +Contatore che determina il numero di fotogrammi dopo i quali cropdetect azzerer +la pi ampia area rilevata e ricomincer a cercare la migliore superficie per +il ritaglio (default: 0). +Questo pu tornare utile quando il logo di un canale falsa l'area del video. +Un valore di 0 disattiva l'opzione e restituisce l'area pi ampia rilevata +durante la riproduzione. .RE .PD 1 . @@ -7403,11 +7428,11 @@ Altezza completa a met . .TP .B tfields[=modo[:posizione_campo]] -Separazione temporale dei campi \- divide i campi in fotogrammi, -raddoppiando il framerate di uscita. -Come il filtro telecine, tfield lavorer correttamente solo con -MEncoder, e solo se entrambe le opzioni \-fps e \-ofps sono -caricate al valore desiderato (doppio) del framerate. +Separazione temporale dei campi \- divide i campi in fotogrammi, raddoppiando +la frequenza dei fotogrammi (framerate) di uscita. +Come il filtro telecine, tfields potrebbe lavorare in modo non corretto, tranne +quando usato con MEncoder e con entrambe le opzioni \-fps e \-ofps impostate al +valore desiderato (doppio) della frequenza fotogrammi. .PD 0 .RSs .IPs @@ -10554,17 +10579,17 @@ ma non azzerano il contatore "keyint". . .TP .B frameref=<1\-16> -Numero di fotogrammi precedenti utilizzati come previsori nei fotogrammi -B e P (default: 1). +Numero di fotogrammi precedenti utilizzati come predittori nei fotogrammi B e P +(default: 3). E' efficace con alcuni anime o cartoni animati, ma su filmati ripresi dal vivo i miglioramenti calano rapidamente dopo circa 6 fotogrammi di riferimento. Non ha effetto sulla velocit di decodifica ma incrementa la memoria necessaria alla decodifica. -Alcuni decodificatori possono gestire un massimo di 15 fotogrammi di riferimento. +Alcuni decodificatori possono gestire al massimo 15 fotogrammi di riferimento. . .TP .B bframes=<0\-16> -Numero massimo di fotogrammi B consecutivi tra fotogrammi I e P (default: 0). +numero massimo di fotogrammi B consecutivi tra fotogrammi I e P (default: 3) . .TP .B (no)b_adapt @@ -10842,30 +10867,30 @@ Come 2, ma utilizza una rifinitura del quarto di pixel pi .IPs 4 Esegue una stima del movimento a quarto di pixel rapida su tutti i tipi di macroblocchi candidati. -Poi seleziona il tipo migliore. +Poi seleziona il tipo migliore con una metrica SATD. Infine finisce la rifinitura a quarto di pixel per quel tipo. .IPs 5 Esegue la miglior stima del movimento a quarto di pixel in tutti i -tipi di macroblocchi candidati prima di selezionare il tipo migliore. +tipi di macroblocco candidati prima di selezionare il tipo migliore. Inoltre rifinisce con una metrica SATD i due vettori di movimento usati nei macroblocchi bidirezionali, invece di riutilizzare i vettori delle ricerche in avanti e all'indietro. .IPs 6 -Abilita l'ottimizzazione rate-distorsion (?) dei tipi di macroblocco nei -fotogrammi I e P (default). +Abilita l'ottimizzazione rate-distorsion dei tipi di macroblocco nei +fotogrammi I e P. .IPs 7 Abilita l'ottimizzazione rate-distortion dei tipi di macroblocco in tutti i -fotogrammi (qualit migliore). +fotogrammi (default). .IPs 8 -Abilita l'ottimizzazione rate-distortion dei vettori di movimento nei -fotogrammi I e P. +Abilita l'ottimizzazione rate-distortion dei vettori di movimento e le modalit +di previsione intra nei fotogrammi I e P. .IPs 9 -Abilita l'ottimizzazione rate-distortion dei vettori di movimento in tutti i -fotogrammi (qualit migliore). +Abilita l'ottimizzazione rate-distortion dei vettori di movimento e le modalit +di previsione intra in tutti i fotogrammi (qualit migliore). .RE .PD 1 .RS -Sopra, 'tutti i tipi di macroblocco candidati' non indica esattamente tutti +Sopra, "tutti i tipi di macroblocco candidati" non indica esattamente tutti i tipi abilitati: 4x4, 4x8, 8x4 vengono provati solo se 8x8 migliore di 16x16. .RE @@ -10890,9 +10915,9 @@ quantizzazione ottimale della rate-distortion .PD 0 .RSs .IPs 0 -disabilitata (default) +disabilitata .IPs 1 -abilitata solo per la codifica finale +abilitata solo per la codifica finale (default) .IPs 2 abilitata durante ogni decisione di modalit (lento, richiede subq>=6) .RE @@ -11047,8 +11072,8 @@ Utilizza questo parametro solo se sai cosa significa ed hai effettivamente bisogno di usarlo. . .TP -.B threads=<1\-4> -Genera diversi thread per codificare in parallelo su CPU multiple (default: 1). +.B threads=<0\-16> +Genera diversi thread per codificare in parallelo su CPU multiple (default: 0). Si ottiene una leggera penalizzazione della compressione. 0 oppure 'auto' dicono a x264 di rilevare il numero delle CPU ed utilizzare un appropriato numero di thread. From cb8796857c8bd851e3b97d729af149e3f003b851 Mon Sep 17 00:00:00 2001 From: ptt Date: Fri, 26 Feb 2010 17:07:22 +0000 Subject: [PATCH 14/14] dots at end of sentences (kai driver section) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30748 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 03ffa36184..0f3bfb1e95 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -2866,9 +2866,9 @@ OS/2 KAI audio output driver .PD 0 .RSs .IPs uniaud -Force UNIAUD mode +Force UNIAUD mode. .IPs dart -Force DART mode +Force DART mode. .IPs (no)share Open audio in shareable or exclusive mode. .IPs bufsize=