fix code not compiling under windows+mingw

Tue, 07 Feb 2023 20:08:45 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 07 Feb 2023 20:08:45 +0100
changeset 650
77021e06b1a8
parent 649
12c2b10b51a9
child 651
19d1a8422f6e

fix code not compiling under windows+mingw

src/allocator.c file | annotate | diff | comparison | revisions
src/array_list.c file | annotate | diff | comparison | revisions
src/basic_mempool.c file | annotate | diff | comparison | revisions
src/buffer.c file | annotate | diff | comparison | revisions
src/compare.c file | annotate | diff | comparison | revisions
src/cx/common.h file | annotate | diff | comparison | revisions
src/cx/compare.h file | annotate | diff | comparison | revisions
src/linked_list.c file | annotate | diff | comparison | revisions
test/test_compare.cpp file | annotate | diff | comparison | revisions
--- a/src/allocator.c	Tue Feb 07 20:08:08 2023 +0100
+++ b/src/allocator.c	Tue Feb 07 20:08:45 2023 +0100
@@ -28,8 +28,6 @@
 
 #include "cx/allocator.h"
 
-#include <stdlib.h>
-
 __attribute__((__malloc__, __alloc_size__(2)))
 static void *cx_malloc_stdlib(
         __attribute__((__unused__)) void *d,
--- a/src/array_list.c	Tue Feb 07 20:08:08 2023 +0100
+++ b/src/array_list.c	Tue Feb 07 20:08:45 2023 +0100
@@ -29,7 +29,6 @@
 #include "cx/array_list.h"
 #include <assert.h>
 #include <string.h>
-#include <stdint.h>
 
 // LOW LEVEL ARRAY LIST FUNCTIONS
 
--- a/src/basic_mempool.c	Tue Feb 07 20:08:08 2023 +0100
+++ b/src/basic_mempool.c	Tue Feb 07 20:08:45 2023 +0100
@@ -28,7 +28,6 @@
 
 #include "cx/basic_mempool.h"
 #include "cx/utils.h"
-#include <stdint.h>
 #include <string.h>
 
 #define of_chk_(n) if (SIZE_MAX - sizeof(cx_destructor_func) < (n)) return NULL
--- a/src/buffer.c	Tue Feb 07 20:08:08 2023 +0100
+++ b/src/buffer.c	Tue Feb 07 20:08:45 2023 +0100
@@ -29,10 +29,8 @@
 #include "cx/buffer.h"
 #include "cx/utils.h"
 
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdint.h>
 
 int cxBufferInit(
         CxBuffer *buffer,
--- a/src/compare.c	Tue Feb 07 20:08:08 2023 +0100
+++ b/src/compare.c	Tue Feb 07 20:08:45 2023 +0100
@@ -28,7 +28,6 @@
 
 #include "cx/compare.h"
 
-#include <stdint.h>
 #include <math.h>
 
 int cx_cmp_int(void const *i1, void const *i2) {
--- a/src/cx/common.h	Tue Feb 07 20:08:08 2023 +0100
+++ b/src/cx/common.h	Tue Feb 07 20:08:45 2023 +0100
@@ -92,6 +92,7 @@
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdbool.h>
+#include <stdint.h>
 
 /**
  * Function pointer compatible with fwrite-like functions.
@@ -104,12 +105,15 @@
 );
 
 #ifdef _WIN32
+#ifdef __MINGW32__
+#include <sys/types.h>
+#endif // __MINGW32__
 #ifndef __WORDSIZE
 #ifdef _WIN64
 #define __WORDSIZE 64
 #else
 #define __WORDSIZE 32
-#endif
+#endif // _WIN64
 #endif // __WORDSIZE
 #else // !_WIN32
 
--- a/src/cx/compare.h	Tue Feb 07 20:08:08 2023 +0100
+++ b/src/cx/compare.h	Tue Feb 07 20:08:45 2023 +0100
@@ -37,6 +37,8 @@
 #ifndef UCX_COMPARE_H
 #define UCX_COMPARE_H
 
+#include "common.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
--- a/src/linked_list.c	Tue Feb 07 20:08:08 2023 +0100
+++ b/src/linked_list.c	Tue Feb 07 20:08:45 2023 +0100
@@ -28,7 +28,6 @@
 
 #include "cx/linked_list.h"
 #include "cx/utils.h"
-#include <stdint.h>
 #include <string.h>
 #include <assert.h>
 
--- a/test/test_compare.cpp	Tue Feb 07 20:08:08 2023 +0100
+++ b/test/test_compare.cpp	Tue Feb 07 20:08:45 2023 +0100
@@ -87,7 +87,7 @@
 }
 
 TEST(Compare, Uint) {
-    test_compare<uint>(cx_cmp_uint);
+    test_compare<unsigned int>(cx_cmp_uint);
 }
 
 TEST(Compare, Ulongint) {

mercurial