Enlightenment CVS committal

Author  : tsauerbeck
Project : misc
Module  : eplayer

Dir     : misc/eplayer/src


Modified Files:
        eplayer.c eplayer.h playlist.c playlist.h 


Log Message:
use bool, true and false instead of int, 1 and 0, where it's appropriate
===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/eplayer.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- eplayer.c   31 Jan 2004 10:35:39 -0000      1.28
+++ eplayer.c   31 Jan 2004 10:49:11 -0000      1.29
@@ -48,7 +48,7 @@
        return 0;
 }
 
-static int load_input_plugins(ePlayer *player) {
+static bool load_input_plugins(ePlayer *player) {
        char path[PATH_MAX * 2 + 1];
 
        snprintf(path, sizeof(path), "%s/.e/apps/" PACKAGE "/plugins/input:"
@@ -68,16 +68,16 @@
        snprintf(cfg->theme, sizeof(cfg->theme), "default");
 }
 
-static int config_load(Config *cfg, const char *file) {
+static bool config_load(Config *cfg, const char *file) {
        E_DB_File *edb;
        char *str;
        int val = 0;
        
        if (!cfg || !file || !*file)
-               return 0;
+               return false;
 
        if (!(edb = e_db_open_read((char *) file)))
-               return 0;
+               return false;
 
        if (e_db_int_get(edb, "/eplayer/time_display_show_left", &val))
                cfg->time_display = !!val;
@@ -97,7 +97,7 @@
                free(str);
        }
 
-       return 1;
+       return true;
 }
 
 static void eplayer_free(ePlayer *player) {
@@ -124,7 +124,7 @@
        free(player);
 }
 
-static int load_output_plugin(ePlayer *player) {
+static bool load_output_plugin(ePlayer *player) {
        char path[PATH_MAX * 2 + 2], name[64];
 
        snprintf(path, sizeof(path), "%s/.e/apps/" PACKAGE "/plugins/output:"
@@ -231,14 +231,15 @@
  *
  * @param player
  * @param rewind_track
+ * @return boolean success or failure
  */
-int eplayer_playback_start(ePlayer *player, int rewind_track) {
+bool eplayer_playback_start(ePlayer *player, bool rewind_track) {
        PlayListItem *pli;
 
        assert(player);
        
        if (!(pli = playlist_current_item_get(player->playlist)))
-               return 0;
+               return false;
 
        if (rewind_track)
                track_rewind(player);
@@ -254,7 +255,7 @@
        pthread_create(&player->playback_thread, NULL,
                       (void *) &track_play_chunk, player);
 
-       return 1;
+       return true;
 }
 
 /**
===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/eplayer.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- eplayer.h   31 Jan 2004 10:35:39 -0000      1.21
+++ eplayer.h   31 Jan 2004 10:49:11 -0000      1.22
@@ -58,7 +58,7 @@
 } ePlayer;
 
 void eplayer_playback_stop(ePlayer *player);
-int eplayer_playback_start(ePlayer *player, int rewind_track);
+bool eplayer_playback_start(ePlayer *player, bool rewind_track);
 
 #endif
 
===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/playlist.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- playlist.c  30 Jan 2004 20:53:15 -0000      1.18
+++ playlist.c  31 Jan 2004 10:49:11 -0000      1.19
@@ -146,42 +146,42 @@
                pl->cur_item = evas_list_find_list(pl->items, pli);
 }
 
-int playlist_current_item_has_next(PlayList *pl) {
-       return pl ? !!pl->cur_item->next : 0;
+bool playlist_current_item_has_next(PlayList *pl) {
+       return pl ? !!pl->cur_item->next : false;
 }
 
-int playlist_current_item_has_prev(PlayList *pl) {
-       return pl ? !!pl->cur_item->prev : 0;
+bool playlist_current_item_has_prev(PlayList *pl) {
+       return pl ? !!pl->cur_item->prev : false;
 }
 
 /**
  * Moves the current item of a PlayList to the next item.
  *
  * @param pl
- * return 1 if the current item has been set to the beginning, else 0
+ * @return true if the current item has been set to the beginning, else false
  */
-int playlist_current_item_next(PlayList *pl) {
+bool playlist_current_item_next(PlayList *pl) {
        if (!pl)
-               return 0;
+               return false;
        
        if (pl->cur_item->next) {
                pl->cur_item = pl->cur_item->next;
-               return 0;
+               return false;
        } else { /* move to the beginning */
                pl->cur_item = pl->items;
-               return 1;
+               return true;
        }
 }
 
-int playlist_current_item_prev(PlayList *pl) {
+bool playlist_current_item_prev(PlayList *pl) {
        if (!pl)
-               return 0;
+               return false;
 
        if (playlist_current_item_has_prev(pl)) {
                pl->cur_item = pl->cur_item->prev;
-               return 1;
+               return true;
        } else
-               return 0;
+               return false;
 }
 
 /**
@@ -226,11 +226,11 @@
  * @param append If 0, the old entries will be overwritten.
  * @return Boolean success or failure.
  */
-int playlist_load_file(PlayList *pl, const char *file, int append) {
+bool playlist_load_file(PlayList *pl, const char *file, bool append) {
        PlayListItem *pli;
        
        if (!pl || !(pli = playlist_item_new(pl->plugins, file)))
-               return 0;
+               return false;
 
        if (!append)
                playlist_remove_all(pl);
@@ -243,10 +243,10 @@
        pl->num++;
        pl->duration += pli->duration;
 
-       return 1;
+       return true;
 }
 
-static void finish_playlist(PlayList *pl, Evas_List *list, int append) {
+static void finish_playlist(PlayList *pl, Evas_List *list, bool append) {
        list = evas_list_reverse(list);
        
        if (append)
@@ -267,13 +267,13 @@
  * @param append If 0, the old entries will be overwritten.
  * @return Boolean success or failure.
  */
-int playlist_load_dir(PlayList *pl, const char *path, int append) {
+bool playlist_load_dir(PlayList *pl, const char *path, bool append) {
        DIR *dir;
        struct dirent *entry;
        char buf[PATH_MAX + 1];
 
        if (!pl || !(dir = opendir(path)))
-               return 0;
+               return false;
 
        while ((entry = readdir(dir))) {
                if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
@@ -288,7 +288,7 @@
        if (!pl->cur_item || !pl->cur_item->data)
                pl->cur_item = pl->items;
 
-       return 1;
+       return true;
 }
 
 /**
@@ -299,7 +299,7 @@
  * @param append If 0, the old entries will be overwritten.
  * @return Boolean success or failure.
  */
-int playlist_load_m3u(PlayList *pl, const char *file, int append) {
+bool playlist_load_m3u(PlayList *pl, const char *file, bool append) {
        PlayListItem *pli = NULL;
        Evas_List *tmp = NULL;
        FILE *fp;
@@ -307,7 +307,7 @@
        char *ptr;
 
        if (!pl || !(fp = fopen(file, "r")))
-               return 0;
+               return false;
 
        if ((ptr = strrchr(file, '/'))) {
                snprintf(dir, sizeof(dir), "%s", file);
@@ -335,7 +335,7 @@
 
        finish_playlist(pl, tmp, append);
        
-       return 1;
+       return true;
 }
 
 /**
@@ -343,10 +343,10 @@
  *
  * @param pl
  * @param path
- * @param append If 0, the old entries will be overwritten.
+ * @param append If false, the old entries will be overwritten.
  * @return Boolean success or failure.
  */
-int playlist_load_any(PlayList *pl, const char *path, int append) {
+bool playlist_load_any(PlayList *pl, const char *path, bool append) {
        int len;
        
        if (is_dir(path))
===================================================================
RCS file: /cvsroot/enlightenment/misc/eplayer/src/playlist.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- playlist.h  29 Jan 2004 14:28:37 -0000      1.10
+++ playlist.h  31 Jan 2004 10:49:11 -0000      1.11
@@ -6,10 +6,6 @@
 #include <pthread.h>
 #include "plugin.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 typedef struct {
        char file[PATH_MAX + 1];
 
@@ -39,10 +35,10 @@
 PlayList *playlist_new(Evas_List *plugins);
 void playlist_free();
 
-int playlist_load_file(PlayList *pl, const char *file, int append);
-int playlist_load_dir(PlayList *pl, const char *dir, int append);
-int playlist_load_m3u(PlayList *pl, const char *file, int append);
-int playlist_load_any(PlayList *pl, const char *path, int append);
+bool playlist_load_file(PlayList *pl, const char *file, bool append);
+bool playlist_load_dir(PlayList *pl, const char *dir, bool append);
+bool playlist_load_m3u(PlayList *pl, const char *file, bool append);
+bool playlist_load_any(PlayList *pl, const char *path, bool append);
 
 void playlist_remove_all(PlayList *pl);
 void playlist_remove_item(PlayList *pl, PlayListItem *pli);
@@ -50,14 +46,10 @@
 PlayListItem *playlist_current_item_get(PlayList *pl);
 void playlist_current_item_set(PlayList *pl, PlayListItem *pli);
 
-int playlist_current_item_prev(PlayList *pl);
-int playlist_current_item_next(PlayList *pl);
+bool playlist_current_item_prev(PlayList *pl);
+bool playlist_current_item_next(PlayList *pl);
 
-int playlist_current_item_has_prev(PlayList *pl);
-int playlist_current_item_has_next(PlayList *pl);
-
-#ifdef __cplusplus
-}
-#endif
+bool playlist_current_item_has_prev(PlayList *pl);
+bool playlist_current_item_has_next(PlayList *pl);
 
 #endif




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to