From d500e0c37ba96f1e97edf7ddbcd2a74a366a2201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 4 May 2018 00:23:24 +0200 Subject: [PATCH] Enable -pedantic and fix use of %p with non-void* pointers --- Makefile | 2 +- sparsebundlefs.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b68f498..f6ab514 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ TARGET = sparsebundlefs PKG_CONFIG = pkg-config -override CFLAGS += -std=c++11 -Wall -O2 -g +override CFLAGS += -std=c++11 -Wall -pedantic -O2 -g GCC_4_2_OR_HIGHER := $(shell expr `$(CXX) -dumpversion | sed 's/\.//g'` \>= 420) ifeq "$(GCC_4_2_OR_HIGHER)" "1" diff --git a/sparsebundlefs.cpp b/sparsebundlefs.cpp index 2c0df8a..1fa184f 100644 --- a/sparsebundlefs.cpp +++ b/sparsebundlefs.cpp @@ -196,7 +196,7 @@ static int sparsebundle_read_process_band(const char *band_path, size_t length, char** buffer = static_cast(read_data); syslog(LOG_DEBUG, "reading %zu bytes at offset %ju into %p", - length, uintmax_t(offset), *buffer); + length, uintmax_t(offset), static_cast(*buffer)); int band_file = open(band_path, O_RDONLY); if (band_file != -1) { @@ -221,7 +221,8 @@ static int sparsebundle_read_pad_with_zeroes(size_t length, void *read_data) { char** buffer = static_cast(read_data); - syslog(LOG_DEBUG, "padding %zu bytes of zeroes into %p", length, *buffer); + syslog(LOG_DEBUG, "padding %zu bytes of zeroes into %p", + length, static_cast(*buffer)); memset(*buffer, 0, length); *buffer += length;