Skip to content

Commit 1338a26

Browse files
author
reinelt
committed
[lcd4linux @ 2004-06-26 09:27:20 by reinelt]
added '-W' to CFLAGS changed all C++ comments to C ones ('//' => '/* */') cleaned up a lot of signed/unsigned mistakes git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@480 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
1 parent 55abb63 commit 1338a26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2274
-1842
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PLUGINS=@PLUGINS@
88
bin_PROGRAMS = lcd4linux
99
#lib_LTLIBRARIES = liblcd4linux.la
1010

11-
AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall
11+
AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall -W
1212

1313
lcd4linux_LDFLAGS = $(X_LIBS)
1414
lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ PLUGINS = @PLUGINS@
8282
bin_PROGRAMS = lcd4linux
8383
#lib_LTLIBRARIES = liblcd4linux.la
8484

85-
AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall -ansi
85+
AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall -W
8686

8787
lcd4linux_LDFLAGS = $(X_LIBS)
8888
lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@

cfg.c

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: cfg.c,v 1.40 2004/06/20 10:09:52 reinelt Exp $^
1+
/* $Id: cfg.c,v 1.41 2004/06/26 09:27:20 reinelt Exp $^
22
*
33
* config file stuff
44
*
@@ -23,6 +23,12 @@
2323
*
2424
*
2525
* $Log: cfg.c,v $
26+
* Revision 1.41 2004/06/26 09:27:20 reinelt
27+
*
28+
* added '-W' to CFLAGS
29+
* changed all C++ comments to C ones ('//' => '/* */')
30+
* cleaned up a lot of signed/unsigned mistakes
31+
*
2632
* Revision 1.40 2004/06/20 10:09:52 reinelt
2733
*
2834
* 'const'ified the whole source
@@ -282,7 +288,7 @@ static ENTRY *Config=NULL;
282288
static int nConfig=0;
283289

284290

285-
// bsearch compare function for config entries
291+
/* bsearch compare function for config entries */
286292
static int c_lookup (const void *a, const void *b)
287293
{
288294
char *key=(char*)a;
@@ -292,7 +298,7 @@ static int c_lookup (const void *a, const void *b)
292298
}
293299

294300

295-
// qsort compare function for variables
301+
/* qsort compare function for variables */
296302
static int c_sort (const void *a, const void *b)
297303
{
298304
ENTRY *ea=(ENTRY*)a;
@@ -302,7 +308,7 @@ static int c_sort (const void *a, const void *b)
302308
}
303309

304310

305-
// remove leading and trailing whitespace
311+
/* remove leading and trailing whitespace */
306312
static char *strip (char *s, const int strip_comments)
307313
{
308314
char *p;
@@ -321,7 +327,7 @@ static char *strip (char *s, const int strip_comments)
321327
}
322328

323329

324-
// unquote a string
330+
/* unquote a string */
325331
static char *dequote (char *string)
326332
{
327333
int quote=0;
@@ -358,16 +364,16 @@ static char *dequote (char *string)
358364
}
359365

360366

