From 06cee07154791d7016047d8f83f59d052568752d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 7 Jan 2015 08:05:04 -0800 Subject: [PATCH] folly/String-inl.h (humanify): avoid -Wsign-compare error Summary: * folly/String-inl.h (humanify): Count with a signed type. Otherwise, gcc-4.9 fails with e.g., folly/String-inl.h:596:33: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] folly/String-inl.h:601:32: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] Test Plan: Run this and note there are fewer errors than before: fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo Reviewed By: philipp@fb.com Subscribers: trunkagent, folly-diffs@ FB internal diff: D1770451 Tasks: 5941250 Signature: t1:1770451:1420704354:c841ca453a5586fbf474535ca26cef17f95427dd --- folly/String-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/String-inl.h b/folly/String-inl.h index 27b02a61..28a7a178 100644 --- a/folly/String-inl.h +++ b/folly/String-inl.h @@ -567,8 +567,8 @@ void backslashify(const String1& input, String2& output, bool hex_style) { template void humanify(const String1& input, String2& output) { - int numUnprintable = 0; - int numPrintablePrefix = 0; + size_t numUnprintable = 0; + size_t numPrintablePrefix = 0; for (unsigned char c : input) { if (c < 0x20 || c > 0x7e || c == '\\') { ++numUnprintable; -- 2.34.1