Quellcode durchsuchen

use inttypes.h instead of stdint.h

stdint.h is included by inttypes.h. In addition, we get printf-encodings that work in all platforms.
Julius Pfrommer vor 9 Jahren
Ursprung
Commit
76bbe178f7
3 geänderte Dateien mit 2 neuen und 7 gelöschten Zeilen
  1. 1 5
      examples/client_firstSteps.c
  2. 1 1
      include/ua_types.h
  3. 0 1
      src/ua_util.h

+ 1 - 5
examples/client_firstSteps.c

@@ -37,11 +37,7 @@ int main(void) {
             UA_Variant_isScalar(&rResp.results[0].value) &&
             rResp.results[0].value.type == &UA_TYPES[UA_TYPES_DATETIME]) {
         raw_date = *(UA_DateTime*)rResp.results[0].value.data;
-        #ifdef _WIN32
-           printf("raw date is: %I64u\n", raw_date);
-        #else
-           printf("raw date is: %llu\n", raw_date);
-        #endif
+        printf("raw date is: %" PRId64 "\n", raw_date);
         UA_DateTime_toString(raw_date, string_date);
         printf("string date is: %.*s\n", string_date->length, string_date->data);
     }

+ 1 - 1
include/ua_types.h

@@ -20,7 +20,7 @@
 extern "C" {
 #endif
 
-#include <stdint.h>
+#include <inttypes.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include <string.h>

+ 0 - 1
src/ua_util.h

@@ -81,7 +81,6 @@
 #include <stdarg.h> // va_start, va_end
 #include <time.h>
 #include <stdio.h> // printf
-#include <inttypes.h>
 
 #ifdef _WIN32
 # include <winsock2.h> //needed for amalgation