Fixed format string handling

This commit is contained in:
Klaus Schmidinger 2006-03-26 09:27:30 +02:00
parent 8a3dae1e8b
commit 1fe46dfa9f
11 changed files with 51 additions and 46 deletions

View File

@ -1460,6 +1460,7 @@ Darren Salt <linux@youmustbejoking.demon.co.uk>
for suggesting to open the file handle in the SVDRP GRAB command in a way that 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 it won't follow symbolic links, and to canonicalize the file name
for making all font and image data 'const' for making all font and image data 'const'
for fixing format string handling
Sean Carlos <seanc@libero.it> Sean Carlos <seanc@libero.it>
for translating OSD texts to the Italian language for translating OSD texts to the Italian language

View File

@ -4415,7 +4415,7 @@ Video Disk Recorder Revision History
- Fixed cSchedule::GetFollowingEvent() in case there is currently no present event - Fixed cSchedule::GetFollowingEvent() in case there is currently no present event
running (thanks to Pekka Mauno). 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. - Fixed updating the "Info" button in the "Timers" menu.
- Reduced the number of events to actually check when setting events to timers. - 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). - Made cMenuRecordings::GetRecording() 'protected' (suggested by Marius Heidenstecker).
- Speeded up cRemux::ScanVideoPacket() (thanks to Reinhard Nissl). - Speeded up cRemux::ScanVideoPacket() (thanks to Reinhard Nissl).
- Enhanced logging EPG event data. - Enhanced logging EPG event data.
- Fixed format string handling (thanks to Darren Salt).

View File

