From 660cf0274a2ae21fca3589b0319504ae6791466e Mon Sep 17 00:00:00 2001 From: "ddkilzer@apple.com" Date: Thu, 17 Jan 2013 16:37:17 +0000 Subject: [PATCH] Fix vprintf_stderr_common() to compile with -Wshorten-64-to-32 Reviewed by Darin Adler. Fixes the following build error: Assertions.cpp:92:22: error: implicit conversion loses integer precision: 'CFIndex' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32] int length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8); ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. * wtf/Assertions.cpp: (vprintf_stderr_common): Use CFIndex type instead of int for the return value of CFStringGetMaximumSizeForEncoding(). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139982 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WTF/ChangeLog | 18 ++++++++++++++++++ Source/WTF/wtf/Assertions.cpp | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 2e795e12d830..c65cd7d57a46 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,21 @@ +2013-01-17 David Kilzer + + Fix vprintf_stderr_common() to compile with -Wshorten-64-to-32 + + + Reviewed by Darin Adler. + + Fixes the following build error: + + Assertions.cpp:92:22: error: implicit conversion loses integer precision: 'CFIndex' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32] + int length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8); + ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 error generated. + + * wtf/Assertions.cpp: + (vprintf_stderr_common): Use CFIndex type instead of int for the + return value of CFStringGetMaximumSizeForEncoding(). + 2013-01-17 Zan Dobersek [Autotools] Unify WTF sources list regardless of the target OS, Unicode backend diff --git a/Source/WTF/wtf/Assertions.cpp b/Source/WTF/wtf/Assertions.cpp index ed48d813dfba..4a4681b4eafe 100644 --- a/Source/WTF/wtf/Assertions.cpp +++ b/Source/WTF/wtf/Assertions.cpp @@ -89,7 +89,7 @@ static void vprintf_stderr_common(const char* format, va_list args) #if COMPILER(CLANG) #pragma clang diagnostic pop #endif - int length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8); + CFIndex length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8); char* buffer = (char*)malloc(length + 1); CFStringGetCString(str, buffer, length, kCFStringEncodingUTF8); -- 2.36.0