From af58480ece43661fcd9f88e2eb62b5606a561ff0 Mon Sep 17 00:00:00 2001 From: seife Date: Sun, 19 Jun 2011 20:26:17 +0000 Subject: [PATCH] netfile: make f_type const char * Remove lots of unnecessary (and potentially wrong) (char *) casts by making f_type const char *. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1551 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/driver/audiodec/basedec.cpp | 2 +- src/driver/netfile.cpp | 22 +++++++++++----------- src/driver/netfile.h | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/driver/audiodec/basedec.cpp b/src/driver/audiodec/basedec.cpp index 80f3464a9..931c2d416 100644 --- a/src/driver/audiodec/basedec.cpp +++ b/src/driver/audiodec/basedec.cpp @@ -86,7 +86,7 @@ CBaseDec::RetCode CBaseDec::DecoderBase(CAudiofile* const in, fprintf( stderr, "Error adding shoutcast callback: %s", err_txt ); } - if(ftype(fp, (char *) "ogg")) + if (ftype(fp, "ogg")) { Status = COggDec::getInstance()->Decoder( fp, OutputFd, state, &in->MetaData, t, diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index bc89a9e2f..210fc4ce5 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -210,7 +210,7 @@ static int base64_encode(char *dest, const char *src); void getOpts() { - char *dirs[] = { (char *) "/var/etc", (char *) ".", NULL }; + const char *dirs[] = { "/var/etc", ".", NULL }; char buf[4096], *ptr; int i; FILE *fd = NULL; @@ -1103,7 +1103,7 @@ FILE *f_open(const char *filename, const char *acctype) { if (((*(uint32_t *)&(magic[0])) & *(uint32_t *)&(known_magic[i].mask[0])) == *(uint32_t *)&(known_magic[i].mode[0])) { - f_type(fd, (char *)known_magic[i].type); + f_type(fd, known_magic[i].type); goto magic_found; } } @@ -1116,16 +1116,16 @@ FILE *f_open(const char *filename, const char *acctype) if (ptr++) { - if( strcasecmp(ptr, "cdr") == 0) f_type(fd, (char *) "audio/cdr"); - if( strcasecmp(ptr, "wav") == 0) f_type(fd, (char *) "audio/wave"); - if( strcasecmp(ptr, "aif") == 0) f_type(fd, (char *) "audio/aifc"); - if( strcasecmp(ptr, "snd") == 0) f_type(fd, (char *) "audio/snd"); + if (strcasecmp(ptr, "cdr") == 0) f_type(fd, "audio/cdr"); + if (strcasecmp(ptr, "wav") == 0) f_type(fd, "audio/wave"); + if (strcasecmp(ptr, "aif") == 0) f_type(fd, "audio/aifc"); + if (strcasecmp(ptr, "snd") == 0) f_type(fd, "audio/snd"); /* they should be obsolete now due to the file magic detection */ - if( strcasecmp(ptr, "ogg") == 0) f_type(fd, (char *) "audio/ogg"); - if( strcasecmp(ptr, "mp3") == 0) f_type(fd, (char *) "audio/mpeg"); - if( strcasecmp(ptr, "mp2") == 0) f_type(fd, (char *) "audio/mpeg"); - if( strcasecmp(ptr, "mpa") == 0) f_type(fd, (char *) "audio/mpeg"); + if (strcasecmp(ptr, "ogg") == 0) f_type(fd, "audio/ogg"); + if (strcasecmp(ptr, "mp3") == 0) f_type(fd, "audio/mpeg"); + if (strcasecmp(ptr, "mp2") == 0) f_type(fd, "audio/mpeg"); + if (strcasecmp(ptr, "mpa") == 0) f_type(fd, "audio/mpeg"); } magic_found: ; @@ -1279,7 +1279,7 @@ size_t f_read (void *ptr, size_t size, size_t nitems, FILE *stream) return rval; } -char *f_type(FILE *stream, char *type) +const char *f_type(FILE *stream, const char *type) { int i; diff --git a/src/driver/netfile.h b/src/driver/netfile.h index 2c952cc89..e5d157bff 100644 --- a/src/driver/netfile.h +++ b/src/driver/netfile.h @@ -83,7 +83,7 @@ extern long f_tell(FILE *); extern void f_rewind(FILE *); extern int f_seek(FILE *, long, int); extern int f_status(FILE *, void (*)(void*)); -extern char *f_type(FILE*, char*); +extern const char *f_type(FILE*, const char*); extern char err_txt[2048];