| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Instead of converting everything to upper case and then using strncmp(),
use strncasecmp() which does case-insensitive comparison out of the box.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
| |
Spotted with clang and "-Wconversion".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
|
|
| |
We don't need floating point precision if results are casted back to
integer. Instead, rearrange operations and do the integer division after
the multiplication.
Version numbers are terminating decimals anyway and can be stored using
two integers without losing any information.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Convert our code base to adhere to Linux kernel coding style using
Lindent, with the following exceptions:
* Use spaces, instead of tabs, for indentation.
* Use 2-character indentations (instead of 8 characters).
Rationale: We currently have too much levels of indentation. Using
8-character tabs would make huge code parts unreadable. These need to be
cleaned up before we can switch to 8 characters.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the "const" keyword to parameters and variables that are never
modified. Most of these were spotted by "-Wwrite-strings".
We cast the second parameter to execvp() explicitly as it expects a
"char *const[]" where it should expect a "const char *const[]"
(according to the documentation, this is due to compatibility reasons).
This should be changed once we come up with a better solution.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
These are not needed outside of the corresponding compilation units.
Spotted with "-Wmissing-prototypes".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
|
|
| |
All strncmp() usages were replaced by (evidently) equivalent strcmp()
invocations in commit 2c9499bf272e06a62902711c6c20621ef3f80e64. However,
some of the strncmp() calls were perfectly justified and we actually
broke iCal import and "C-"-style key bindings by converting them to
strcmp(). Fix this by reverting all affected conversions.
Reported-by: Baptiste Jonglez <baptiste@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
| |
Add 2012 to the copyright range for all source and documentation files.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
| |
These were only used to construct constant strings with additional
length fields. However, we can just use standard constant character
arrays instead and let the compiler calculate the string length.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
| |
strncmp() isn't intended to be a secure strcmp() replacement, it is
designed to be used if you want to compare the first n characters of two
strings. Since we always compare character pointers with string
literals, switch to using strcmp() everywhere.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
| |
The bzero() and bcopy() functions are deprecated and were removed from
the POSIX standard in IEEE Std. 1003.1-2008. Remove all usages of
bzero()/bcopy() and replace them by appropriate memset()/memmove()
calls.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The last argument to strncat() should not be the total buffer length; it
should be the space remaining:
The strncat() function shall append not more than n bytes (a null
byte and bytes that follow it are not appended) from the array
pointed to by s2 to the end of the string pointed to by s1. The
initial byte of s2 overwrites the null byte at the end of s1. A
terminating null byte is always appended to the result.
This patch fixes a couple of potential buffer overflow vulnerabilities.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
Skip the newline check if fgets() returns a NULL string. Fixes another
warning seen with "-Wunused-result".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
|
|
|
|
|
| |
We currently use this in one place only but might reuse this a couple of
times later (when migrating to libical).
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|
|
Extract iCal and pcal import/export routines into separate files. This
reduces complexity of the super huge "io.c" source file and makes it
easier to follow changes that affect the iCal and pcal routines only
(commits affecting both formats are very uncommon).
Before:
$ wc -l src/io.c
2938 src/io.c
After:
$ wc -l src/{io,ical,pcal}.c
1445 src/io.c
1263 src/ical.c
317 src/pcal.c
3025 total
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
|