@ -41,3 +41,7 @@ VDR Plugin 'sky' Revision History
2005-09-17: Version 0.3.4 2005-09-17: Version 0.3.4
- Added a missing include statement. - Added a missing include statement.
2006-03-26: Version 0.3.5
- Fixed format string handling.

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 <sys/socket.h> #include <sys/socket.h>
@ -15,7 +15,7 @@
#include <vdr/plugin.h> #include <vdr/plugin.h>
#include <vdr/sources.h> #include <vdr/sources.h>
static const char *VERSION = "0.3.4"; static const char *VERSION = "0.3.5";
static const char *DESCRIPTION = "Sky Digibox interface"; static const char *DESCRIPTION = "Sky Digibox interface";
// --- cDigiboxDevice -------------------------------------------------------- // --- cDigiboxDevice --------------------------------------------------------
@ -108,9 +108,8 @@ cDigiboxDevice::~cDigiboxDevice()
void cDigiboxDevice::LircSend(const char *s) void cDigiboxDevice::LircSend(const char *s)
{ {
const char *c = "SEND_ONCE SKY %s\n";
char buf[100]; char buf[100];
sprintf(buf, c, s); snprintf(buf, sizeof(buf), "SEND_ONCE SKY %s\n", s);
dsyslog(buf);//XXX dsyslog(buf);//XXX
if (write(fd_lirc, buf, strlen(buf)) < 0) if (write(fd_lirc, buf, strlen(buf)) < 0)
LOG_ERROR;//XXX _STR LOG_ERROR;//XXX _STR

44
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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: * Translations provided by:
* *
@ -1319,27 +1319,27 @@ const tI18nPhrase Phrases[] = {
"Optagelse igang - sluk alligevel?", "Optagelse igang - sluk alligevel?",
"Systém je zaneprázdnìn - pøesto vypnout?", "Systém je zaneprázdnìn - pøesto vypnout?",
}, },
{ "Recording in %d minutes, shut down anyway?", { "Recording in %ld minutes, shut down anyway?",
"Aufnahme in %d Minuten - trotzdem ausschalten?", "Aufnahme in %ld Minuten - trotzdem ausschalten?",
"Snemanje èez %d minut, zares izklopi?", "Snemanje èez %ld minut, zares izklopi?",
"Registrazione fra %d minuti - spengo comunque?", "Registrazione fra %ld minuti - spengo comunque?",
"Opname in %d minuten - toch uitschakelen?", "Opname in %ld minuten - toch uitschakelen?",
"Em gravação dentro de %d minutos - quer mesmo desligar?", "Em gravação dentro de %ld minutos - quer mesmo desligar?",
"Enregistrement dans %d minutes - confirmez l'arrêt", "Enregistrement dans %ld minutes - confirmez l'arrêt",
"Skal gjøre opptak om %d minutter - slå av likevel?", "Skal gjøre opptak om %ld minutter - slå av likevel?",
"Tallennus alkaa %d min kuluttua - sammutetaanko?", "Tallennus alkaa %ld min kuluttua - sammutetaanko?",
"Nagrywanie za %d minut - wy³±czyæ mimo to?", "Nagrywanie za %ld minut - wy³±czyæ mimo to?",
"Grabación dentro de %d minutos, ¿apagar realmente?", "Grabación dentro de %ld minutos, ¿apagar realmente?",
"ÁíáìÝíåôáé åããñáöÞ óÝ %d ëåðôÜ - ÔåëéêÜ íá ôåñìáôéóôåß?", "ÁíáìÝíåôáé åããñáöÞ óÝ %ld ëåðôÜ - ÔåëéêÜ íá ôåñìáôéóôåß?",
"Inspelning startar om %d minuter, vill du avsluta?", "Inspelning startar om %ld minuter, vill du avsluta?",
"Înregistrez peste %d minute - închid, totuºi?", "Înregistrez peste %ld minute - închid, totuºi?",
"Felvétel %d perc mulva kezdödik - mégis kikapcsolni?", "Felvétel %ld perc mulva kezdödik - mégis kikapcsolni?",
"Hi ha una gravació en %d minuts - Apagar de totes maneres?", "Hi ha una gravació en %ld minuts - Apagar de totes maneres?",
"ÇÕàÕ× %d ÜØÝãâ ÝÐçÝñâáï ×ÐßØáì - ÔÕÙáâÒØâÕÛìÝÞ ÒëÚÛîçØâì?", "ÇÕàÕ× %ld ÜØÝãâ ÝÐçÝñâáï ×ÐßØáì - ÔÕÙáâÒØâÕÛìÝÞ ÒëÚÛîçØâì?",
"Snimanje za %d minuta - svejedno iskljuèiti?", "Snimanje za %ld minuta - svejedno iskljuèiti?",
"Salvestamine algab %d minuti pärast - lülitan välja?", "Salvestamine algab %ld minuti pärast - lülitan välja?",
"Optagelse om %d minutter - sluk alligevel?", "Optagelse om %ld minutter - sluk alligevel?",
"Nahrávání zaène za %d minut - pøesto vypnout?", "Nahrávání zaène za %ld minut - pøesto vypnout?",
}, },
{ "Press any key to cancel shutdown", { "Press any key to cancel shutdown",
"Taste drücken, um Shutdown abzubrechen", "Taste drücken, um Shutdown abzubrechen",

4
i18n.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __I18N_H
@ -18,7 +18,7 @@ typedef const char *tI18nPhrase[I18nNumLanguages];
void I18nRegister(const tI18nPhrase * const Phrases, const char *Plugin); 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 * I18nLanguages(void);
const char * const * I18nCharSets(void); const char * const * I18nCharSets(void);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menuitems.h"
@ -290,12 +290,11 @@ void cMenuEditStrItem::AdvancePos(void)
void cMenuEditStrItem::Set(void) void cMenuEditStrItem::Set(void)
{ {
char buf[1000]; char buf[1000];
const char *fmt = insert && newchar ? "[]%c%s" : "[%c]%s";
if (InEditMode()) { if (InEditMode()) {
const cFont *font = cFont::GetFont(fontOsd); const cFont *font = cFont::GetFont(fontOsd);
strncpy(buf, value, pos); 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(); int width = cSkinDisplay::Current()->EditableWidth();
if (font->Width(buf) <= width) { if (font->Width(buf) <= width) {
// the whole buffer fits on the screen // the whole buffer fits on the screen

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "recording.h"
@ -1057,7 +1057,7 @@ bool cMark::Parse(const char *s)
bool cMark::Save(FILE *f) bool cMark::Save(FILE *f)
{ {
return fprintf(f, ToText()) > 0; return fprintf(f, "%s", *ToText()) > 0;
} }
// --- cMarks ---------------------------------------------------------------- // --- cMarks ----------------------------------------------------------------

16
svdrp.c
View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured * and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection. * 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" #include "svdrp.h"
@ -461,7 +461,7 @@ void cSVDRP::PrintHelpTopics(const char **hp)
q += sprintf(q, "%*s", -MAXHELPTOPIC, topic); q += sprintf(q, "%*s", -MAXHELPTOPIC, topic);
} }
x = 0; x = 0;
Reply(-214, buffer); Reply(-214, "%s", buffer);
} }
} }
@ -782,7 +782,7 @@ void cSVDRP::CmdGRAB(const char *Option)
cBase64Encoder Base64(Image, ImageSize); cBase64Encoder Base64(Image, ImageSize);
const char *s; const char *s;
while ((s = Base64.NextLine()) != NULL) while ((s = Base64.NextLine()) != NULL)
Reply(-216, s); Reply(-216, "%s", s);
Reply(216, "Grabbed image %s", Option); Reply(216, "Grabbed image %s", Option);
} }
free(Image); free(Image);
@ -799,7 +799,7 @@ void cSVDRP::CmdHELP(const char *Option)
if (*Option) { if (*Option) {
const char *hp = GetHelpPage(Option, HelpPages); const char *hp = GetHelpPage(Option, HelpPages);
if (hp) if (hp)
Reply(214, hp); Reply(214, "%s", hp);
else { else {
Reply(504, "HELP topic \"%s\" unknown", Option); Reply(504, "HELP topic \"%s\" unknown", Option);
return; return;
@ -1332,7 +1332,7 @@ void cSVDRP::CmdPLUG(const char *Option)
if (*cmd && *option) { if (*cmd && *option) {
const char *hp = GetHelpPage(option, plugin->SVDRPHelpPages()); const char *hp = GetHelpPage(option, plugin->SVDRPHelpPages());
if (hp) { if (hp) {
Reply(-214, hp); Reply(-214, "%s", hp);
Reply(214, "End of HELP info"); Reply(214, "End of HELP info");
} }
else else
@ -1358,7 +1358,7 @@ void cSVDRP::CmdPLUG(const char *Option)
int ReplyCode = 900; int ReplyCode = 900;
cString s = plugin->SVDRPCommand(cmd, option, ReplyCode); cString s = plugin->SVDRPCommand(cmd, option, ReplyCode);
if (s) if (s)
Reply(abs(ReplyCode), *s); Reply(abs(ReplyCode), "%s", *s);
else else
Reply(500, "Command unrecognized: \"%s\"", cmd); Reply(500, "Command unrecognized: \"%s\"", cmd);
} }
@ -1380,7 +1380,7 @@ void cSVDRP::CmdPUTE(const char *Option)
{ {
delete PUTEhandler; delete PUTEhandler;
PUTEhandler = new cPUTEhandler; PUTEhandler = new cPUTEhandler;
Reply(PUTEhandler->Status(), PUTEhandler->Message()); Reply(PUTEhandler->Status(), "%s", PUTEhandler->Message());
if (PUTEhandler->Status() != 354) if (PUTEhandler->Status() != 354)
DELETENULL(PUTEhandler); DELETENULL(PUTEhandler);
} }
@ -1467,7 +1467,7 @@ void cSVDRP::Execute(char *Cmd)
// handle PUTE data: // handle PUTE data:
if (PUTEhandler) { if (PUTEhandler) {
if (!PUTEhandler->Process(Cmd)) { if (!PUTEhandler->Process(Cmd)) {
Reply(PUTEhandler->Status(), PUTEhandler->Message()); Reply(PUTEhandler->Status(), "%s", PUTEhandler->Message());
DELETENULL(PUTEhandler); DELETENULL(PUTEhandler);
} }
return; return;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "thread.h"
@ -208,7 +208,8 @@ cThread::cThread(const char *Description)
childTid = 0; childTid = 0;
childThreadId = 0; childThreadId = 0;
description = NULL; description = NULL;
SetDescription(Description); if (Description)
SetDescription("%s", Description);
} }
cThread::~cThread() cThread::~cThread()

4
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/vdr * 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 <getopt.h> #include <getopt.h>
@ -1067,7 +1067,7 @@ int main(int argc, char *argv[])
} }
if (UserShutdown && Next && Delta <= Setup.MinEventTimeout * 60 && !ForceShutdown) { if (UserShutdown && Next && Delta <= Setup.MinEventTimeout * 60 && !ForceShutdown) {
char *buf; 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)) if (Interface->Confirm(buf))
ForceShutdown = true; ForceShutdown = true;
else else