diff options
| author | Aldrik Ramaekers <aldrik@mailbox.org> | 2025-12-26 09:41:24 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@mailbox.org> | 2025-12-26 09:41:24 +0100 |
| commit | 178e8c135a60e9f206dcfbad8bab7bb868e6a294 (patch) | |
| tree | 05aa6ad4e9e3f68aea29c1ff8b1c1f445f6c0a3f /libs/xml.c | |
| parent | 6abbea56a6bfa69cb5e576223301f0c992b646fa (diff) | |
linux port
Diffstat (limited to 'libs/xml.c')
| -rw-r--r-- | libs/xml.c/src/xml.c | 20 | ||||
| -rw-r--r-- | libs/xml.c/src/xml.h | 1 |
2 files changed, 14 insertions, 7 deletions
diff --git a/libs/xml.c/src/xml.c b/libs/xml.c/src/xml.c index 6d14213..0b435cd 100644 --- a/libs/xml.c/src/xml.c +++ b/libs/xml.c/src/xml.c @@ -320,11 +320,11 @@ static void xml_parser_error(struct xml_parser* parser, enum xml_parser_offset o int row = 0; int column = 0; - //#define min(X,Y) ((X) < (Y) ? (X) : (Y)) - //#define max(X,Y) ((X) > (Y) ? (X) : (Y)) + #define min(X,Y) ((X) < (Y) ? (X) : (Y)) + #define max(X,Y) ((X) > (Y) ? (X) : (Y)) size_t character = max(0, min(parser->length, parser->position + offset)); - //#undef min - //#undef max + #undef min + #undef max size_t position = 0; for (; position < character; ++position) { column++; @@ -1140,9 +1140,9 @@ void xml_string_copy(struct xml_string* string, uint8_t* buffer, size_t length) return; } - //#define min(X,Y) ((X) < (Y) ? (X) : (Y)) + #define min(X,Y) ((X) < (Y) ? (X) : (Y)) length = min(length, string->length); - //#undef min + #undef min memcpy(buffer, string->buffer, length); } @@ -1328,5 +1328,11 @@ time_t xml_get_date_x(struct xml_node* root, char* child_name, ...) time_t result = mktime(&tm_info); if (result == -1) return 0; - else return result - _timezone; + else { + #ifdef win64 + return result - _timezone; + #else + return result - timezone; + #endif + } }
\ No newline at end of file diff --git a/libs/xml.c/src/xml.h b/libs/xml.c/src/xml.h index ef8d55c..43e7f0f 100644 --- a/libs/xml.c/src/xml.h +++ b/libs/xml.c/src/xml.h @@ -31,6 +31,7 @@ #include <stdint.h> #include <stdio.h> #include <string.h> +#include <time.h> #ifdef __cplusplus extern "C" { |
