Mercurial > mplayer.hg
changeset 34610:4ff933a89818
Cosmetic: Rename functions in list.c.
Additionally, change a parameter name of new listMgr()
and add some doxygen comments to list.h.
author | ib |
---|---|
date | Sun, 12 Feb 2012 18:44:19 +0000 |
parents | a8497c26c9f1 |
children | f1a31e5fc35f |
files | gui/cfg.c gui/interface.c gui/ui/actions.c gui/ui/gtk/playlist.c gui/ui/gtk/preferences.c gui/ui/gtk/url.c gui/ui/main.c gui/util/list.c gui/util/list.h gui/win32/interface.c gui/win32/preferences.c |
diffstat | 11 files changed, 54 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/cfg.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/cfg.c Sun Feb 12 18:44:19 2012 +0000 @@ -291,7 +291,7 @@ if (fgetstr(line, sizeof(line), file) && *line) { item->name = strdup(line); - listSet(gtkAddPlItem, item); + listMgr(gtkAddPlItem, item); } else { free(item->path); free(item); @@ -323,7 +323,7 @@ } item->url = strdup(line); - listSet(gtkAddURLItem, item); + listMgr(gtkAddURLItem, item); } fclose(file);
--- a/gui/interface.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/interface.c Sun Feb 12 18:44:19 2012 +0000 @@ -268,8 +268,8 @@ } appFreeStruct(); - listSet(gtkDelPl, NULL); - listSet(gtkDelURL, NULL); + listMgr(gtkDelPl, NULL); + listMgr(gtkDelURL, NULL); free(guiIcon.collection); if (gui_conf) { @@ -449,7 +449,7 @@ while (video_out_drivers[i++]) { if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) { - gaddlist(&video_driver_list, (char *)video_out_drivers[i - 1]->info->short_name); + listSet(&video_driver_list, (char *)video_out_drivers[i - 1]->info->short_name); break; } } @@ -487,10 +487,10 @@ // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } if (gtkAONorm) - greplace(&af_cfg.list, "volnorm", "volnorm"); + listRepl(&af_cfg.list, "volnorm", "volnorm"); if (gtkEnableAudioEqualizer) - greplace(&af_cfg.list, "equalizer", "equalizer"); + listRepl(&af_cfg.list, "equalizer", "equalizer"); if (gtkAOExtraStereo) { char *name; @@ -498,7 +498,7 @@ name = malloc(12 + 20 + 1); snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); name[12 + 20] = 0; - greplace(&af_cfg.list, "extrastereo", name); + listRepl(&af_cfg.list, "extrastereo", name); free(name); } @@ -514,7 +514,7 @@ } else tmp = strdup("oss"); - gaddlist(&audio_driver_list, tmp); + listSet(&audio_driver_list, tmp); free(tmp); } @@ -530,7 +530,7 @@ } else tmp = strdup("alsa"); - gaddlist(&audio_driver_list, tmp); + listSet(&audio_driver_list, tmp); free(tmp); } @@ -543,7 +543,7 @@ } else tmp = strdup("sdl"); - gaddlist(&audio_driver_list, tmp); + listSet(&audio_driver_list, tmp); free(tmp); } @@ -556,7 +556,7 @@ } else tmp = strdup("esd"); - gaddlist(&audio_driver_list, tmp); + listSet(&audio_driver_list, tmp); free(tmp); } @@ -777,7 +777,7 @@ break; } - if (guiInfo.Playing && (next = listSet(gtkGetNextPlItem, NULL)) && (plLastPlayed != next)) { + if (guiInfo.Playing && (next = listMgr(gtkGetNextPlItem, NULL)) && (plLastPlayed != next)) { plLastPlayed = next; uiSetFileName(next->path, next->name, STREAMTYPE_FILE); guiInfo.NewPlay = GUI_FILE_NEW; @@ -858,9 +858,9 @@ item->path = pathname; if (insert) - listSet(gtkInsertPlItem, item); // inserts the item after current, and makes current=item + listMgr(gtkInsertPlItem, item); // inserts the item after current, and makes current=item else - listSet(gtkAddPlItem, item); + listMgr(gtkAddPlItem, item); return 1; } @@ -875,7 +875,7 @@ int result = 0; if (!enqueue) - listSet(gtkDelPl, NULL); // delete playlist before "appending" + listMgr(gtkDelPl, NULL); // delete playlist before "appending" if ((my_pt_iter = pt_iter_create(&my_playtree, config))) { while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) @@ -904,7 +904,7 @@ int result = 0; plItem *save; - save = (plItem *)listSet(gtkGetCurrPlItem, NULL); // save current item + save = (plItem *)listMgr(gtkGetCurrPlItem, NULL); // save current item if ((my_pt_iter = pt_iter_create(&my_playtree, config))) { while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) @@ -916,12 +916,12 @@ } if (save) - listSet(gtkSetCurrPlItem, save); + listMgr(gtkSetCurrPlItem, save); else - listSet(gtkSetCurrPlItem, plList); // go to head, if plList was empty before + listMgr(gtkSetCurrPlItem, plList); // go to head, if plList was empty before if (save && result) - listSet(gtkDelCurrPlItem, NULL); + listMgr(gtkDelCurrPlItem, NULL); uiCurr(); // update filename
--- a/gui/ui/actions.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/ui/actions.c Sun Feb 12 18:44:19 2012 +0000 @@ -254,7 +254,7 @@ default: - curr = listSet(gtkGetCurrPlItem, NULL); + curr = listMgr(gtkGetCurrPlItem, NULL); if (curr) { uiSetFileName(curr->path, curr->name, STREAMTYPE_FILE); @@ -310,7 +310,7 @@ default: - prev = listSet(gtkGetPrevPlItem, NULL); + prev = listMgr(gtkGetPrevPlItem, NULL); if (prev) { uiSetFileName(prev->path, prev->name, STREAMTYPE_FILE); @@ -371,7 +371,7 @@ default: - next = listSet(gtkGetNextPlItem, NULL); + next = listMgr(gtkGetNextPlItem, NULL); if (next) { uiSetFileName(next->path, next->name, STREAMTYPE_FILE);
--- a/gui/ui/gtk/playlist.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/ui/gtk/playlist.c Sun Feb 12 18:44:19 2012 +0000 @@ -191,7 +191,7 @@ case 1: // ok { int i; - if ( plList ) listSet( gtkDelPl,NULL ); + if ( plList ) listMgr( gtkDelPl,NULL ); for ( i=0;i<NrOfSelected;i++ ) { plItem * item; @@ -203,7 +203,7 @@ if ( !item->name ) item->name = strdup( text[0] ); item->path=g_filename_from_utf8( text[1], -1, NULL, NULL, NULL ); if ( !item->path ) item->path = strdup( text[1] ); - listSet( gtkAddPlItem,item ); + listMgr( gtkAddPlItem,item ); } if ( plCurrent ) {
--- a/gui/ui/gtk/preferences.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/ui/gtk/preferences.c Sun Feb 12 18:44:19 2012 +0000 @@ -537,8 +537,8 @@ mplayer( MPLAYER_SET_EXTRA_STEREO,HSExtraStereoMuladj->value,0 ); audio_delay=HSAudioDelayadj->value; - gaddlist( &audio_driver_list,ao_driver[0] ); - gaddlist( &video_driver_list,vo_driver[0] ); + listSet( &audio_driver_list,ao_driver[0] ); + listSet( &video_driver_list,vo_driver[0] ); // -- 2. page vo_doublebuffering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ) ); @@ -599,7 +599,7 @@ const char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) ); for( i=0;mpcodecs_vd_drivers[i];i++ ) if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) ) - { gaddlist( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; } + { listSet( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; } } { @@ -607,7 +607,7 @@ const char * tmp = gtk_entry_get_text( GTK_ENTRY( EAFM ) ); for( i=0;mpcodecs_ad_drivers[i];i++ ) if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) ) - { gaddlist( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; } + { listSet( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; } } // --- 6. page
--- a/gui/ui/gtk/url.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/ui/gtk/url.c Sun Feb 12 18:44:19 2012 +0000 @@ -101,7 +101,7 @@ item=calloc( 1,sizeof( urlItem ) ); item->url=gstrdup( str ); - listSet( gtkAddURLItem,item ); + listMgr( gtkAddURLItem,item ); uiSetFileName( NULL,str,STREAMTYPE_STREAM ); guiInfo.NewPlay=GUI_FILE_NEW; uiEventHandling( evPlay,0 );
--- a/gui/ui/main.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/ui/main.c Sun Feb 12 18:44:19 2012 +0000 @@ -111,7 +111,7 @@ nfree(guiInfo.Filename); nfree(guiInfo.SubtitleFilename); nfree(guiInfo.AudioFilename); - listSet(gtkDelPl, NULL); + listMgr(gtkDelPl, NULL); } if (what & CLEAR_VCD) guiInfo.Tracks = 0; @@ -208,9 +208,9 @@ if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == GUI_PAUSE ) ) goto NoPause; - if ( listSet( gtkGetCurrPlItem,NULL ) &&( guiInfo.StreamType == STREAMTYPE_FILE ) ) + if ( listMgr( gtkGetCurrPlItem,NULL ) &&( guiInfo.StreamType == STREAMTYPE_FILE ) ) { - plItem * next = listSet( gtkGetCurrPlItem,NULL ); + plItem * next = listMgr( gtkGetCurrPlItem,NULL ); plLastPlayed=next; uiSetFileName( next->path,next->name,SAME_STREAMTYPE ); } @@ -271,7 +271,7 @@ uiMainAutoPlay=1; // guiInfo.StreamType=STREAMTYPE_FILE; case evLoad: - listSet( gtkDelPl,NULL ); + listMgr( gtkDelPl,NULL ); gtkShow( evLoad,NULL ); break; case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break; @@ -643,7 +643,7 @@ /* clear playlist */ if (filename == NULL) { filename = files[f]; - listSet(gtkDelPl,NULL); + listMgr(gtkDelPl,NULL); } item = calloc(1,sizeof(plItem)); @@ -658,7 +658,7 @@ item->name = strdup(str); item->path = strdup(""); } - listSet(gtkAddPlItem,item); + listMgr(gtkAddPlItem,item); } else { mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotAFile,str ); }
--- a/gui/util/list.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/util/list.c Sun Feb 12 18:44:19 2012 +0000 @@ -28,10 +28,10 @@ urlItem *urlList; -void *listSet(int cmd, void *vparam) +void *listMgr(int cmd, void *data) { - plItem *item = (plItem *)vparam; - urlItem *url_item = (urlItem *)vparam; + plItem *item = (plItem *)data; + urlItem *url_item = (urlItem *)data; int is_added = 1; switch (cmd) { @@ -72,7 +72,7 @@ return plCurrent; } else - return listSet(gtkAddPlItem, item); + return listMgr(gtkAddPlItem, item); // get next item from playlist case gtkGetNextPlItem: @@ -192,7 +192,7 @@ /** * \brief This actually creates a new list containing only one element... */ -void gaddlist(char ***list, const char *entry) +void listSet(char ***list, const char *entry) { int i; @@ -212,7 +212,7 @@ * \brief This replaces a string starting with search by replace. * If not found, replace is appended. */ -void greplace(char ***list, const char *search, const char *replace) +void listRepl(char ***list, const char *search, const char *replace) { int i = 0; int len = (search ? strlen(search) : 0);
--- a/gui/util/list.h Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/util/list.h Sun Feb 12 18:44:19 2012 +0000 @@ -47,8 +47,13 @@ extern urlItem *urlList; -void gaddlist(char ***list, const char *entry); -void greplace(char ***list, const char *search, const char *replace); -void *listSet(int cmd, void *vparam); +/// list manager (playlist, URL list) +void *listMgr(int cmd, void *data); + +//@{ +/// char pointer list operations +void listRepl(char ***list, const char *search, const char *replace); +void listSet(char ***list, const char *entry); +//@} #endif /* MPLAYER_GUI_LIST_H */
--- a/gui/win32/interface.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/win32/interface.c Sun Feb 12 18:44:19 2012 +0000 @@ -601,13 +601,13 @@ } } guiInfo.VideoWindow = 1; - if(gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm"); + if(gtkAONorm) listRepl(&af_cfg.list, "volnorm", "volnorm"); if(gtkAOExtraStereo) { char *name = malloc(12 + 20 + 1); snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); name[12 + 20] = 0; - greplace(&af_cfg.list, "extrastereo", name); + listRepl(&af_cfg.list, "extrastereo", name); free(name); } if(gtkCacheOn) stream_cache_size = gtkCacheSize;
--- a/gui/win32/preferences.c Sun Feb 12 18:39:27 2012 +0000 +++ b/gui/win32/preferences.c Sun Feb 12 18:44:19 2012 +0000 @@ -347,7 +347,7 @@ while(video_out_drivers[i]) { const vo_info_t *info = video_out_drivers[i++]->info; - if(!video_driver_list) gaddlist(&video_driver_list, (char *)info->short_name); + if(!video_driver_list) listSet(&video_driver_list, (char *)info->short_name); SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name); } /* Special case for directx:noaccel */ @@ -361,7 +361,7 @@ { // FIXME: default priority (i.e. order in audio_out_drivers) should be fixed instead // if win32 as default is really desirable - gaddlist(&audio_driver_list, "win32"/*(char *)info->short_name*/); + listSet(&audio_driver_list, "win32"/*(char *)info->short_name*/); } SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name); }