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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
diff -up vdr-1.4.5-orig/channels.c vdr-1.4.5/channels.c
--- vdr-1.4.5-orig/channels.c 2006-05-28 15:03:40 +0000
+++ vdr-1.4.5/channels.c 2007-08-26 19:58:42 +0000
@@ -134,7 +134,10 @@ tChannelID tChannelID::FromString(const
int tid;
int sid;
int rid = 0;
- int fields = sscanf(s, "%a[^-]-%d-%d-%d-%d", &sourcebuf, &nid, &tid, &sid, &rid);
+
+ sourcebuf = (char*) malloc(256);
+
+ int fields = sscanf(s, "%s-%d-%d-%d-%d", sourcebuf, &nid, &tid, &sid, &rid);
if (fields == 4 || fields == 5) {
int source = cSource::FromString(sourcebuf);
free(sourcebuf);
@@ -701,12 +704,18 @@ bool cChannel::Parse(const char *s)
else {
groupSep = false;
char *namebuf = NULL;
+ namebuf = (char*) malloc(256);
char *sourcebuf = NULL;
+ sourcebuf = (char*) malloc(256);
char *parambuf = NULL;
+ parambuf = (char*) malloc(256);
char *vpidbuf = NULL;
+ vpidbuf = (char*) malloc(256);
char *apidbuf = NULL;
+ apidbuf = (char*) malloc(256);
char *caidbuf = NULL;
- int fields = sscanf(s, "%a[^:]:%d :%a[^:]:%a[^:] :%d :%a[^:]:%a[^:]:%d :%a[^:]:%d :%d :%d :%d ", &namebuf, &frequency, ¶mbuf, &sourcebuf, &srate, &vpidbuf, &apidbuf, &tpid, &caidbuf, &sid, &nid, &tid, &rid);
+ caidbuf = (char*) malloc(256);
+ int fields = sscanf(s, "%[^:]:%d:%[^:]:%[^:]:%d :%[^:]:%[^:]:%d :%[^:]:%d :%d :%d :%d ", namebuf, &frequency, parambuf, sourcebuf, &srate, vpidbuf, apidbuf, &tpid, caidbuf, &sid, &nid, &tid, &rid);
if (fields >= 9) {
if (fields == 9) {
// allow reading of old format
diff -up vdr-1.4.5-orig/diseqc.c vdr-1.4.5/diseqc.c
--- vdr-1.4.5-orig/diseqc.c 2005-12-30 15:41:48 +0000
+++ vdr-1.4.5/diseqc.c 2007-08-21 23:08:10 +0000
@@ -30,7 +30,11 @@ bool cDiseqc::Parse(const char *s)
{
bool result = false;
char *sourcebuf = NULL;
- int fields = sscanf(s, "%a[^ ] %d %c %d %a[^\n]", &sourcebuf, &slof, &polarization, &lof, &commands);
+
+ sourcebuf = (char*) malloc(256);
+ commands = (char*) malloc(256);
+
+ int fields = sscanf(s, "%s %d %c %d %s", sourcebuf, &slof, &polarization, &lof, commands);
if (fields == 4)
commands = NULL; //XXX Apparently sscanf() doesn't work correctly if the last %a argument results in an empty string
if (4 <= fields && fields <= 5) {
diff -up vdr-1.4.5-orig/epg.c vdr-1.4.5/epg.c
--- vdr-1.4.5-orig/epg.c 2006-10-28 09:12:42 +0000
+++ vdr-1.4.5/epg.c 2007-08-22 20:13:14 +0000
@@ -30,7 +30,8 @@ cString tComponent::ToString(void)
bool tComponent::FromString(const char *s)
{
unsigned int Stream, Type;
- int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, &description); // 7 = MAXLANGCODE2 - 1
+ description = (char*) malloc(256);
+ int n = sscanf(s, "%X %02X %7s %[^\n]", &Stream, &Type, language, description); // 7 = MAXLANGCODE2 - 1
if (n != 4 || isempty(description)) {
free(description);
description = NULL;
diff -up vdr-1.4.5-orig/sources.c vdr-1.4.5/sources.c
--- vdr-1.4.5-orig/sources.c 2004-12-26 11:58:52 +0000
+++ vdr-1.4.5/sources.c 2007-08-26 20:01:21 +0000
@@ -25,9 +25,17 @@ cSource::~cSource()
bool cSource::Parse(const char *s)
{
- char *codeBuf = NULL;
- if (2 == sscanf(s, "%a[^ ] %a[^\n]", &codeBuf, &description))
+ char *codeBuf ;
+
+ codeBuf = (char *) malloc(256);
+ description = (char *) malloc(256);
+
+ int num;
+// num = sscanf(s, "%a[^ ] %a[^\n]", &codeBuf, &description);
+ num = sscanf(s, "%s %s", codeBuf, description);
+ if (2 == num){
code = FromString(codeBuf);
+ }
free(codeBuf);
return code != stNone && description && *description;
}
diff -up vdr-1.4.5-orig/thread.c vdr-1.4.5/thread.c
--- vdr-1.4.5-orig/thread.c 2006-09-24 12:54:47 +0000
+++ vdr-1.4.5/thread.c 2007-08-21 20:56:18 +0000
@@ -157,10 +157,17 @@ bool cRwLock::Lock(bool Write, int Timeo
if (!GetAbsTime(&abstime, TimeoutMs))
TimeoutMs = 0;
}
- if (Write)
- Result = TimeoutMs ? pthread_rwlock_timedwrlock(&rwlock, &abstime) : pthread_rwlock_wrlock(&rwlock);
- else
- Result = TimeoutMs ? pthread_rwlock_timedrdlock(&rwlock, &abstime) : pthread_rwlock_rdlock(&rwlock);
+
+ while (true) {
+ if (Write)
+ Result = pthread_rwlock_wrlock(&rwlock);
+ else
+ Result = pthread_rwlock_rdlock(&rwlock);
+ if ( Result == 0 | TimeoutMs == 0 )
+ break;
+ TimeoutMs--;
+ usleep(1000);
+ }
return Result == 0;
}
diff -up vdr-1.4.5-orig/timers.c vdr-1.4.5/timers.c
--- vdr-1.4.5-orig/timers.c 2006-09-15 14:15:53 +0000
+++ vdr-1.4.5/timers.c 2007-08-22 20:11:17 +0000
@@ -269,7 +269,11 @@ bool cTimer::Parse(const char *s)
s = s2;
}
bool result = false;
- if (8 <= sscanf(s, "%u :%a[^:]:%a[^:]:%d :%d :%d :%d :%a[^:\n]:%a[^\n]", &flags, &channelbuffer, &daybuffer, &start, &stop, &priority, &lifetime, &filebuffer, &aux)) {
+ channelbuffer = (char*) malloc(256);
+ daybuffer = (char*) malloc(256);
+ filebuffer = (char*) malloc(256);
+ aux = (char*) malloc(256);
+ if (8 <= sscanf(s, "%u :%[^:]:%[^:]:%d :%d :%d :%d :%[^:\n]:%[^\n]", &flags, channelbuffer, daybuffer, &start, &stop, &priority, &lifetime, filebuffer, aux)) {
ClrFlags(tfRecording);
if (aux && !*skipspace(aux)) {
free(aux);
diff -up vdr-1.4.5-orig/tools.c vdr-1.4.5/tools.c
--- vdr-1.4.5-orig/tools.c 2006-12-02 11:12:59 +0000
+++ vdr-1.4.5/tools.c 2007-08-22 21:33:33 +0000
@@ -481,7 +481,8 @@ char *ReadLink(const char *FileName)
{
if (!FileName)
return NULL;
- char *TargetName = canonicalize_file_name(FileName);
+ char *ResolvedName = (char*) malloc(1024);
+ char *TargetName = realpath(FileName, ResolvedName);
if (!TargetName) {
if (errno == ENOENT) // file doesn't exist
TargetName = strdup(FileName);
@@ -1053,7 +1054,7 @@ bool cSafeFile::Close(void)
// --- cUnbufferedFile -------------------------------------------------------
-#define USE_FADVISE
+//#define USE_FADVISE
#define WRITE_BUFFER KILOBYTE(800)
@@ -1115,7 +1116,8 @@ void cUnbufferedFile::SetReadAhead(size_
int cUnbufferedFile::FadviseDrop(off_t Offset, off_t Len)
{
// rounding up the window to make sure that not PAGE_SIZE-aligned data gets freed.
- return posix_fadvise(fd, Offset - (FADVGRAN - 1), Len + (FADVGRAN - 1) * 2, POSIX_FADV_DONTNEED);
+ //return posix_fadvise(fd, Offset - (FADVGRAN - 1), Len + (FADVGRAN - 1) * 2, POSIX_FADV_DONTNEED);
+ return 0;
}
off_t cUnbufferedFile::Seek(off_t Offset, int Whence)
|