From 1fe46dfa9faf971fee27870a49f652485e52647a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 26 Mar 2006 09:27:30 +0200 Subject: Fixed format string handling --- CONTRIBUTORS | 1 + HISTORY | 3 ++- PLUGINS/src/sky/HISTORY | 4 ++++ PLUGINS/src/sky/sky.c | 7 +++---- i18n.c | 44 ++++++++++++++++++++++---------------------- i18n.h | 4 ++-- menuitems.c | 5 ++--- recording.c | 4 ++-- svdrp.c | 16 ++++++++-------- thread.c | 5 +++-- vdr.c | 4 ++-- 11 files changed, 51 insertions(+), 46 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index de5cbfff..852297bc 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1460,6 +1460,7 @@ Darren Salt for suggesting to open the file handle in the SVDRP GRAB command in a way that it won't follow symbolic links, and to canonicalize the file name for making all font and image data 'const' + for fixing format string handling Sean Carlos for translating OSD texts to the Italian language diff --git a/HISTORY b/HISTORY index cb8e7595..e1ee7aa0 100644 --- a/HISTORY +++ b/HISTORY @@ -4415,7 +4415,7 @@ Video Disk Recorder Revision History - Fixed cSchedule::GetFollowingEvent() in case there is currently no present event running (thanks to Pekka Mauno). -2006-03-25: Version 1.3.45 +2006-03-26: Version 1.3.45 - Fixed updating the "Info" button in the "Timers" menu. - Reduced the number of events to actually check when setting events to timers. @@ -4444,3 +4444,4 @@ Video Disk Recorder Revision History - Made cMenuRecordings::GetRecording() 'protected' (suggested by Marius Heidenstecker). - Speeded up cRemux::ScanVideoPacket() (thanks to Reinhard Nissl). - Enhanced logging EPG event data. +- Fixed format string handling (thanks to Darren Salt). diff --git a/PLUGINS/src/sky/HISTORY b/PLUGINS/src/sky/HISTORY index 9d405751..45774f15 100644 --- a/PLUGINS/src/sky/HISTORY +++ b/PLUGINS/src/sky/HISTORY @@ -41,3 +41,7 @@ VDR Plugin 'sky' Revision History 2005-09-17: Version 0.3.4 - Added a missing include statement. + +2006-03-26: Version 0.3.5 + +- Fixed format string handling. diff --git a/PLUGINS/src/sky/sky.c b/PLUGINS/src/sky/sky.c index cbb927bb..4033bf7b 100644 --- a/PLUGINS/src/sky/sky.c +++ b/PLUGINS/src/sky/sky.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: sky.c 1.12 2005/09/17 10:39:35 kls Exp $ + * $Id: sky.c 1.13 2006/03/26 09:21:10 kls Exp $ */ #include @@ -15,7 +15,7 @@ #include #include -static const char *VERSION = "0.3.4"; +static const char *VERSION = "0.3.5"; static const char *DESCRIPTION = "Sky Digibox interface"; // --- cDigiboxDevice -------------------------------------------------------- @@ -108,9 +108,8 @@ cDigiboxDevice::~cDigiboxDevice() void cDigiboxDevice::LircSend(const char *s) { - const char *c = "SEND_ONCE SKY %s\n"; char buf[100]; - sprintf(buf, c, s); + snprintf(buf, sizeof(buf), "SEND_ONCE SKY %s\n", s); dsyslog(buf);//XXX if (write(fd_lirc, buf, strlen(buf)) < 0) LOG_ERROR;//XXX _STR diff --git a/i18n.c b/i18n.c index 2c2706ef..f4760f6e 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.251 2006/03/25 11:56:35 kls Exp $ + * $Id: i18n.c 1.252 2006/03/26 09:17:58 kls Exp $ * * Translations provided by: * @@ -1319,27 +1319,27 @@ const tI18nPhrase Phrases[] = { "Optagelse igang - sluk alligevel?", "Systém je zaneprázdnìn - pøesto vypnout?", }, - { "Recording in %d minutes, shut down anyway?", - "Aufnahme in %d Minuten - trotzdem ausschalten?", - "Snemanje èez %d minut, zares izklopi?", - "Registrazione fra %d minuti - spengo comunque?", - "Opname in %d minuten - toch uitschakelen?", - "Em gravação dentro de %d minutos - quer mesmo desligar?", - "Enregistrement dans %d minutes - confirmez l'arrêt", - "Skal gjøre opptak om %d minutter - slå av likevel?", - "Tallennus alkaa %d min kuluttua - sammutetaanko?", - "Nagrywanie za %d minut - wy³±czyæ mimo to?", - "Grabación dentro de %d minutos, ¿apagar realmente?", - "ÁíáìÝíåôáé åããñáöÞ óÝ %d ëåðôÜ - ÔåëéêÜ íá ôåñìáôéóôåß?", - "Inspelning startar om %d minuter, vill du avsluta?", - "Înregistrez peste %d minute - închid, totuºi?", - "Felvétel %d perc mulva kezdödik - mégis kikapcsolni?", - "Hi ha una gravació en %d minuts - Apagar de totes maneres?", - "ÇÕàÕ× %d ÜØÝãâ ÝÐçÝñâáï ×ÐßØáì - ÔÕÙáâÒØâÕÛìÝÞ ÒëÚÛîçØâì?", - "Snimanje za %d minuta - svejedno iskljuèiti?", - "Salvestamine algab %d minuti pärast - lülitan välja?", - "Optagelse om %d minutter - sluk alligevel?", - "Nahrávání zaène za %d minut - pøesto vypnout?", + { "Recording in %ld minutes, shut down anyway?", + "Aufnahme in %ld Minuten - trotzdem ausschalten?", + "Snemanje èez %ld minut, zares izklopi?", + "Registrazione fra %ld minuti - spengo comunque?", + "Opname in %ld minuten - toch uitschakelen?", + "Em gravação dentro de %ld minutos - quer mesmo desligar?", + "Enregistrement dans %ld minutes - confirmez l'arrêt", + "Skal gjøre opptak om %ld minutter - slå av likevel?", + "Tallennus alkaa %ld min kuluttua - sammutetaanko?", + "Nagrywanie za %ld minut - wy³±czyæ mimo to?", + "Grabación dentro de %ld minutos, ¿apagar realmente?", + "ÁíáìÝíåôáé åããñáöÞ óÝ %ld ëåðôÜ - ÔåëéêÜ íá ôåñìáôéóôåß?", + "Inspelning startar om %ld minuter, vill du avsluta?", + "Înregistrez peste %ld minute - închid, totuºi?", + "Felvétel %ld perc mulva kezdödik - mégis kikapcsolni?", + "Hi ha una gravació en %ld minuts - Apagar de totes maneres?", + "ÇÕàÕ× %ld ÜØÝãâ ÝÐçÝñâáï ×ÐßØáì - ÔÕÙáâÒØâÕÛìÝÞ ÒëÚÛîçØâì?", + "Snimanje za %ld minuta - svejedno iskljuèiti?", + "Salvestamine algab %ld minuti pärast - lülitan välja?", + "Optagelse om %ld minutter - sluk alligevel?", + "Nahrávání zaène za %ld minut - pøesto vypnout?", }, { "Press any key to cancel shutdown", "Taste drücken, um Shutdown abzubrechen", diff --git a/i18n.h b/i18n.h index 0cbf7281..b6c217b7 100644 --- a/i18n.h +++ b/i18n.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.h 1.17 2006/02/04 10:41:16 kls Exp $ + * $Id: i18n.h 1.18 2006/03/26 09:08:00 kls Exp $ */ #ifndef __I18N_H @@ -18,7 +18,7 @@ typedef const char *tI18nPhrase[I18nNumLanguages]; void I18nRegister(const tI18nPhrase * const Phrases, const char *Plugin); -const char *I18nTranslate(const char *s, const char *Plugin = NULL); +const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute_format_arg__(1); const char * const * I18nLanguages(void); const char * const * I18nCharSets(void); diff --git a/menuitems.c b/menuitems.c index 7bd1605a..34e0dd75 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 1.33 2006/02/28 12:53:37 kls Exp $ + * $Id: menuitems.c 1.34 2006/03/26 09:10:17 kls Exp $ */ #include "menuitems.h" @@ -290,12 +290,11 @@ void cMenuEditStrItem::AdvancePos(void) void cMenuEditStrItem::Set(void) { char buf[1000]; - const char *fmt = insert && newchar ? "[]%c%s" : "[%c]%s"; if (InEditMode()) { const cFont *font = cFont::GetFont(fontOsd); strncpy(buf, value, pos); - snprintf(buf + pos, sizeof(buf) - pos - 2, fmt, *(value + pos), value + pos + 1); + snprintf(buf + pos, sizeof(buf) - pos - 2, insert && newchar ? "[]%c%s" : "[%c]%s", *(value + pos), value + pos + 1); int width = cSkinDisplay::Current()->EditableWidth(); if (font->Width(buf) <= width) { // the whole buffer fits on the screen diff --git a/recording.c b/recording.c index 55ab9396..379627c0 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 1.142 2006/03/19 14:33:18 kls Exp $ + * $Id: recording.c 1.143 2006/03/26 09:11:00 kls Exp $ */ #include "recording.h" @@ -1057,7 +1057,7 @@ bool cMark::Parse(const char *s) bool cMark::Save(FILE *f) { - return fprintf(f, ToText()) > 0; + return fprintf(f, "%s", *ToText()) > 0; } // --- cMarks ---------------------------------------------------------------- diff --git a/svdrp.c b/svdrp.c index 9fa61ea9..0cf73e9f 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 1.93 2006/01/14 16:08:20 kls Exp $ + * $Id: svdrp.c 1.94 2006/03/26 09:14:13 kls Exp $ */ #include "svdrp.h" @@ -461,7 +461,7 @@ void cSVDRP::PrintHelpTopics(const char **hp) q += sprintf(q, "%*s", -MAXHELPTOPIC, topic); } x = 0; - Reply(-214, buffer); + Reply(-214, "%s", buffer); } } @@ -782,7 +782,7 @@ void cSVDRP::CmdGRAB(const char *Option) cBase64Encoder Base64(Image, ImageSize); const char *s; while ((s = Base64.NextLine()) != NULL) - Reply(-216, s); + Reply(-216, "%s", s); Reply(216, "Grabbed image %s", Option); } free(Image); @@ -799,7 +799,7 @@ void cSVDRP::CmdHELP(const char *Option) if (*Option) { const char *hp = GetHelpPage(Option, HelpPages); if (hp) - Reply(214, hp); + Reply(214, "%s", hp); else { Reply(504, "HELP topic \"%s\" unknown", Option); return; @@ -1332,7 +1332,7 @@ void cSVDRP::CmdPLUG(const char *Option) if (*cmd && *option) { const char *hp = GetHelpPage(option, plugin->SVDRPHelpPages()); if (hp) { - Reply(-214, hp); + Reply(-214, "%s", hp); Reply(214, "End of HELP info"); } else @@ -1358,7 +1358,7 @@ void cSVDRP::CmdPLUG(const char *Option) int ReplyCode = 900; cString s = plugin->SVDRPCommand(cmd, option, ReplyCode); if (s) - Reply(abs(ReplyCode), *s); + Reply(abs(ReplyCode), "%s", *s); else Reply(500, "Command unrecognized: \"%s\"", cmd); } @@ -1380,7 +1380,7 @@ void cSVDRP::CmdPUTE(const char *Option) { delete PUTEhandler; PUTEhandler = new cPUTEhandler; - Reply(PUTEhandler->Status(), PUTEhandler->Message()); + Reply(PUTEhandler->Status(), "%s", PUTEhandler->Message()); if (PUTEhandler->Status() != 354) DELETENULL(PUTEhandler); } @@ -1467,7 +1467,7 @@ void cSVDRP::Execute(char *Cmd) // handle PUTE data: if (PUTEhandler) { if (!PUTEhandler->Process(Cmd)) { - Reply(PUTEhandler->Status(), PUTEhandler->Message()); + Reply(PUTEhandler->Status(), "%s", PUTEhandler->Message()); DELETENULL(PUTEhandler); } return; diff --git a/thread.c b/thread.c index 3293b1d4..89d56e9f 100644 --- a/thread.c +++ b/thread.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: thread.c 1.53 2006/02/12 12:24:39 kls Exp $ + * $Id: thread.c 1.54 2006/03/26 09:22:27 kls Exp $ */ #include "thread.h" @@ -208,7 +208,8 @@ cThread::cThread(const char *Description) childTid = 0; childThreadId = 0; description = NULL; - SetDescription(Description); + if (Description) + SetDescription("%s", Description); } cThread::~cThread() diff --git a/vdr.c b/vdr.c index 62e17fa3..7ff749bf 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.250 2006/03/19 13:29:49 kls Exp $ + * $Id: vdr.c 1.251 2006/03/26 09:16:53 kls Exp $ */ #include @@ -1067,7 +1067,7 @@ int main(int argc, char *argv[]) } if (UserShutdown && Next && Delta <= Setup.MinEventTimeout * 60 && !ForceShutdown) { char *buf; - asprintf(&buf, tr("Recording in %d minutes, shut down anyway?"), Delta / 60); + asprintf(&buf, tr("Recording in %ld minutes, shut down anyway?"), Delta / 60); if (Interface->Confirm(buf)) ForceShutdown = true; else -- cgit v1.2.3