From 463c559962ad480c69fdbe6ebcf741a4b2bd6eee Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 12 Jan 2015 10:24:47 +0100 Subject: [PATCH] MSVC: Silence warning about right shift by too large amount Silence the MSVC warning that got introduced in commit 62b752b3a2c9: warning C4333: '>>' : right shift by too large amount, data loss qdebug.cpp(316) : see reference to function template instantiation 'void putEscapedString(QTextStreamPrivate *,const Char *,int,bool)' being compiled with [ Char=uchar ] qdebug.cpp(270) : warning C4333: '>>' : right shift by too large amount, data loss Change-Id: If1ee20b741feae3287a8d6a11c202b4296d429fb Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 9ed29c38af..ad61621a93 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2014 Intel Corporation. ** Contact: http://www.qt-project.org/legal ** @@ -263,12 +263,8 @@ static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, in // improperly-paired surrogates, fall through } buf[1] = 'u'; - if (sizeof(Char) == 1) { - buf[2] = buf[3] = '0'; - } else { - buf[2] = toHexUpper(*p >> 12); - buf[3] = toHexUpper(*p >> 8); - } + buf[2] = toHexUpper(ushort(*p) >> 12); + buf[3] = toHexUpper(ushort(*p) >> 8); buf[4] = toHexUpper(*p >> 4); buf[5] = toHexUpper(*p); buflen = 6;