"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "utils.c" between
minidlna-1.1.5.tar.gz and minidlna-1.2.0.tar.gz

About: ReadyMedia (formerly known as MiniDLNA) is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients.

utils.c  (minidlna-1.1.5):utils.c  (minidlna-1.2.0)
/* MiniDLNA media server /* MiniDLNA media server
* Copyright (C) 2008-2009 Justin Maggard * Copyright (C) 2008-2017 Justin Maggard
* *
* This file is part of MiniDLNA. * This file is part of MiniDLNA.
* *
* MiniDLNA is free software; you can redistribute it and/or modify * MiniDLNA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* MiniDLNA is distributed in the hope that it will be useful, * MiniDLNA 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
skipping to change at line 64 skipping to change at line 64
int int
ends_with(const char * haystack, const char * needle) ends_with(const char * haystack, const char * needle)
{ {
const char * end; const char * end;
int nlen = strlen(needle); int nlen = strlen(needle);
int hlen = strlen(haystack); int hlen = strlen(haystack);
if( nlen > hlen ) if( nlen > hlen )
return 0; return 0;
end = haystack + hlen - nlen; end = haystack + hlen - nlen;
return (strcasecmp(end, needle) ? 0 : 1); return (strcasecmp(end, needle) ? 0 : 1);
} }
char * char *
trim(char *str) trim(char *str)
{ {
int i; int i;
int len; int len;
skipping to change at line 234 skipping to change at line 234
esc_tag = modifyString(esc_tag, ">", ">", 0); esc_tag = modifyString(esc_tag, ">", ">", 0);
esc_tag = modifyString(esc_tag, "\"", """, 0); esc_tag = modifyString(esc_tag, "\"", """, 0);
} }
else if( force_alloc ) else if( force_alloc )
esc_tag = strdup(tag); esc_tag = strdup(tag);
return esc_tag; return esc_tag;
} }
char * char *
duration_str(int msec)
{
char *str;
xasprintf(&str, "%d:%02d:%02d.%03d",
(msec / 3600000),
(msec / 60000 % 60),
(msec / 1000 % 60),
(msec % 1000));
return str;
}
char *
strip_ext(char *name) strip_ext(char *name)
{ {
char *period; char *period;
period = strrchr(name, '.'); period = strrchr(name, '.');
if (period) if (period)
*period = '\0'; *period = '\0';
return period; return period;
} }
skipping to change at line 285 skipping to change at line 299
/* If we failed for any other reason than the directory /* If we failed for any other reason than the directory
* already exists, output a diagnostic and return -1.*/ * already exists, output a diagnostic and return -1.*/
if ((errno != EEXIST && errno != EISDIR) if ((errno != EEXIST && errno != EISDIR)
|| (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) { || (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) {
DPRINTF(E_WARN, L_GENERAL, "make_dir: cannot crea te directory '%s'\n", path); DPRINTF(E_WARN, L_GENERAL, "make_dir: cannot crea te directory '%s'\n", path);
if (c) if (c)
*s = c; *s = c;
return -1; return -1;
} }
} }
if (!c) if (!c)
return 0; return 0;
/* Remove any inserted nul from the path. */ /* Remove any inserted nul from the path. */
*s = c; *s = c;
} while (1); } while (1);
} }
/* Simple, efficient hash function from Daniel J. Bernstein */ /* Simple, efficient hash function from Daniel J. Bernstein */
unsigned int unsigned int
 End of changes. 4 change blocks. 
3 lines changed or deleted 17 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS