Renamed the function cString::sprintf(const char *fmt, va_list &ap) to vsprintf()

This commit is contained in:
Klaus Schmidinger 2012-05-08 11:23:56 +02:00
parent 4f7523a3a2
commit 06b8fe94ef
6 changed files with 14 additions and 8 deletions

View File

@ -2593,6 +2593,9 @@ Sundararaj Reel <sundararaj.reel@googlemail.com>
for reporting a memory leak in cRecordings::ScanVideoDir() in case there are too
many link levels
for reporting a bug in cListBase::Move() in case From and To are equal
for reporting a problem with the function cString::sprintf(const char *fmt, va_list &ap),
that might inadvertently be called with a 'char *' as the second argument on some
compilers and cause a crash
Ales Jurik <ajurik@quick.cz>
for reporting broken SI data on Czech/Slovak channels after changing the default

View File

@ -7096,3 +7096,6 @@ Video Disk Recorder Revision History
- Fixed a possible high CPU load when pausing replay (thanks to Reinhard Nissl).
- Fixed character comparisons in cSubtitleObject::DecodeCharacterString() (reported
by Reinhard Mantey).
- Renamed the function cString::sprintf(const char *fmt, va_list &ap) to vsprintf(),
because it might inadvertently be called with a 'char *' as the second argument on
some compilers and cause a crash (reported by Sundararaj Reel).

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 2.17 2012/04/26 10:36:11 kls Exp $
* $Id: svdrp.c 2.18 2012/05/08 11:23:56 kls Exp $
*/
#include "svdrp.h"
@ -432,7 +432,7 @@ void cSVDRP::Reply(int Code, const char *fmt, ...)
if (Code != 0) {
va_list ap;
va_start(ap, fmt);
cString buffer = cString::sprintf(fmt, ap);
cString buffer = cString::vsprintf(fmt, ap);
va_end(ap);
const char *s = buffer;
while (s && *s) {

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 2.3 2009/04/13 13:50:39 kls Exp $
* $Id: thread.c 2.4 2012/05/08 11:15:57 kls Exp $
*/
#include "thread.h"
@ -239,7 +239,7 @@ void cThread::SetDescription(const char *Description, ...)
if (Description) {
va_list ap;
va_start(ap, Description);
description = strdup(cString::sprintf(Description, ap));
description = strdup(cString::vsprintf(Description, ap));
va_end(ap);
}
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.c 2.22 2012/02/18 15:30:35 kls Exp $
* $Id: tools.c 2.23 2012/05/08 11:13:13 kls Exp $
*/
#include "tools.h"
@ -958,7 +958,7 @@ cString cString::sprintf(const char *fmt, ...)
return cString(buffer, true);
}
cString cString::sprintf(const char *fmt, va_list &ap)
cString cString::vsprintf(const char *fmt, va_list &ap)
{
char *buffer;
if (!fmt || vasprintf(&buffer, fmt, ap) < 0) {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.h 2.17 2012/04/01 11:36:10 kls Exp $
* $Id: tools.h 2.18 2012/05/08 11:11:33 kls Exp $
*/
#ifndef __TOOLS_H
@ -177,7 +177,7 @@ public:
cString &operator=(const char *String);
cString &Truncate(int Index); ///< Truncate the string at the given Index (if Index is < 0 it is counted from the end of the string).
static cString sprintf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
static cString sprintf(const char *fmt, va_list &ap);
static cString vsprintf(const char *fmt, va_list &ap);
};
ssize_t safe_read(int filedes, void *buffer, size_t size);