From 4ed9d9539469ef25c105b63a8a5274c6f5cf257a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 27 Mar 2011 15:12:20 +0200 Subject: Replaced "%lld" and "%llX" print format specifiers with "PRId64" and "PRIX64" --- CONTRIBUTORS | 1 + HISTORY | 6 ++++++ dvbsubtitle.c | 13 ++++++++----- recording.c | 6 ++++-- remote.c | 6 ++++-- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 3cea2779..1fa08903 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2681,3 +2681,4 @@ Juergen Lock Sergiu Dotenco for reporting a missing initialization in sDvbSpuRect + for replacing "%lld" and "%llX" print format specifiers with "PRId64" and "PRIX64" diff --git a/HISTORY b/HISTORY index 317deeaa..e72ae7e4 100644 --- a/HISTORY +++ b/HISTORY @@ -6583,3 +6583,9 @@ Video Disk Recorder Revision History - Fixed scaling subtitles in case the OSD size is exactly the same as the display size of the subtitles. - Added a missing initialization to sDvbSpuRect (reported by Sergiu Dotenco). +- Replaced "%lld" and "%llX" print format specifiers with "PRId64" and "PRIX64" to + avoid compiler warnings with gcc 4.5.2 (thanks to Sergiu Dotenco). + On a personal note: I find it a step in the totally wrong direction that there + have been macros introduced to work around this problem in the first place. There + should have been "real" format specifiers defined that address this. These macros + are nothing but an ugly workaround. diff --git a/dvbsubtitle.c b/dvbsubtitle.c index 3e7c1911..a475e864 100644 --- a/dvbsubtitle.c +++ b/dvbsubtitle.c @@ -7,10 +7,13 @@ * Original author: Marco Schlüßler * With some input from the "subtitle plugin" by Pekka Virtanen * - * $Id: dvbsubtitle.c 2.15 2011/03/27 13:52:58 kls Exp $ + * $Id: dvbsubtitle.c 2.16 2011/03/27 15:02:12 kls Exp $ */ + #include "dvbsubtitle.h" +#define __STDC_FORMAT_MACROS // Required for format specifiers +#include #include "device.h" #define PAGE_COMPOSITION_SEGMENT 0x10 @@ -735,7 +738,7 @@ int cDvbSubtitleConverter::ConvertFragments(const uchar *Data, int Length) if (Length > PayloadOffset + SubstreamHeaderLength) { int64_t pts = PesHasPts(Data) ? PesGetPts(Data) : 0; if (pts) - dbgconverter("Converter PTS: %lld\n", pts); + dbgconverter("Converter PTS: %"PRId64"\n", pts); const uchar *data = Data + PayloadOffset + SubstreamHeaderLength; // skip substream header int length = Length - PayloadOffset - SubstreamHeaderLength; // skip substream header if (ResetSubtitleAssembler) @@ -771,7 +774,7 @@ int cDvbSubtitleConverter::Convert(const uchar *Data, int Length) if (Length > PayloadOffset) { int64_t pts = PesGetPts(Data); if (pts) - dbgconverter("Converter PTS: %lld\n", pts); + dbgconverter("Converter PTS: %"PRId64"\n", pts); const uchar *data = Data + PayloadOffset; int length = Length - PayloadOffset; if (length > 3) { @@ -830,7 +833,7 @@ void cDvbSubtitleConverter::Action(void) if (AssertOsd()) { sb->Draw(osd); Timeout.Set(sb->Timeout() * 1000); - dbgconverter("PTS: %lld STC: %lld (%lld) timeout: %d\n", sb->Pts(), cDevice::PrimaryDevice()->GetSTC(), Delta, sb->Timeout()); + dbgconverter("PTS: %"PRId64" STC: %"PRId64" (%"PRId64") timeout: %d\n", sb->Pts(), cDevice::PrimaryDevice()->GetSTC(), Delta, sb->Timeout()); } bitmaps->Del(sb); } @@ -920,7 +923,7 @@ int cDvbSubtitleConverter::ExtractSegment(const uchar *Data, int Length, int64_t page->SetTimeout(Data[6]); page->SetState((Data[6 + 1] & 0x0C) >> 2); page->regions.Clear(); - dbgpages("Update page id %d version %d pts %lld timeout %d state %d\n", pageId, page->Version(), page->Pts(), page->Timeout(), page->State()); + dbgpages("Update page id %d version %d pts %"PRId64" timeout %d state %d\n", pageId, page->Version(), page->Pts(), page->Timeout(), page->State()); for (int i = 6 + 2; i < segmentLength; i += 6) { cSubtitleRegion *region = page->GetRegionById(Data[i], true); region->SetHorizontalAddress((Data[i + 2] << 8) + Data[i + 3]); diff --git a/recording.c b/recording.c index 97109457..ca8d6380 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.27 2011/03/20 10:33:30 kls Exp $ + * $Id: recording.c 2.28 2011/03/27 15:02:53 kls Exp $ */ #include "recording.h" @@ -12,6 +12,8 @@ #include #include #include +#define __STDC_FORMAT_MACROS // Required for format specifiers +#include #include #include #include @@ -1566,7 +1568,7 @@ cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording) delta = int(buf.st_size % sizeof(tIndexTs)); if (delta) { delta = sizeof(tIndexTs) - delta; - esyslog("ERROR: invalid file size (%lld) in '%s'", buf.st_size, fileName); + esyslog("ERROR: invalid file size (%"PRId64") in '%s'", buf.st_size, fileName); } last = int((buf.st_size + delta) / sizeof(tIndexTs) - 1); if (!Record && last >= 0) { diff --git a/remote.c b/remote.c index 048b98c3..cd3a7585 100644 --- a/remote.c +++ b/remote.c @@ -4,11 +4,13 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.c 2.2 2010/12/24 15:26:05 kls Exp $ + * $Id: remote.c 2.3 2011/03/27 15:03:36 kls Exp $ */ #include "remote.h" #include +#define __STDC_FORMAT_MACROS // Required for format specifiers +#include #include #include #include @@ -122,7 +124,7 @@ bool cRemote::PutMacro(eKeys Key) bool cRemote::Put(uint64_t Code, bool Repeat, bool Release) { char buffer[32]; - snprintf(buffer, sizeof(buffer), "%016llX", Code); + snprintf(buffer, sizeof(buffer), "%016"PRIX64, Code); return Put(buffer, Repeat, Release); } -- cgit v1.2.3