Mercurial > mplayer.hg
comparison gui/util/list.c @ 35493:411875efca3f
Introduce boolean symbolic constants.
Use them wherever suitable and useful to make code easier to read.
author | ib |
---|---|
date | Tue, 04 Dec 2012 18:36:14 +0000 |
parents | 58a221f73d75 |
children | e27855a45128 |
comparison
equal
deleted
inserted
replaced
35492:5cbbd9ca4010 | 35493:411875efca3f |
---|---|
23 | 23 |
24 #include <stdlib.h> | 24 #include <stdlib.h> |
25 #include <string.h> | 25 #include <string.h> |
26 | 26 |
27 #include "list.h" | 27 #include "list.h" |
28 #include "gui/gui.h" | |
28 #include "string.h" | 29 #include "string.h" |
29 | 30 |
30 #include "mp_msg.h" | 31 #include "mp_msg.h" |
31 #include "path.h" | 32 #include "path.h" |
32 | 33 |
327 * @brief Append or insert a file to the playlist. | 328 * @brief Append or insert a file to the playlist. |
328 * | 329 * |
329 * @param what file to be added | 330 * @param what file to be added |
330 * @param how command (#PLAYLIST_ITEM_APPEND or #PLAYLIST_ITEM_INSERT) to be performed | 331 * @param how command (#PLAYLIST_ITEM_APPEND or #PLAYLIST_ITEM_INSERT) to be performed |
331 * | 332 * |
332 * @return 1 (ok) or 0 (error) | 333 * @return #True (ok) or #False (error) |
333 */ | 334 */ |
334 int add_to_gui_playlist(const char *what, int how) | 335 int add_to_gui_playlist(const char *what, int how) |
335 { | 336 { |
336 const char *file; | 337 const char *file; |
337 char *path; | 338 char *path; |
338 plItem *item; | 339 plItem *item; |
339 | 340 |
340 if (!what || !*what || (how != PLAYLIST_ITEM_APPEND && how != PLAYLIST_ITEM_INSERT)) | 341 if (!what || !*what || (how != PLAYLIST_ITEM_APPEND && how != PLAYLIST_ITEM_INSERT)) |
341 return 0; | 342 return False; |
342 | 343 |
343 file = mp_basename(what); | 344 file = mp_basename(what); |
344 path = strdup(what); | 345 path = strdup(what); |
345 | 346 |
346 if (file > what) | 347 if (file > what) |
349 strcpy(path, "."); | 350 strcpy(path, "."); |
350 | 351 |
351 item = calloc(1, sizeof(plItem)); | 352 item = calloc(1, sizeof(plItem)); |
352 | 353 |
353 if (!item) | 354 if (!item) |
354 return 0; | 355 return False; |
355 | 356 |
356 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[list] adding %s/%s\n", path, file); | 357 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[list] adding %s/%s\n", path, file); |
357 | 358 |
358 item->name = strdup(file); | 359 item->name = strdup(file); |
359 item->path = path; | 360 item->path = path; |
360 | 361 |
361 listMgr(how, item); | 362 listMgr(how, item); |
362 | 363 |
363 return 1; | 364 return True; |
364 } | 365 } |