"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/xitk/oxine/mediamarks.c" between
xine-ui-0.99.13.tar.bz2 and xine-ui-0.99.14.tar.bz2

About: xine is a free video player which plays mpeg-2 and mpeg-1 video, DVDs (unlocked/unencrypted only), video CDs, SVCDs, and AVI files (using Win32 codecs) with synchronized audio and video, and optionally fullscreen using the Xv extensions in Xfree86 4.x (user interface).

mediamarks.c  (xine-ui-0.99.13.tar.bz2):mediamarks.c  (xine-ui-0.99.14.tar.bz2)
/* /*
* Copyright (C) 2002-2003 Stefan Holst * Copyright (C) 2002-2023 Stefan Holst
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 383 skipping to change at line 383
static char *read_entire_file (const char *mrl, int *file_size) { static char *read_entire_file (const char *mrl, int *file_size) {
char *buf; char *buf;
struct stat statb; struct stat statb;
int fd; int fd;
if (stat (mrl, &statb) < 0) { if (stat (mrl, &statb) < 0) {
printf ("mediamarks: cannot stat '%s'\n", mrl); printf ("mediamarks: cannot stat '%s'\n", mrl);
return NULL; return NULL;
} }
if (statb.st_size > INT_MAX)
return NULL;
*file_size = statb.st_size; *file_size = statb.st_size;
fd = xine_open_cloexec(mrl, O_RDONLY); fd = xine_open_cloexec(mrl, O_RDONLY);
if (fd<0) if (fd<0)
return NULL; return NULL;
/* buf = malloc (sizeof(char)*((*file_size)+1)); */ /* buf = malloc (sizeof(char)*((*file_size)+1)); */
buf = ho_newstring((*file_size)+1); buf = ho_newstring((*file_size)+1);
if (!buf) if (!buf)
return NULL; return NULL;
buf[*file_size]=0;
*file_size = read (fd, buf, *file_size); *file_size = read (fd, buf, *file_size);
if (*file_size < 0)
*file_size = 0;
buf[*file_size]=0;
close (fd); close (fd);
return buf; return buf;
} }
static int file_is_m3u(const char *mrl) { static int file_is_m3u(const char *mrl) {
#ifdef M3U_AS_SUBDIR #ifdef M3U_AS_SUBDIR
skipping to change at line 447 skipping to change at line 451
ho_free(n); ho_free(n);
ho_free(line); ho_free(line);
if( strstr(mrl,".m3u") != NULL || strstr(mrl,".M3U") ) if( strstr(mrl,".m3u") != NULL || strstr(mrl,".M3U") )
return 1; return 1;
else else
return 0; return 0;
#else #else
(void)mrl;
return 0; /* m3u is a normal file here, let xine-ui handle it as playlist */ return 0; /* m3u is a normal file here, let xine-ui handle it as playlist */
#endif #endif
} }
static void parse_m3u(const char *mrl, list_t *items) { static void parse_m3u(const char *mrl, list_t *items) {
FILE *file; FILE *file;
char **line; char **line;
size_t *n; size_t *n;
int a; int a;
skipping to change at line 512 skipping to change at line 517
item = playitem_new (TYPE_DIR, title, NULL, list_new()); item = playitem_new (TYPE_DIR, title, NULL, list_new());
read_subs(node->child, item->sub); read_subs(node->child, item->sub);
} }
playitem_append(item, items); playitem_append(item, items);
node=node->next; node=node->next;
} }
} }
static int read_mediamarks(list_t *list, const char *mrl) { static int read_mediamarks(list_t *list, const char *mrl) {
int size; int size = 0;
char *file = read_entire_file(mrl, &size); char *file = read_entire_file(mrl, &size);
xml_node_t *node; xml_node_t *node;
if (!file) return 0; if (!file) return 0;
xml_parser_init_R (xml_parser_t *xml, file, strlen (file), XML_PARSER_CASE_INS ENSITIVE); xml_parser_init_R (xml_parser_t *xml, file, size, XML_PARSER_CASE_INSENSITIVE) ;
if (xml_parser_build_tree_R (xml, &node)<0) { if (xml_parser_build_tree_R (xml, &node)<0) {
printf("mediamarks: xml parsing of %s failed\n", mrl); printf("mediamarks: xml parsing of %s failed\n", mrl);
xml_parser_finalize_R (xml); xml_parser_finalize_R (xml);
ho_free(file);
return 0; return 0;
} }
if (strcasecmp (node->name, "oxinemm")) { if (strcasecmp (node->name, "oxinemm")) {
printf ("mediamarks: error, root node must be OXINEMM\n"); printf ("mediamarks: error, root node must be OXINEMM\n");
xml_parser_finalize_R (xml); xml_parser_finalize_R (xml);
ho_free(file);
return 0; return 0;
} }
read_subs(node->child, list); read_subs(node->child, list);
xml_parser_free_tree(node); xml_parser_free_tree(node);
xml_parser_finalize_R (xml); xml_parser_finalize_R (xml);
ho_free(file); ho_free(file);
return 1; return 1;
} }
 End of changes. 9 change blocks. 
5 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)