summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2008-02-15 14:57:48 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2008-02-15 14:57:48 +0100
commit9495aa9923fed16aeb6f49c69ccd249b9e17dba7 (patch)
tree5bf8b7683e3bf3b6e0725adf834b0d5344283ad3 /svdrp.c
parentc8584521f794492d81d87d448f2c4dcefc636b34 (diff)
downloadvdr-9495aa9923fed16aeb6f49c69ccd249b9e17dba7.tar.gz
vdr-9495aa9923fed16aeb6f49c69ccd249b9e17dba7.tar.bz2
Using cString::sprintf() instead of asprintf()
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/svdrp.c b/svdrp.c
index bce0ec4f..c6e64f87 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.106 2008/02/10 13:37:18 kls Exp $
+ * $Id: svdrp.c 1.107 2008/02/15 14:48:59 kls Exp $
*/
#include "svdrp.h"
@@ -423,8 +423,8 @@ void cSVDRP::Reply(int Code, const char *fmt, ...)
if (Code != 0) {
va_list ap;
va_start(ap, fmt);
- char *buffer;
- vasprintf(&buffer, fmt, ap);
+ cString buffer = cString::sprintf(fmt, ap);
+ va_end(ap);
const char *s = buffer;
while (s && *s) {
const char *n = strchr(s, '\n');
@@ -437,8 +437,6 @@ void cSVDRP::Reply(int Code, const char *fmt, ...)
break;
s = n ? n + 1 : NULL;
}
- free(buffer);
- va_end(ap);
}
else {
Reply(451, "Zero return code - looks like a programming error!");
@@ -730,7 +728,7 @@ void cSVDRP::CmdEDIT(const char *Option)
void cSVDRP::CmdGRAB(const char *Option)
{
- char *FileName = NULL;
+ const char *FileName = NULL;
bool Jpeg = true;
int Quality = -1, SizeX = -1, SizeY = -1;
if (*Option) {
@@ -799,10 +797,10 @@ void cSVDRP::CmdGRAB(const char *Option)
char RealFileName[PATH_MAX];
if (FileName) {
if (grabImageDir) {
- char *s = 0;
+ cString s;
char *slash = strrchr(FileName, '/');
if (!slash) {
- asprintf(&s, "%s/%s", grabImageDir, FileName);
+ s = AddDirectory(grabImageDir, FileName);
FileName = s;
}
slash = strrchr(FileName, '/'); // there definitely is one
@@ -812,12 +810,10 @@ void cSVDRP::CmdGRAB(const char *Option)
if (!r) {
LOG_ERROR_STR(FileName);
Reply(501, "Invalid file name \"%s\"", FileName);
- free(s);
return;
}
strcat(RealFileName, slash);
FileName = RealFileName;
- free(s);
if (strncmp(FileName, grabImageDir, strlen(grabImageDir)) != 0) {
Reply(501, "Invalid file name \"%s\"", FileName);
return;