1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Changed '%a' to the POSIX compliant '%m' in all scanf() calls

This commit is contained in:
Klaus Schmidinger 2013-12-28 11:37:42 +01:00
parent c949ad35cc
commit 6a8a2cf5fb
7 changed files with 17 additions and 14 deletions

View File

@ -2034,6 +2034,7 @@ Ville Skytt
for reporting a possible crash when shutting down VDR while subtitles are being for reporting a possible crash when shutting down VDR while subtitles are being
displayed displayed
for fixing some spellings in positioner.h and Doxyfile for fixing some spellings in positioner.h and Doxyfile
for changing '%a' to the POSIX compliant '%m' in all scanf() calls
Steffen Beyer <cpunk@reactor.de> Steffen Beyer <cpunk@reactor.de>
for fixing setting the colored button help after deleting a recording in case the next for fixing setting the colored button help after deleting a recording in case the next

View File

@ -8032,7 +8032,7 @@ Video Disk Recorder Revision History
the last replayed recording (if any) by pressing Ok repeatedly in the Recordings the last replayed recording (if any) by pressing Ok repeatedly in the Recordings
menu. menu.
2013-12-25: Version 2.1.3 2013-12-28: Version 2.1.3
- Changed the return value of cPositioner::HorizonLongitude() to 0 in case the - Changed the return value of cPositioner::HorizonLongitude() to 0 in case the
latitude of the antenna location is beyond +/-81 degrees. latitude of the antenna location is beyond +/-81 degrees.
@ -8087,3 +8087,5 @@ Video Disk Recorder Revision History
- Added a note to ePlayMode in device.h that VDR itself always uses pmAudioVideo when - Added a note to ePlayMode in device.h that VDR itself always uses pmAudioVideo when
replaying a recording (suggested by Thomas Reufer). replaying a recording (suggested by Thomas Reufer).
- Fixed some spellings in positioner.h and Doxyfile (thanks to Ville Skyttä). - Fixed some spellings in positioner.h and Doxyfile (thanks to Ville Skyttä).
- Changed '%a' to the POSIX compliant '%m' in all scanf() calls (thanks to Ville
Skyttä).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: channels.c 3.2 2013/11/04 10:11:51 kls Exp $ * $Id: channels.c 3.3 2013/12/28 11:33:08 kls Exp $
*/ */
#include "channels.h" #include "channels.h"
@ -29,7 +29,7 @@ tChannelID tChannelID::FromString(const char *s)
int tid; int tid;
int sid; int sid;
int rid = 0; int rid = 0;
int fields = sscanf(s, "%a[^-]-%d-%d-%d-%d", &sourcebuf, &nid, &tid, &sid, &rid); int fields = sscanf(s, "%m[^-]-%d-%d-%d-%d", &sourcebuf, &nid, &tid, &sid, &rid);
if (fields == 4 || fields == 5) { if (fields == 4 || fields == 5) {
int source = cSource::FromString(sourcebuf); int source = cSource::FromString(sourcebuf);
free(sourcebuf); free(sourcebuf);
@ -589,7 +589,7 @@ bool cChannel::Parse(const char *s)
char *apidbuf = NULL; char *apidbuf = NULL;
char *tpidbuf = NULL; char *tpidbuf = NULL;
char *caidbuf = NULL; char *caidbuf = NULL;
int fields = sscanf(s, "%a[^:]:%d :%a[^:]:%a[^:] :%d :%a[^:]:%a[^:]:%a[^:]:%a[^:]:%d :%d :%d :%d ", &namebuf, &frequency, &parambuf, &sourcebuf, &srate, &vpidbuf, &apidbuf, &tpidbuf, &caidbuf, &sid, &nid, &tid, &rid); int fields = sscanf(s, "%m[^:]:%d :%m[^:]:%m[^:] :%d :%m[^:]:%m[^:]:%m[^:]:%m[^:]:%d :%d :%d :%d ", &namebuf, &frequency, &parambuf, &sourcebuf, &srate, &vpidbuf, &apidbuf, &tpidbuf, &caidbuf, &sid, &nid, &tid, &rid);
if (fields >= 9) { if (fields >= 9) {
if (fields == 9) { if (fields == 9) {
// allow reading of old format // allow reading of old format

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: diseqc.c 3.2 2013/08/21 09:26:11 kls Exp $ * $Id: diseqc.c 3.3 2013/12/28 11:33:08 kls Exp $
*/ */
#include "diseqc.h" #include "diseqc.h"
@ -228,9 +228,9 @@ bool cDiseqc::Parse(const char *s)
devices = CurrentDevices; devices = CurrentDevices;
bool result = false; bool result = false;
char *sourcebuf = NULL; char *sourcebuf = NULL;
int fields = sscanf(s, "%a[^ ] %d %c %d %a[^\n]", &sourcebuf, &slof, &polarization, &lof, &commands); int fields = sscanf(s, "%m[^ ] %d %c %d %m[^\n]", &sourcebuf, &slof, &polarization, &lof, &commands);
if (fields == 4) if (fields == 4)
commands = NULL; //XXX Apparently sscanf() doesn't work correctly if the last %a argument results in an empty string commands = NULL; //XXX Apparently sscanf() doesn't work correctly if the last %m argument results in an empty string
if (4 <= fields && fields <= 5) { if (4 <= fields && fields <= 5) {
source = cSource::FromString(sourcebuf); source = cSource::FromString(sourcebuf);
if (Sources.Get(source)) { if (Sources.Get(source)) {

4
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* *
* $Id: epg.c 3.2 2013/08/31 13:21:09 kls Exp $ * $Id: epg.c 3.3 2013/12/28 11:33:08 kls Exp $
*/ */
#include "epg.h" #include "epg.h"
@ -32,7 +32,7 @@ cString tComponent::ToString(void)
bool tComponent::FromString(const char *s) bool tComponent::FromString(const char *s)
{ {
unsigned int Stream, Type; unsigned int Stream, Type;
int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, &description); // 7 = MAXLANGCODE2 - 1 int n = sscanf(s, "%X %02X %7s %m[^\n]", &Stream, &Type, language, &description); // 7 = MAXLANGCODE2 - 1
if (n != 4 || isempty(description)) { if (n != 4 || isempty(description)) {
free(description); free(description);
description = NULL; description = NULL;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: sources.c 3.4 2013/05/23 10:20:28 kls Exp $ * $Id: sources.c 3.5 2013/12/28 11:33:08 kls Exp $
*/ */
#include "sources.h" #include "sources.h"
@ -31,7 +31,7 @@ cSource::~cSource()
bool cSource::Parse(const char *s) bool cSource::Parse(const char *s)
{ {
char *codeBuf = NULL; char *codeBuf = NULL;
if (2 == sscanf(s, "%a[^ ] %a[^\n]", &codeBuf, &description)) if (2 == sscanf(s, "%m[^ ] %m[^\n]", &codeBuf, &description))
code = FromString(codeBuf); code = FromString(codeBuf);
free(codeBuf); free(codeBuf);
return code != stNone && description && *description; return code != stNone && description && *description;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: timers.c 2.18 2013/03/29 15:37:16 kls Exp $ * $Id: timers.c 3.1 2013/12/28 11:33:08 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -296,7 +296,7 @@ bool cTimer::Parse(const char *s)
char *filebuffer = NULL; char *filebuffer = NULL;
free(aux); free(aux);
aux = NULL; aux = NULL;
//XXX Apparently sscanf() doesn't work correctly if the last %a argument //XXX Apparently sscanf() doesn't work correctly if the last %m argument
//XXX results in an empty string (this first occurred when the EIT gathering //XXX results in an empty string (this first occurred when the EIT gathering
//XXX was put into a separate thread - don't know why this happens... //XXX was put into a separate thread - don't know why this happens...
//XXX As a cure we copy the original string and add a blank. //XXX As a cure we copy the original string and add a blank.
@ -312,7 +312,7 @@ bool cTimer::Parse(const char *s)
s = s2; s = s2;
} }
bool result = false; 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)) { if (8 <= sscanf(s, "%u :%m[^:]:%m[^:]:%d :%d :%d :%d :%m[^:\n]:%m[^\n]", &flags, &channelbuffer, &daybuffer, &start, &stop, &priority, &lifetime, &filebuffer, &aux)) {
ClrFlags(tfRecording); ClrFlags(tfRecording);
if (aux && !*skipspace(aux)) { if (aux && !*skipspace(aux)) {
free(aux); free(aux);