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
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 <seanc@libero.it>
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
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).

View File

@ -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.

View File

@ -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 <sys/socket.h>
@ -15,7 +15,7 @@
#include <vdr/plugin.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";
// --- 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

44
i18n.c
View File

@ -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",

4
i18n.h
View File

@ -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);

View File

@ -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

View File

@ -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 ----------------------------------------------------------------

16
svdrp.c
View File

@ -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;

View File

@ -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()

4
vdr.c
View File

@ -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 <getopt.h>
@ -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