From 19f39258f0b3131345c1b0b3aa1a5c03f88bc33a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 2 Dec 2006 11:30:19 +0100 Subject: [PATCH] Replaced 'unsigned long long' with 'uint32_t' and 'uint64' with 'uint64_t' to avoid problems on 64-bit machines --- HISTORY | 4 +++- font.h | 4 ++-- menu.c | 4 ++-- rcu.c | 8 ++++---- remote.c | 16 ++++++++-------- remote.h | 10 +++++----- tools.c | 8 ++++---- tools.h | 10 +++++----- 8 files changed, 33 insertions(+), 31 deletions(-) diff --git a/HISTORY b/HISTORY index 7aeb1345..2e0bedfc 100644 --- a/HISTORY +++ b/HISTORY @@ -4986,7 +4986,7 @@ Video Disk Recorder Revision History - Fixed displaying the replay mode symbol in case of "Multi speed mode" (reported by Marco Schlüßler). -2006-12-01: Version 1.4.4-1 +2006-12-02: Version 1.4.4-1 - Some improvements to the man pages (thanks to Ville Skyttä). - Fixed a possible segfault in cSkins::Message() (thanks to Udo Richter). @@ -5006,3 +5006,5 @@ Video Disk Recorder Revision History and waiting for 5 minutes before calling it again (thanks to Jörg Wendel for reporting that cPlugin::Active() was called too often, and to Udo Richter for some hints on how to improve this). +- Replaced 'unsigned long long' with 'uint32_t' and 'uint64' with 'uint64_t' to + avoid problems on 64-bit machines. diff --git a/font.h b/font.h index 2a104294..3a3ece42 100644 --- a/font.h +++ b/font.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: font.h 1.12 2006/02/05 13:46:36 kls Exp $ + * $Id: font.h 1.13 2006/12/02 11:11:48 kls Exp $ */ #ifndef __FONT_H @@ -32,7 +32,7 @@ enum eDvbCode { class cFont { public: enum { NUMCHARS = 256 }; - typedef unsigned long tPixelData; + typedef uint32_t tPixelData; struct tCharData { tPixelData width, height; tPixelData lines[1]; diff --git a/menu.c b/menu.c index 870216b7..10a3b266 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.445 2006/11/04 13:13:18 kls Exp $ + * $Id: menu.c 1.446 2006/12/02 11:12:02 kls Exp $ */ #include "menu.h" @@ -3280,7 +3280,7 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) return osEnd; } }; - if (!timeout || lastTime.Elapsed() < (uint64)(Setup.ChannelInfoTime * 1000)) { + if (!timeout || lastTime.Elapsed() < (uint64_t)(Setup.ChannelInfoTime * 1000)) { if (Key == kNone && !number && group < 0 && !NewChannel && channel && channel->Number() != cDevice::CurrentChannel()) { // makes sure a channel switch through the SVDRP CHAN command is displayed channel = Channels.GetByNumber(cDevice::CurrentChannel()); diff --git a/rcu.c b/rcu.c index 39211bb2..d81c0b6a 100644 --- a/rcu.c +++ b/rcu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: rcu.c 1.14 2006/06/16 09:29:24 kls Exp $ + * $Id: rcu.c 1.15 2006/12/02 11:12:28 kls Exp $ */ #include "rcu.h" @@ -97,7 +97,7 @@ void cRcuRemote::Action(void) time_t LastCodeRefresh = 0; cTimeMs FirstTime; unsigned char LastCode = 0, LastMode = 0; - uint64 LastCommand = ~0; // 0x00 might be a valid command + uint64_t LastCommand = ~0; // 0x00 might be a valid command unsigned int LastData = 0; bool repeat = false; @@ -109,13 +109,13 @@ void cRcuRemote::Action(void) buffer.raw[i] = b; if (i == 5) { unsigned short Address = ntohs(buffer.data.address); // the PIC sends bytes in "network order" - uint64 Command = ntohl(buffer.data.command); + uint64_t Command = ntohl(buffer.data.command); if (code == 'B' && Address == 0x0000 && Command == 0x00004000) // Well, well, if it isn't the "d-box"... // This remote control sends the above command before and after // each keypress - let's just drop this: break; - Command |= uint64(Address) << 32; + Command |= uint64_t(Address) << 32; if (Command != LastCommand) { LastCommand = Command; repeat = false; diff --git a/remote.c b/remote.c index 112f6c1b..fa341846 100644 --- a/remote.c +++ b/remote.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.c 1.54 2006/10/14 11:05:57 kls Exp $ + * $Id: remote.c 1.55 2006/12/02 11:12:42 kls Exp $ */ #include "remote.h" @@ -116,7 +116,7 @@ bool cRemote::PutMacro(eKeys Key) return true; } -bool cRemote::Put(uint64 Code, bool Repeat, bool Release) +bool cRemote::Put(uint64_t Code, bool Repeat, bool Release) { char buffer[32]; snprintf(buffer, sizeof(buffer), "%016LX", Code); @@ -203,7 +203,7 @@ cRemotes Remotes; struct tKbdMap { eKbdFunc func; - uint64 code; + uint64_t code; }; static tKbdMap KbdMap[] = { @@ -264,7 +264,7 @@ void cKbdRemote::SetRawMode(bool RawMode) rawMode = RawMode; } -uint64 cKbdRemote::MapFuncToCode(int Func) +uint64_t cKbdRemote::MapFuncToCode(int Func) { for (tKbdMap *p = KbdMap; p->func != kfNone; p++) { if (p->func == Func) @@ -273,7 +273,7 @@ uint64 cKbdRemote::MapFuncToCode(int Func) return (Func <= 0xFF) ? Func : 0; } -int cKbdRemote::MapCodeToFunc(uint64 Code) +int cKbdRemote::MapCodeToFunc(uint64_t Code) { for (tKbdMap *p = KbdMap; p->func != kfNone; p++) { if (p->code == Code) @@ -296,9 +296,9 @@ int cKbdRemote::ReadKey(void) return -1; } -uint64 cKbdRemote::ReadKeySequence(void) +uint64_t cKbdRemote::ReadKeySequence(void) { - uint64 k = 0; + uint64_t k = 0; int key1; if ((key1 = ReadKey()) >= 0) { @@ -342,7 +342,7 @@ uint64 cKbdRemote::ReadKeySequence(void) void cKbdRemote::Action(void) { while (Running()) { - uint64 Command = ReadKeySequence(); + uint64_t Command = ReadKeySequence(); if (Command) { if (rawMode || !Put(Command)) { int func = MapCodeToFunc(Command); diff --git a/remote.h b/remote.h index 4477666b..03be5288 100644 --- a/remote.h +++ b/remote.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.h 1.37 2006/10/14 11:46:58 kls Exp $ + * $Id: remote.h 1.38 2006/12/02 11:12:49 kls Exp $ */ #ifndef __REMOTE_H @@ -35,7 +35,7 @@ protected: cRemote(const char *Name); const char *GetSetup(void); void PutSetup(const char *Setup); - bool Put(uint64 Code, bool Repeat = false, bool Release = false); + bool Put(uint64_t Code, bool Repeat = false, bool Release = false); bool Put(const char *Code, bool Repeat = false, bool Release = false); public: virtual ~cRemote(); @@ -100,13 +100,13 @@ private: struct termios savedTm; virtual void Action(void); int ReadKey(void); - uint64 ReadKeySequence(void); - int MapCodeToFunc(uint64 Code); + uint64_t ReadKeySequence(void); + int MapCodeToFunc(uint64_t Code); public: cKbdRemote(void); virtual ~cKbdRemote(); static bool KbdAvailable(void) { return kbdAvailable; } - static uint64 MapFuncToCode(int Func); + static uint64_t MapFuncToCode(int Func); static void SetRawMode(bool RawMode); }; diff --git a/tools.c b/tools.c index 8ec1e696..255c8061 100644 --- a/tools.c +++ b/tools.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.120 2006/08/12 13:30:07 kls Exp $ + * $Id: tools.c 1.121 2006/12/02 11:12:59 kls Exp $ */ #include "tools.h" @@ -547,11 +547,11 @@ cTimeMs::cTimeMs(void) Set(); } -uint64 cTimeMs::Now(void) +uint64_t cTimeMs::Now(void) { struct timeval t; if (gettimeofday(&t, NULL) == 0) - return (uint64(t.tv_sec)) * 1000 + t.tv_usec / 1000; + return (uint64_t(t.tv_sec)) * 1000 + t.tv_usec / 1000; return 0; } @@ -565,7 +565,7 @@ bool cTimeMs::TimedOut(void) return Now() >= begin; } -uint64 cTimeMs::Elapsed(void) +uint64_t cTimeMs::Elapsed(void) { return Now() - begin; } diff --git a/tools.h b/tools.h index 0d794140..b1313ede 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 1.93 2006/04/16 10:40:45 kls Exp $ + * $Id: tools.h 1.94 2006/12/02 11:14:14 kls Exp $ */ #ifndef __TOOLS_H @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -22,7 +23,6 @@ #include typedef unsigned char uchar; -typedef unsigned long long int uint64; extern int SysLogLevel; @@ -159,13 +159,13 @@ public: class cTimeMs { private: - uint64 begin; + uint64_t begin; public: cTimeMs(void); - static uint64 Now(void); + static uint64_t Now(void); void Set(int Ms = 0); bool TimedOut(void); - uint64 Elapsed(void); + uint64_t Elapsed(void); }; class cReadLine {