From cd0f403bbc9005bfb2f9c290a6b6ab0e05d9dfb6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 26 Feb 2012 14:02:17 +0100 Subject: Added some typecasts to silence gcc compiler warnings --- libsi/section.h | 16 ++++++++-------- libsi/util.h | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'libsi') diff --git a/libsi/section.h b/libsi/section.h index 29af7f4b..5b70a220 100644 --- a/libsi/section.h +++ b/libsi/section.h @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: section.h 1.4 2006/04/14 10:53:44 kls Exp $ + * $Id: section.h 2.1 2012/02/26 13:58:26 kls Exp $ * * ***************************************************************************/ @@ -29,7 +29,7 @@ public: int getServiceId() const; int getPid() const; bool isNITPid() const { return getServiceId()==0; } - virtual int getLength() { return sizeof(pat_prog); } + virtual int getLength() { return int(sizeof(pat_prog)); } protected: virtual void Parse(); private: @@ -61,7 +61,7 @@ public: int getPid() const; int getStreamType() const; DescriptorLoop streamDescriptors; - virtual int getLength() { return sizeof(pmt_info)+streamDescriptors.getLength(); } + virtual int getLength() { return int(sizeof(pmt_info)+streamDescriptors.getLength()); } protected: virtual void Parse(); private: @@ -96,7 +96,7 @@ public: public: int getTransportStreamId() const; int getOriginalNetworkId() const; - virtual int getLength() { return sizeof(ni_ts)+transportStreamDescriptors.getLength(); } + virtual int getLength() { return int(sizeof(ni_ts)+transportStreamDescriptors.getLength()); } DescriptorLoop transportStreamDescriptors; protected: virtual void Parse(); @@ -131,7 +131,7 @@ public: int getEITpresentFollowingFlag() const; RunningStatus getRunningStatus() const; int getFreeCaMode() const; - virtual int getLength() { return sizeof(sdt_descr)+serviceDescriptors.getLength(); } + virtual int getLength() { return int(sizeof(sdt_descr)+serviceDescriptors.getLength()); } DescriptorLoop serviceDescriptors; protected: virtual void Parse(); @@ -168,7 +168,7 @@ public: int getFreeCaMode() const; DescriptorLoop eventDescriptors; - virtual int getLength() { return sizeof(eit_event)+eventDescriptors.getLength(); } + virtual int getLength() { return int(sizeof(eit_event)+eventDescriptors.getLength()); } protected: virtual void Parse(); private: @@ -225,7 +225,7 @@ public: int getServiceId() const; int getEventId() const; RunningStatus getRunningStatus() const; - virtual int getLength() { return sizeof(rst_info); } + virtual int getLength() { return int(sizeof(rst_info)); } protected: virtual void Parse(); private: @@ -242,7 +242,7 @@ public: AIT() {} class Application : public LoopElement { public: - virtual int getLength() { return sizeof(ait_app)+applicationDescriptors.getLength(); } + virtual int getLength() { return int(sizeof(ait_app)+applicationDescriptors.getLength()); } long getOrganisationId() const; int getApplicationId() const; int getControlCode() const; 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 const T* getData(int offset) const { return (T*)(data_->data+offset+off); } //sets p to point to data+offset, increments offset template 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 -- cgit v1.2.3