summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2014-09-15 17:38:04 -0400
committerAllen Winter <allen.winter@kdab.com>2014-09-15 17:38:04 -0400
commitf0d05a205a8f56c0213b412d4ba738df1ceefa54 (patch)
treeca14be10449f0f9139eed205649c6dc56ce5561a
parent9eb5fa38dc2c6f01ad512d492236ada4ac7d7813 (diff)
downloadlibical-git-f0d05a205a8f56c0213b412d4ba738df1ceefa54.tar.gz
fix compiler warnings for MinGW on Windows
-rw-r--r--src/libical/icaltimezone.c11
-rw-r--r--src/libical/icaltz-util.c3
-rw-r--r--src/libicalss/icalfileset.c8
-rw-r--r--src/test/recur.c2
-rw-r--r--src/test/regression-recur.c2
-rw-r--r--src/test/regression.c8
-rw-r--r--src/test/testmime.c7
7 files changed, 28 insertions, 13 deletions
diff --git a/src/libical/icaltimezone.c b/src/libical/icaltimezone.c
index e19e8a99..3db8a94e 100644
--- a/src/libical/icaltimezone.c
+++ b/src/libical/icaltimezone.c
@@ -2023,7 +2023,7 @@ static const char* get_zone_directory(void)
int used_default;
static char *cache = NULL;
#ifndef _WIN32_WCE
- char *dirslash, *zislash;
+ unsigned char *dirslash, *zislash, *zislashp1;
#else
wchar_t *dirslash, *zislash;
#endif
@@ -2090,7 +2090,7 @@ static const char* get_zone_directory(void)
/* Strip away basename of app .exe first */
#ifndef _WIN32_WCE
- dirslash = _mbsrchr (buffer, '\\');
+ dirslash = _mbsrchr ((unsigned char *)buffer, '\\');
#else
dirslash = wcsrchr (wbuffer, L'\\');
#endif
@@ -2121,16 +2121,17 @@ static const char* get_zone_directory(void)
}
}
#else
- while ((dirslash = _mbsrchr (buffer, '\\'))) {
+ while ((dirslash = _mbsrchr ((unsigned char *)buffer, '\\'))) {
/* Strip one more directory from app .exe location */
*dirslash = '\0';
strcpy (zoneinfodir, ZONEINFO_DIRECTORY);
- while ((zislash = _mbschr (zoneinfodir, '/'))) {
+ while ((zislash = _mbschr ((unsigned char *)zoneinfodir, '/'))) {
*zislash = '.';
strcpy (dirname, buffer);
strcat (dirname, "/");
- strcat (dirname, zislash + 1);
+ zislashp1 = zislash + 1;
+ strcat (dirname, (char *)zislashp1);
if (stat (dirname, &st) == 0 &&
S_ISDIR (st.st_mode)) {
cache = strdup (dirname);
diff --git a/src/libical/icaltz-util.c b/src/libical/icaltz-util.c
index 4dfe5632..e045cafa 100644
--- a/src/libical/icaltz-util.c
+++ b/src/libical/icaltz-util.c
@@ -69,7 +69,7 @@
#include <io.h>
#endif
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__MINGW32__)
#define bswap_16(x) (((x) << 8) & 0xff00) | (((x) >> 8 ) & 0xff)
#define bswap_32 __builtin_bswap32
#define bswap_64 __builtin_bswap64
@@ -237,7 +237,6 @@ icaltzutil_fetch_timezone (const char *location)
full_path = (char *) malloc (strlen (basedir) + strlen (location) + 2);
sprintf (full_path,"%s/%s",basedir, location);
-
if ((f = fopen (full_path, "rb")) == 0) {
icalerror_set_errno (ICAL_FILE_ERROR);
free (full_path);
diff --git a/src/libicalss/icalfileset.c b/src/libicalss/icalfileset.c
index d90de0f1..258122d8 100644
--- a/src/libicalss/icalfileset.c
+++ b/src/libicalss/icalfileset.c
@@ -320,7 +320,8 @@ int icalfileset_lock(icalfileset *set)
return rtrn;
#else
- return 0;
+ _unused(set);
+ return 0;
#endif
}
@@ -337,10 +338,12 @@ int icalfileset_unlock(icalfileset *set)
return (fcntl(set->fd, F_UNLCK, &lock));
#else
- return 0;
+ _unused(set);
+ return 0;
#endif
}
+#ifndef WIN32
static char * shell_quote(const char *s)
{
char *result;
@@ -364,6 +367,7 @@ static char * shell_quote(const char *s)
*p = '\0';
return result;
}
+#endif
icalerrorenum icalfileset_commit(icalset* set)
{
diff --git a/src/test/recur.c b/src/test/recur.c
index bddb1081..2c9373ab 100644
--- a/src/test/recur.c
+++ b/src/test/recur.c
@@ -45,11 +45,13 @@
#define strcasecmp stricmp
#endif
+#ifndef WIN32
static void sig_alrm(int i){
(void)i;/*unused*/
fprintf(stderr,"Could not get lock on file\n");
exit(1);
}
+#endif
static void recur_callback(icalcomponent *comp,
struct icaltime_span *span,
diff --git a/src/test/regression-recur.c b/src/test/regression-recur.c
index 1947a901..f6de4090 100644
--- a/src/test/regression-recur.c
+++ b/src/test/regression-recur.c
@@ -48,11 +48,13 @@ extern int VERBOSE;
#endif
+#ifndef WIN32
static void sig_alrm(int i){
_unused(i)
fprintf(stderr,"Could not get lock on file\n");
exit(1);
}
+#endif
/* Get the expected result about the purpose of the property*/
diff --git a/src/test/regression.c b/src/test/regression.c
index 01b3fc5b..b4bc97e7 100644
--- a/src/test/regression.c
+++ b/src/test/regression.c
@@ -566,7 +566,11 @@ void test_memory()
printf("Final: %s\n", f);
- printf("Final buffer size: %zd\n",bufsize);
+#ifdef WIN32
+ printf("Final buffer size: %Iu\n",bufsize);
+#else
+ printf("Final buffer size: %zu\n",bufsize);
+#endif
}
ok("final buffer size == 806", (bufsize == 806));
@@ -3728,7 +3732,6 @@ int main(int argc, char *argv[])
extern char *optarg;
extern int optopt;
#endif
- int errflg=0;
/* char* program_name = strrchr(argv[0],'/'); */
int do_test = 0;
int do_header = 0;
@@ -3742,6 +3745,7 @@ int main(int argc, char *argv[])
#ifndef WIN32
+ int errflg=0;
int c;
while ((c = getopt(argc, argv, "lvq")) != -1) {
switch (c) {
diff --git a/src/test/testmime.c b/src/test/testmime.c
index effb495d..817f1092 100644
--- a/src/test/testmime.c
+++ b/src/test/testmime.c
@@ -42,7 +42,10 @@
#include <stdlib.h> /* For rand */
#include <string.h> /* for strrchr, strdup*/
#if defined(HAVE_UNISTD_H)
-#include <unistd.h> /* for getopt */
+#include <unistd.h> /* for getopt, sleep */
+#endif
+#ifdef WIN32
+#include <windows.h> /* for Sleep */
#endif
/*int sspm_parse_mime(struct sspm_part *parts,
@@ -326,7 +329,7 @@ int main(int argc, char* argv[]) {
if (opt.sleep != 0){
#ifdef WIN32
- _sleep(opt.sleep*1000);
+ Sleep(opt.sleep*1000);
#else
sleep(opt.sleep);
#endif