From 59a0347c8a97407bf3161e44279693492081dfa4 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Mon, 29 Oct 2007 21:16:27 +0000 Subject: [PATCH] Fixes for new compiler with const char*, and fix for vdr 1.5 --- config.c | 16 ++++++++-------- config.h | 16 ++++++++-------- dsock.c | 2 +- dsock.h | 2 +- log.c | 2 +- log.h | 2 +- mvpclient.c | 2 +- mvpreceiver.c | 4 +++- 8 files changed, 24 insertions(+), 22 deletions(-) diff --git a/config.c b/config.c index 08a217a..d4772e1 100644 --- a/config.c +++ b/config.c @@ -164,7 +164,7 @@ int Config::copyRest(FILE* newFile) return 1; } -int Config::deleteValue(char* section, char* key) +int Config::deleteValue(const char* section, char* key) { if (!initted) return 0; if (!openFile()) return 0; @@ -188,7 +188,7 @@ int Config::deleteValue(char* section, char* key) return copyRest(newFile); } -int Config::setValueLong(char* section, char* key, long newValue) +int Config::setValueLong(const char* section, char* key, long newValue) { char longBuffer[50]; sprintf(longBuffer, "%li", newValue); @@ -209,7 +209,7 @@ int Config::setValueDouble(char* section, char* key, double newValue) return setValueString(section, key, doubleBuffer); } -int Config::setValueString(char* section, char* key, char* newValue) +int Config::setValueString(const char* section, const char* key, const char* newValue) { if (!initted) return 0; if (!openFile()) return 0; @@ -263,7 +263,7 @@ int Config::setValueString(char* section, char* key, char* newValue) } } -char* Config::getSectionKeyNames(char* section, int& numberOfReturns, int& allKeysSize) +char* Config::getSectionKeyNames(const char* section, int& numberOfReturns, int& allKeysSize) { numberOfReturns = 0; allKeysSize = 0; @@ -305,7 +305,7 @@ char* Config::getSectionKeyNames(char* section, int& numberOfReturns, int& allKe // END HERE -int Config::findSection(char* section) +int Config::findSection(const char* section) { if (!initted || !file) return 0; if (strlen(section) > (BUFFER_LENGTH-2)) @@ -328,7 +328,7 @@ int Config::findSection(char* section) return 0; } -int Config::findKey(char* key) +int Config::findKey(const char* key) { if (!initted || !file) return 0; @@ -369,7 +369,7 @@ int Config::findKey(char* key) return 0; } -char* Config::getValueString(char* section, char* key) +char* Config::getValueString(const char* section, const char* key) { if (!initted) return NULL; if (!openFile()) return NULL; @@ -395,7 +395,7 @@ char* Config::getValueString(char* section, char* key) return returnString; } -long Config::getValueLong(char* section, char* key, int* failure) +long Config::getValueLong(const char* section, const char* key, int* failure) { *failure = 1; if (!initted) return 0; diff --git a/config.h b/config.h index 58c92d4..e93c221 100644 --- a/config.h +++ b/config.h @@ -42,18 +42,18 @@ class Config int shutdown(); int status(); - char* getValueString(char* section, char* key); - long getValueLong(char* section, char* key, int* failure); + char* getValueString(const char* section, const char* key); + long getValueLong(const char* section, const char* key, int* failure); long long getValueLongLong(char* section, char* key, int* failure); double getValueDouble(char* section, char* key, int* failure); - int setValueString(char* section, char* key, char* newValue); - int setValueLong(char* section, char* key, long newValue); + int setValueString(const char* section, const char* key, const char* newValue); + int setValueLong(const char* section, char* key, long newValue); int setValueLongLong(char* section, char* key, long long newValue); int setValueDouble(char* section, char* key, double newValue); - int deleteValue(char* section, char* key); // err.. delete "key". - char* getSectionKeyNames(char* section, int& numberOfReturns, int& length); + int deleteValue(const char* section, char* key); // err.. delete "key". + char* getSectionKeyNames(const char* section, int& numberOfReturns, int& length); private: pthread_mutex_t fileLock; @@ -70,8 +70,8 @@ class Config int openFile(); void closeFile(); int readLine(); - int findSection(char* section); - int findKey(char* key); + int findSection(const char* section); + int findKey(const char* key); void trim(char* sting); FILE* copyToHere(long position); int copyRest(FILE* newFile); diff --git a/dsock.c b/dsock.c index 4e7b8d9..cd8c880 100644 --- a/dsock.c +++ b/dsock.c @@ -126,7 +126,7 @@ unsigned char DatagramSocket::waitforMessage(unsigned char how) */ } -void DatagramSocket::send(char *ipa, USHORT port, char *message, int length) +void DatagramSocket::send(const char *ipa, USHORT port, char *message, int length) { int sentLength = 0; diff --git a/dsock.h b/dsock.h index 9ce3b9d..ba67360 100644 --- a/dsock.h +++ b/dsock.h @@ -47,7 +47,7 @@ class DatagramSocket bool init(USHORT); // port void shutdown(); unsigned char waitforMessage(unsigned char); // int =0-block =1-new wait =2-continue wait - void send(char *, USHORT, char *, int); // send wants: IP Address ddn style, port, + void send(const char *, USHORT, char *, int); // send wants: IP Address ddn style, port, // data, length of data char* getData(void) { return buf; } // returns a pointer to the data diff --git a/log.c b/log.c index a3cb8ce..335d27d 100755 --- a/log.c +++ b/log.c @@ -94,7 +94,7 @@ int Log::shutdown() return 1; } -int Log::log(char *fromModule, int level, char* message, ...) +int Log::log(const char *fromModule, int level, const char* message, ...) { if (!initted) return 0; diff --git a/log.h b/log.h index 6e4316b..6946ade 100755 --- a/log.h +++ b/log.h @@ -37,7 +37,7 @@ class Log int init(int defaultLevel, char* fileName); int shutdown(); - int log(char *fromModule, int level, char *message, ...); + int log(const char *fromModule, int level, const char *message, ...); void upLogLevel(); void downLogLevel(); diff --git a/mvpclient.c b/mvpclient.c index 6a8c484..5260240 100644 --- a/mvpclient.c +++ b/mvpclient.c @@ -1006,7 +1006,7 @@ int MVPClient::processGetChannelSchedule(UCHAR* data, int length) ULONG sendBufferLength = 100000; ULONG sendBufferUsed = sizeof(ULONG); // leave a hole for the entire packet length - char* empty = ""; + const char* empty = ""; // assign all the event info to temp vars then we know exactly what size they are ULONG thisEventID; diff --git a/mvpreceiver.c b/mvpreceiver.c index ff8b3b0..a7dccea 100755 --- a/mvpreceiver.c +++ b/mvpreceiver.c @@ -25,8 +25,10 @@ MVPReceiver* MVPReceiver::create(cChannel* channel, int priority) MVPReceiver::MVPReceiver(cChannel* channel, cDevice* device) #if VDRVERSNUM < 10300 : cReceiver(channel->Ca(), 0, 7, channel->Vpid(), channel->Ppid(), channel->Apid1(), channel->Apid2(), channel->Dpid1(), channel->Dpid2(), channel->Tpid()) -#else +#elif VDRVERSNUM < 10500 : cReceiver(channel->Ca(), 0, channel->Vpid(), channel->Apids(), channel->Dpids(), channel->Spids()) +#else +: cReceiver(channel->GetChannelID(), 0, channel->Vpid(), channel->Apids(), channel->Dpids(), channel->Spids()) #endif { logger = Log::getInstance(); -- 2.39.2