1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
diff --git a/recording.c b/recording.c
--- a/recording.c
+++ b/recording.c
@@ -509,8 +509,8 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
Utf8Strn0Cpy(SubtitleBuffer, Subtitle, MAX_SUBTITLE_LENGTH);
Subtitle = SubtitleBuffer;
}
- char *macroTITLE = strstr(Timer->File(), TIMERMACRO_TITLE);
- char *macroEPISODE = strstr(Timer->File(), TIMERMACRO_EPISODE);
+ const char *macroTITLE = strstr(Timer->File(), TIMERMACRO_TITLE);
+ const char *macroEPISODE = strstr(Timer->File(), TIMERMACRO_EPISODE);
if (macroTITLE || macroEPISODE) {
name = strdup(Timer->File());
name = strreplace(name, TIMERMACRO_TITLE, Title);
@@ -551,7 +551,7 @@ cRecording::cRecording(const char *FileName)
sortBuffer = NULL;
fileName = strdup(FileName);
FileName += strlen(VideoDirectory) + 1;
- char *p = strrchr(FileName, '/');
+ const char *p = strrchr(FileName, '/');
name = NULL;
info = new cRecordingInfo;
@@ -1022,7 +1022,7 @@ void cRecordings::DelByName(const char *FileName)
if (recording) {
cThreadLock DeletedRecordingsLock(&DeletedRecordings);
Del(recording, false);
- char *ext = strrchr(recording->FileName(), '.');
+ char *ext = strrchr(recording->fileName, '.');
if (ext) {
strncpy(ext, DELEXT, strlen(ext));
recording->fileSizeMB = DirSizeMB(recording->FileName());
diff --git a/svdrp.c b/svdrp.c
--- a/svdrp.c
+++ b/svdrp.c
@@ -736,7 +736,7 @@ void cSVDRP::CmdGRAB(const char *Option)
char *strtok_next;
FileName = strtok_r(p, delim, &strtok_next);
// image type:
- char *Extension = strrchr(FileName, '.');
+ const char *Extension = strrchr(FileName, '.');
if (Extension) {
if (strcasecmp(Extension, ".jpg") == 0 || strcasecmp(Extension, ".jpeg") == 0)
Jpeg = true;
@@ -795,16 +795,17 @@ void cSVDRP::CmdGRAB(const char *Option)
char RealFileName[PATH_MAX];
if (FileName) {
if (grabImageDir) {
- cString s;
- char *slash = strrchr(FileName, '/');
+ cString s(FileName);
+ FileName = s;
+ const char *slash = strrchr(FileName, '/');
if (!slash) {
s = AddDirectory(grabImageDir, FileName);
FileName = s;
}
slash = strrchr(FileName, '/'); // there definitely is one
- *slash = 0;
- char *r = realpath(FileName, RealFileName);
- *slash = '/';
+ cString t(s);
+ t.Truncate(slash - FileName);
+ char *r = realpath(t, RealFileName);
if (!r) {
LOG_ERROR_STR(FileName);
Reply(501, "Invalid file name \"%s\"", FileName);
diff --git a/channels.c b/channels.c
--- a/channels.c
+++ b/channels.c
@@ -574,7 +574,7 @@ void cChannel::SetLinkChannels(cLinkChannels *LinkChannels)
}
else
q += sprintf(q, " none");
- dsyslog(buffer);
+ dsyslog("%s", buffer);
}
void cChannel::SetRefChannel(cChannel *RefChannel)
diff --git a/device.c b/device.c
--- a/device.c
+++ b/device.c
@@ -529,7 +529,7 @@ eVideoSystem cDevice::GetVideoSystem(void)
return vsPAL;
}
-//#define PRINTPIDS(s) { char b[500]; char *q = b; q += sprintf(q, "%d %s ", CardIndex(), s); for (int i = 0; i < MAXPIDHANDLES; i++) q += sprintf(q, " %s%4d %d", i == ptOther ? "* " : "", pidHandles[i].pid, pidHandles[i].used); dsyslog(b); }
+//#define PRINTPIDS(s) { char b[500]; char *q = b; q += sprintf(q, "%d %s ", CardIndex(), s); for (int i = 0; i < MAXPIDHANDLES; i++) q += sprintf(q, " %s%4d %d", i == ptOther ? "* " : "", pidHandles[i].pid, pidHandles[i].used); dsyslog("%s", b); }
#define PRINTPIDS(s)
bool cDevice::HasPid(int Pid) const
diff --git a/pat.c b/pat.c
--- a/pat.c
+++ b/pat.c
@@ -144,7 +144,7 @@ void cCaDescriptors::AddCaDescriptor(SI::CaDescriptor *d, bool Stream)
q += sprintf(q, "CAM: %04X %5d %5d %04X %d -", source, transponder, serviceId, d->getCaType(), Stream);
for (int i = 0; i < nca->Length(); i++)
q += sprintf(q, " %02X", nca->Data()[i]);
- dsyslog(buffer);
+ dsyslog("%s", buffer);
#endif
}
diff --git a/receiver.c b/receiver.c
--- a/receiver.c
+++ b/receiver.c
@@ -40,7 +40,7 @@ cReceiver::~cReceiver()
{
if (device) {
const char *msg = "ERROR: cReceiver has not been detached yet! This is a design fault and VDR will segfault now!";
- esyslog(msg);
+ esyslog("%s", msg);
fprintf(stderr, "%s\n", msg);
*(char *)0 = 0; // cause a segfault
}
|