Commit Graph

8 Commits

Author SHA1 Message Date
René Liebscher 4d96fbfed4 Remove compiler warnings/errors
Recent compilers have activated some additional
checks which let the build fail. (at least with cygwin)
(Normally it would be warnings but opensc compiles
with -Werror)

GCC 9.3:
In file included from profile.c:27:
profile.c: In function '__expr_get':
profile.c:2273:18: error: array subscript has type 'char' [-Werror=char-subscripts]
 2273 |   while (isspace(*s))
      |                  ^~

clang 8.0.1:
compat_getopt_main.c:102:22: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
                rc = toupper(rc);
                     ^~~~~~~~~~~
/usr/include/ctype.h:161:25: note: expanded from macro 'toupper'
      (void) __CTYPE_PTR[__x]; (toupper) (__x);})
                        ^~~~

Actually the code is correct as isspace and others
are used here with data type char, and are to be used
with data type int.

So either the compiler should have deactivated
this error, or the ctype.h macros have to be
written so the compiler no longer complains.

As there is also a simple workaround by casting
char to unsigned char, there is no need to wait for one
of the former options to be happen sometime.
2020-06-22 10:47:02 +02:00
Frank Morgner 7a34c204c1 fixed dereference before null check
silence warnings reported by coverity-scan
2015-01-22 20:29:33 +01:00
Viktor Tarasov cb13633634 remove trailing whitespaces
inspired by
http://www.opensc-project.org/pipermail/opensc-devel/2012-March/017883.html

Change-Id: If170e830d8d9587a31742feffb6fff54cfdf75b4
2012-04-03 00:00:56 +02:00
ludovic.rousseau 2085126d39 Use "const char *" instead of "char *" where needed.
Fix compiler warnings:
compat_getopt_main.c: In function ‘main’:
compat_getopt_main.c:145: warning: initialization discards qualifiers from pointer target type
compat_getopt_main.c:288: warning: assignment discards qualifiers from pointer target type
compat_getopt_main.c:336: warning: assignment discards qualifiers from pointer target type
compat_getopt_main.c:366: warning: passing argument 3 of ‘handle’ discards qualifiers from pointer target type
compat_getopt_main.c:76: note: expected ‘char *’ but argument is of type ‘const char *’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4743 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:48:57 +00:00
ludovic.rousseau 96a2568ee0 Remove an ugly cast and fix a compiler warning
compat_getopt_main.c: In function ‘handle’:
compat_getopt_main.c:123: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘long unsigned int’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4742 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:45:09 +00:00
ludovic.rousseau 4630f1c65f VERSION is already defined ni config.h included by compat_getopt.h
Redefine our own version of VERSION


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4741 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:42:39 +00:00
ludovic.rousseau 9bdbaf4970 include compat_getopt.h instead of getopt.h
Thanks to Guillaume JEAN for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2010-September/014948.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4740 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:39:04 +00:00
alonbl a160f0ebf7 common/main.c is part of getopt package
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3476 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-16 04:42:31 +00:00