361-
// which if a string contains only valid chars
362-
// i.e. start with a char and contains chars and nums
367+
/* which if a string contains only valid chars */
368+
/* i.e. start with a char and contains chars and nums */
363369
static int validchars (const char *string)
364370
{
365371
const char *c;
366372

367373
for (c=string; *c; c++) {
368-
// first and following chars
374+
/* first and following chars */
369375
if ((*c>='A' && *c<='Z') || (*c>='a' && *c<='z') || (*c=='_')) continue;
370-
// only following chars
376+
/* only following chars */
371377
if ((c>string) && ((*c>='0' && *c<='9') || (*c=='.') || (*c=='-'))) continue;
372378
return 0;
373379
}
@@ -380,18 +386,18 @@ static void cfg_add (const char *section, const char *key, const char *val, cons
380386
char *buffer;
381387
ENTRY *entry;
382388

383-
// allocate buffer
389+
/* allocate buffer */
384390
buffer=malloc(strlen(section)+strlen(key)+2);
385391
*buffer='\0';
386392

387-
// prepare section.key
393+
/* prepare section.key */
388394
if (section!=NULL && *section!='\0') {
389395
strcpy(buffer, section);
390396
strcat(buffer, ".");
391397
}
392398
strcat (buffer, key);
393399

394-
// does the key already exist?
400+
/* does the key already exist? */
395401
entry=bsearch(buffer, Config, nConfig, sizeof(ENTRY), c_lookup);
396402

397403
if (entry!=NULL) {
@@ -439,19 +445,19 @@ char *cfg_list (const char *section)
439445
int i, len;
440446
char *key, *list;
441447

442-
// calculate key length
448+
/* calculate key length */
443449
len=strlen(section)+1;
444450

445-
// prepare search key
451+
/* prepare search key */
446452
key=malloc(len+1);
447453
strcpy (key, section);
448454
strcat (key, ".");
449455

450-
// start with empty string
456+
/* start with empty string */
451457
list=malloc(1);
452458
*list='\0';
453459

454-
// search matching entries
460+
/* search matching entries */
455461
for (i=0; i<nConfig; i++) {
456462
if (strncasecmp(Config[i].key, key, len)==0) {
457463
list=realloc(list, strlen(list)+strlen(Config[i].key)-len+2);
@@ -471,26 +477,26 @@ static char *cfg_lookup (const char *section, const char *key)
471477
char *buffer;
472478
ENTRY *entry;
473479

474-
// calculate key length
480+
/* calculate key length */
475481
len=strlen(key)+1;
476482
if (section!=NULL)
477483
len+=strlen(section)+1;
478484

479-
// allocate buffer
485+
/* allocate buffer */
480486
buffer=malloc(len);
481487
*buffer='\0';
482488

483-
// prepare section:key
489+
/* prepare section:key */
484490
if (section!=NULL && *section!='\0') {
485491
strcpy(buffer, section);
486492
strcat(buffer, ".");
487493
}
488494
strcat (buffer, key);
489495

490-
// search entry
496+
/* search entry */
491497
entry=bsearch(buffer, Config, nConfig, sizeof(ENTRY), c_lookup);
492498

493-
// free buffer again
499+
/* free buffer again */
494500
free (buffer);
495501

496502
if (entry!=NULL)
@@ -540,9 +546,9 @@ int cfg_number (const char *section, const char *key, const int defval, const in
540546
void *tree = NULL;
541547
RESULT result = {0, 0, 0, NULL};
542548

543-
// start with default value
544-
// in case of an (uncatched) error, you have the
545-
// default value set, which may be handy...
549+
/* start with default value */
550+
/* in case of an (uncatched) error, you have the */
551+
/* default value set, which may be handy... */
546552
*value=defval;
547553

548554
expression=cfg_get_raw(section, key, NULL);
@@ -635,84 +641,84 @@ static int cfg_read (const char *file)
635641
return -1;
636642
}
637643

638-
// start with empty section
644+
/* start with empty section */
639645
strcpy(section, "");
640646

641647
error=0;
642648
lineno=0;
643649
while ((line=fgets(buffer,256,stream))!=NULL) {
644650

645-
// increment line number
651+
/* increment line number */
646652
lineno++;
647653

648-
// skip empty lines
654+
/* skip empty lines */
649655
if (*(line=strip(line, 1))=='\0') continue;
650656

651-
// reset section flags
657+
/* reset section flags */
652658
section_open=0;
653659
section_close=0;
654660

655-
// key is first word
661+
/* key is first word */
656662
key=line;
657663

658-
// search first blank between key and value
664+
/* search first blank between key and value */
659665
for (val=line; *val; val++) {
660666
if (isblank(*val)) {
661667
*val++='\0';
662668
break;
663669
}
664670
}
665671

666-
// strip value
672+
/* strip value */
667673
val=strip(val, 1);
668674

669-
// search end of value
675+
/* search end of value */
670676
if (*val) for (end=val; *(end+1); end++);
671677
else end=val;
672678

673-
// if last char is '{', a section has been opened
679+
/* if last char is '{', a section has been opened */
674680
if (*end=='{') {
675681
section_open=1;
676682
*end='\0';
677683
val=strip(val, 0);
678684
}
679685

680-
// provess "value" in double-quotes
686+
/* provess "value" in double-quotes */
681687
if (*val=='"' && *end=='"') {
682688
*end='\0';
683689
val++;
684690
}
685691

686-
// if key is '}', a section has been closed
692+
/* if key is '}', a section has been closed */
687693
if (strcmp(key, "}")==0) {
688694
section_close=1;
689695
*key='\0';
690696
}
691697

692-
// sanity check: '}' should be the only char in a line
698+
/* sanity check: '}' should be the only char in a line */
693699
if (section_close && (section_open || *val!='\0')) {
694700
error ("error in config file '%s' line %d: garbage after '}'", file, lineno);
695701
error=1;
696702
break;
697703
}
698704

699-
// check key for valid chars
705+
/* check key for valid chars */
700706
if (!validchars(key)) {
701707
error ("error in config file '%s' line %d: key '%s' is invalid", file, lineno, key);
702708
error=1;
703709
break;
704710
}
705711

706-
// on section-open, check value for valid chars
712+
/* on section-open, check value for valid chars */
707713
if (section_open && !validchars(val)) {
708714
error ("error in config file '%s' line %d: section '%s' is invalid", file, lineno, val);
709715
error=1;
710716
break;
711717
}
712718

713-
// on section-open, append new section name
719+
/* on section-open, append new section name */
714720
if (section_open) {
715-
// is the section[] array big enough?
721+
/* is the section[] array big enough? */
716722
if (strlen(section)+strlen(key)+3 > sizeof(section)) {
717723
error ("error in config file '%s' line %d: section buffer overflow", file, lineno);
718724
error=1;
@@ -727,9 +733,9 @@ static int cfg_read (const char *file)
727733
continue;
728734
}
729735

730-
// on section-close, remove last section name
736+
/* on section-close, remove last section name */
731737
if (section_close) {
732-
// sanity check: section already empty?
738+
/* sanity check: section already empty? */
733739
if (*section=='\0') {
734740
error ("error in config file '%s' line %d: unmatched closing brace", file, lineno);
735741
error=1;
@@ -744,12 +750,12 @@ static int cfg_read (const char *file)
744750
continue;
745751
}
746752

747-
// finally: add key
753+
/* finally: add key */
748754
cfg_add (section, key, val, 0);
749755

750756
}
751757

752-
// sanity check: are the braces balanced?
758+
/* sanity check: are the braces balanced? */
753759
if (!error && *section!='\0') {
754760
error ("error in config file '%s' line %d: unbalanced braces", file, lineno);
755761
error=1;

debug.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: debug.c,v 1.9 2004/06/20 10:09:54 reinelt Exp $
1+
/* $Id: debug.c,v 1.10 2004/06/26 09:27:20 reinelt Exp $
22
*
33
* debug() and error() functions
44
*
@@ -22,6 +22,12 @@
2222
*
2323
*
2424
* $Log: debug.c,v $
25+
* Revision 1.10 2004/06/26 09:27:20 reinelt
26+
*
27+
* added '-W' to CFLAGS
28+
* changed all C++ comments to C ones ('//' => '/* */')
29+
* cleaned up a lot of signed/unsigned mistakes
30+
*
2531
* Revision 1.9 2004/06/20 10:09:54 reinelt
2632
*
2733
* 'const'ified the whole source
@@ -91,7 +97,7 @@ void message (const int level, const char *format, ...)
9197
if (level>verbose_level) return;
9298

9399
va_start(ap, format);
94-
(void) vsnprintf(buffer, sizeof(buffer), format, ap);
100+
vsnprintf(buffer, sizeof(buffer), format, ap);
95101
va_end(ap);
96102

97103
if (!running_background) {

drv.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: drv.c,v 1.19 2004/06/20 10:09:54 reinelt Exp $
1+
/* $Id: drv.c,v 1.20 2004/06/26 09:27:20 reinelt Exp $
22
*
33
* new framework for display drivers
44
*
@@ -23,6 +23,12 @@
2323
*
2424
*
2525
* $Log: drv.c,v $
26+
* Revision 1.20 2004/06/26 09:27:20 reinelt
27+
*
28+
* added '-W' to CFLAGS
29+
* changed all C++ comments to C ones ('//' => '/* */')
30+
* cleaned up a lot of signed/unsigned mistakes
31+
*
2632
* Revision 1.19 2004/06/20 10:09:54 reinelt
2733
*
2834
* 'const'ified the whole source
@@ -167,9 +173,10 @@ extern DRIVER drv_T6963;
167173
extern DRIVER drv_USBLCD;
168174
extern DRIVER drv_X11;
169175

170-
// output file for Image driver
171-
// has to be defined here because it's referenced
172-
// even if the raster driver is not included!
176+
/* output file for Image driver
177+
* has to be defined here because it's referenced
178+
* even if the raster driver is not included!
179+
*/
173180
char *output=NULL;
174181

175182
DRIVER *Driver[] = {

0 commit comments

Comments
 (0)