diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-02-26 14:02:17 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-02-26 14:02:17 +0100 |
commit | cd0f403bbc9005bfb2f9c290a6b6ab0e05d9dfb6 (patch) | |
tree | 8a76fb34cd8d9a25f1f3ebfe9df0e0018bad2ac1 /libsi/util.h | |
parent | aaca30f2ac1c9e7a78f05bd2c81d10a5514cba97 (diff) | |
download | vdr-cd0f403bbc9005bfb2f9c290a6b6ab0e05d9dfb6.tar.gz vdr-cd0f403bbc9005bfb2f9c290a6b6ab0e05d9dfb6.tar.bz2 |
Added some typecasts to silence gcc compiler warnings
Diffstat (limited to 'libsi/util.h')
-rw-r--r-- | libsi/util.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libsi/util.h b/libsi/util.h index e9134cd4..a7f5d602 100644 --- a/libsi/util.h +++ b/libsi/util.h @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: util.h 2.2 2010/11/01 15:24:32 kls Exp $ + * $Id: util.h 2.3 2012/02/26 13:58:26 kls Exp $ * * ***************************************************************************/ @@ -54,10 +54,10 @@ public: template <typename T> const T* getData(int offset) const { return (T*)(data_->data+offset+off); } //sets p to point to data+offset, increments offset template <typename T> void setPointerAndOffset(const T* &p, int &offset) const { p=(T*)getData(offset); offset+=sizeof(T); } - unsigned char operator[](const int index) const { return data_->data ? data_->data[off+index] : 0; } + unsigned char operator[](const int index) const { return data_->data ? data_->data[off+index] : (unsigned char)0; } int getLength() const { return data_->size; } - u_int16_t TwoBytes(const int index) const { return data_->data ? data_->TwoBytes(off+index) : 0; } - u_int32_t FourBytes(const int index) const { return data_->data ? data_->FourBytes(off+index) : 0; } + u_int16_t TwoBytes(const int index) const { return data_->data ? data_->TwoBytes(off+index) : u_int16_t(0); } + u_int32_t FourBytes(const int index) const { return data_->data ? data_->FourBytes(off+index) : u_int32_t(0); } bool isValid() const { return data_->valid; } bool checkSize(int offset) { return (data_->valid && (data_->valid=(offset>=0 && off+offset < data_->size))); } @@ -73,9 +73,9 @@ private: virtual void Delete() = 0; u_int16_t TwoBytes(const int index) const - { return (data[index] << 8) | data[index+1]; } + { return u_int16_t((data[index] << 8) | data[index+1]); } u_int32_t FourBytes(const int index) const - { return (data[index] << 24) | (data[index+1] << 16) | (data[index+2] << 8) | data[index+3]; } + { return u_int32_t((data[index] << 24) | (data[index+1] << 16) | (data[index+2] << 8) | data[index+3]); } /*#ifdef CHARARRAY_THREADSAFE void Lock(); void Unlock(); @@ -140,7 +140,7 @@ private: namespace DVBTime { time_t getTime(unsigned char date_hi, unsigned char date_lo, unsigned char timehr, unsigned char timemi, unsigned char timese); time_t getDuration(unsigned char timehr, unsigned char timemi, unsigned char timese); -inline unsigned char bcdToDec(unsigned char b) { return ((b >> 4) & 0x0F) * 10 + (b & 0x0F); } +inline unsigned char bcdToDec(unsigned char b) { return (unsigned char)(((b >> 4) & 0x0F) * 10 + (b & 0x0F)); } } //taken and adapted from libdtv, (c) Rolf Hakenes |