Commit dd752426 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix multiple compilation problems with mingw

parent 82419bbe
mediastreamer2 @ ae0c6d4b
Subproject commit 7ddb43caf21b79a3f45c93ff7532c4a4ab81031d Subproject commit ae0c6d4b4088ea803b99b1339bcfa8fc2eb47aba
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#endif #endif
/*getline is not available on android...*/ /*getline is POSIX 2008, not available on many systems.*/
#ifdef ANDROID #if defined(ANDROID) || defined(WIN32)
/* This code is public domain -- Will Hartung 4/9/09 */ /* This code is public domain -- Will Hartung 4/9/09 */
size_t getline(char **lineptr, size_t *n, FILE *stream) { size_t getline(char **lineptr, size_t *n, FILE *stream) {
char *bufptr = NULL; char *bufptr = NULL;
...@@ -153,8 +153,10 @@ time_t check_file(LinphoneCoreManager* mgr) { ...@@ -153,8 +153,10 @@ time_t check_file(LinphoneCoreManager* mgr) {
int line_count = 0; int line_count = 0;
char *line = NULL; char *line = NULL;
size_t line_size = 256; size_t line_size = 256;
#ifndef WIN32
struct tm tm_curr; struct tm tm_curr;
time_t time_prev = -1; time_t time_prev = -1;
#endif
#if HAVE_ZLIB #if HAVE_ZLIB
// 0) if zlib is enabled, we must decompress the file first // 0) if zlib is enabled, we must decompress the file first
...@@ -170,6 +172,7 @@ time_t check_file(LinphoneCoreManager* mgr) { ...@@ -170,6 +172,7 @@ time_t check_file(LinphoneCoreManager* mgr) {
while (getline(&line, &line_size, file) != -1) { while (getline(&line, &line_size, file) != -1) {
// a) there should be at least 25 lines // a) there should be at least 25 lines
++line_count; ++line_count;
#ifndef WIN32
// b) logs should be ordered by date (format: 2014-11-04 15:22:12:606) // b) logs should be ordered by date (format: 2014-11-04 15:22:12:606)
if (strlen(line) > 24) { if (strlen(line) > 24) {
char date[24] = {'\0'}; char date[24] = {'\0'};
...@@ -180,6 +183,9 @@ time_t check_file(LinphoneCoreManager* mgr) { ...@@ -180,6 +183,9 @@ time_t check_file(LinphoneCoreManager* mgr) {
time_prev = time_curr; time_prev = time_curr;
} }
} }
#else
ms_warning("strptime() not available for this platform, test is incomplete.");
#endif
} }
CU_ASSERT_TRUE(line_count > 25); CU_ASSERT_TRUE(line_count > 25);
free(line); free(line);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment