aboutsummaryrefslogtreecommitdiffstats
path: root/src/ical.c
Commit message (Collapse)AuthorAgeFilesLines
* Use integers rather than floats everywhereLukas Fleischer2012-07-101-16/+15
| | | | | | | | | | | 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>
* Switch to Linux kernel coding styleLukas Fleischer2012-05-211-818/+653
| | | | | | | | | | | | | | 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>
* Declare several parameters/variables constantLukas Fleischer2012-05-081-1/+1
| | | | | | | | | | | | 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>
* Mark several functions staticLukas Fleischer2012-04-201-1/+1
| | | | | | | These are not needed outside of the corresponding compilation units. Spotted with "-Wmissing-prototypes". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Revert a bunch of strncmp() conversionsLukas Fleischer2012-03-301-22/+22
| | | | | | | | | | | 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>
* Update copyright rangesLukas Fleischer2012-03-261-1/+1
| | | | | | Add 2012 to the copyright range for all source and documentation files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Get rid of string structuresLukas Fleischer2012-03-121-50/+50
| | | | | | | | 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>
* Use strcmp() instead of strncmp()Lukas Fleischer2012-03-121-22/+22
| | | | | | | | | 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>
* Remove all usages of bzero() and bcopy()Lukas Fleischer2012-02-191-6/+6
| | | | | | | | | 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>
* Fix up strncat() usageLukas Fleischer2012-02-181-2/+1
| | | | | | | | | | | | | | | 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>
* Don't chomp on error in ical_readline_init()Lukas Fleischer2012-02-181-4/+6
| | | | | | | 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>
* Split note file generation into separate functionLukas Fleischer2012-01-171-12/+3
| | | | | | | 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>
* Break out different import/export formatsLukas Fleischer2012-01-071-0/+1263
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>