fixed some pointer arithmetic issue on non GNU compilers.
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
set(CMAKE_BUILD_TYPE Release)
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
endif()
|
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_DEBUG "-g -Werror")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O2")
|
set(CMAKE_C_FLAGS_RELEASE "-O2")
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -1,6 +1,7 @@
|
|||||||
#include "xmlUtil.h"
|
#include "xmlUtil.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
char * freeAndDup(xmlChar * line) {
|
char * freeAndDup(xmlChar * line) {
|
||||||
char * free = strdup((const char *) line);
|
char * free = strdup((const char *) line);
|
||||||
@@ -29,8 +30,9 @@ void fixPath(char * path) {
|
|||||||
|
|
||||||
int countUntilNull(void * pointers, size_t typeSize) {
|
int countUntilNull(void * pointers, size_t typeSize) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(pointers != NULL) {
|
char * arithmetic = (char *)pointers;
|
||||||
pointers += typeSize;
|
while(arithmetic != NULL) {
|
||||||
|
arithmetic += typeSize;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
|
|||||||
Reference in New Issue
Block a user