From 3376ac1da6df672d82f3d089ecc5484b19705373 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 5 Oct 2022 14:02:01 +0200 Subject: [PATCH] fixed some pointer arithmetic issue on non GNU compilers. --- CMakeLists.txt | 2 +- src/fomod/xmlUtil.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8deda90..8b2e40b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -fsanitize=address -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wno-pointer-arith") +set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -fsanitize=address -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations") set(CMAKE_C_FLAGS_DEBUG "-g -Werror") set(CMAKE_C_FLAGS_RELEASE "-O2") diff --git a/src/fomod/xmlUtil.c b/src/fomod/xmlUtil.c index b7c0d3d..9e25d8a 100644 --- a/src/fomod/xmlUtil.c +++ b/src/fomod/xmlUtil.c @@ -1,6 +1,7 @@ #include "xmlUtil.h" #include +#include char * freeAndDup(xmlChar * line) { char * free = strdup((const char *) line); @@ -29,8 +30,9 @@ void fixPath(char * path) { int countUntilNull(void * pointers, size_t typeSize) { int i = 0; - while(pointers != NULL) { - pointers += typeSize; + char * arithmetic = (char *)pointers; + while(arithmetic != NULL) { + arithmetic += typeSize; i++; } return i;