diff --git a/build-example.sh b/build-example.sh index 6f512f7c..c428d8ac 100755 --- a/build-example.sh +++ b/build-example.sh @@ -28,8 +28,8 @@ LDFLAGS=${LDFLAGS:-} # The "-fdata-sections -ffunction-sections -Wl,--gc-sections" produces smaller # binaries. See commit 41fce8a8 "Strip examples of unused data and functions". -CFLAGS=${CFLAGS:--O3 -fdata-sections -ffunction-sections -Wl,--gc-sections} -CXXFLAGS=${CXXFLAGS:--O3 -fdata-sections -ffunction-sections -Wl,--gc-sections} +CFLAGS=${CFLAGS:--O3 -fdata-sections -ffunction-sections -Wall -Wl,--gc-sections} +CXXFLAGS=${CXXFLAGS:--O3 -fdata-sections -ffunction-sections -Wall -Wl,--gc-sections} mkdir -p gen/bin diff --git a/example/cbor-to-json/cbor-to-json.cc b/example/cbor-to-json/cbor-to-json.cc index e23b8cdc..02b540cb 100644 --- a/example/cbor-to-json/cbor-to-json.cc +++ b/example/cbor-to-json/cbor-to-json.cc @@ -385,10 +385,8 @@ flush_dst() { if (n == 0) { break; } - ssize_t i = fwrite(g_dst.reader_pointer(), 1, n, stdout); - if (i >= 0) { - g_dst.meta.ri += i; - } + size_t i = fwrite(g_dst.reader_pointer(), 1, n, stdout); + g_dst.meta.ri += i; if (i < n) { return "main: error writing to stdout"; } diff --git a/example/json-to-cbor/json-to-cbor.cc b/example/json-to-cbor/json-to-cbor.cc index cb045041..30f806ec 100644 --- a/example/json-to-cbor/json-to-cbor.cc +++ b/example/json-to-cbor/json-to-cbor.cc @@ -215,10 +215,8 @@ flush_dst() { if (n == 0) { break; } - ssize_t i = fwrite(g_dst.reader_pointer(), 1, n, stdout); - if (i >= 0) { - g_dst.meta.ri += i; - } + size_t i = fwrite(g_dst.reader_pointer(), 1, n, stdout); + g_dst.meta.ri += i; if (i < n) { return "main: error writing to stdout"; }