From 2c8e1beef30e4e26099b217f37acac743e8b01f9 Mon Sep 17 00:00:00 2001 From: moritz Date: Sat, 3 Mar 2007 20:17:33 +0000 Subject: [PATCH] Some more cosmetic tweaks. git-svn-id: https://svn.xiph.org/trunk/ezstream@12620 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- src/compat.h | 13 +++++++------ src/configfile.c | 12 ++++++------ src/ezstream.c | 2 +- src/strtonum.c | 5 +---- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/compat.h b/src/compat.h index f93c83e..a1fe0e1 100644 --- a/src/compat.h +++ b/src/compat.h @@ -17,18 +17,19 @@ # define _PATH_DEVNULL "nul" -# define strncasecmp strnicmp -# define popen _popen # define pclose _pclose +# define popen _popen # define snprintf _snprintf # define stat _stat +# define strncasecmp strnicmp +# define strtoll _strtoi64 -# define S_IXGRP 0 -# define S_IXOTH 0 -# define S_IWGRP 0 -# define S_IWOTH 0 # define S_IRGRP 0 # define S_IROTH 0 +# define S_IWGRP 0 +# define S_IWOTH 0 +# define S_IXGRP 0 +# define S_IXOTH 0 #else diff --git a/src/configfile.c b/src/configfile.c index 3c9a36c..d6d3deb 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -244,7 +244,7 @@ parseConfig(const char *fileName) const char *errstr; ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - ezConfig.fileNameIsProgram = strtonum(ls_xmlContentPtr, 0, 1, &errstr); + ezConfig.fileNameIsProgram = (int)strtonum(ls_xmlContentPtr, 0, 1, &errstr); if (errstr) { printf("%s[%ld]: Error: may only contain 1 or 0\n", fileName, xmlGetLineNo(cur)); @@ -266,7 +266,7 @@ parseConfig(const char *fileName) const char *errstr; ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - ezConfig.shuffle = strtonum(ls_xmlContentPtr, 0, 1, &errstr); + ezConfig.shuffle = (int)strtonum(ls_xmlContentPtr, 0, 1, &errstr); if (errstr) { printf("%s[%ld]: Error: may only contain 1 or 0\n", fileName, xmlGetLineNo(cur)); @@ -288,7 +288,7 @@ parseConfig(const char *fileName) const char *errstr; ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - ezConfig.streamOnce = strtonum(ls_xmlContentPtr, 0, 1, &errstr); + ezConfig.streamOnce = (int)strtonum(ls_xmlContentPtr, 0, 1, &errstr); if (errstr) { printf("%s[%ld]: Error: may only contain 1 or 0\n", fileName, xmlGetLineNo(cur)); @@ -310,7 +310,7 @@ parseConfig(const char *fileName) const char *errstr; ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - ezConfig.reconnectAttempts = strtonum(ls_xmlContentPtr, 0, UINT_MAX, &errstr); + ezConfig.reconnectAttempts = (unsigned int)strtonum(ls_xmlContentPtr, 0, UINT_MAX, &errstr); if (errstr) { printf("%s[%ld]: Error: In : '%s' is %s\n", fileName, xmlGetLineNo(cur), ls_xmlContentPtr, errstr); @@ -437,7 +437,7 @@ parseConfig(const char *fileName) const char *errstr; ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - ezConfig.serverPublic = strtonum(ls_xmlContentPtr, 0, 1, &errstr); + ezConfig.serverPublic = (int)strtonum(ls_xmlContentPtr, 0, 1, &errstr); if (errstr) { printf("%s[%ld]: Error: may only contain 1 or 0\n", fileName, xmlGetLineNo(cur)); @@ -466,7 +466,7 @@ parseConfig(const char *fileName) const char *errstr; ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1); - ezConfig.reencode = strtonum(ls_xmlContentPtr, 0, 1, &errstr); + ezConfig.reencode = (int)strtonum(ls_xmlContentPtr, 0, 1, &errstr); if (errstr) { printf("%s[%ld]: Error: may only contain 1 or 0\n", fileName, xmlGetLineNo(cur)); diff --git a/src/ezstream.c b/src/ezstream.c index 30095d1..eddda78 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -217,7 +217,7 @@ urlParse(const char *url, char **hostname, int *port, char **mountname) } strlcpy(tmpPort, p2, (p3 - p2) + 1); - *port = strtonum(tmpPort, 1, 65535, &errstr); + *port = (int)strtonum(tmpPort, 1, 65535, &errstr); if (errstr) { printf("%s: Error: Invalid : Port '%s' is %s\n", __progname, tmpPort, errstr); diff --git a/src/strtonum.c b/src/strtonum.c index d2720f5..8672182 100644 --- a/src/strtonum.c +++ b/src/strtonum.c @@ -25,6 +25,7 @@ #include #include #include "strfctns.h" +#include "compat.h" #define INVALID 1 #define TOOSMALL 2 @@ -37,10 +38,6 @@ # define LLONG_MAX LONG_LONG_MAX #endif -#ifdef WIN32 -# define strtoll _strtoi64 -#endif - long long local_strtonum(const char *numstr, long long minval, long long maxval, const char **errstrp)