diff --git a/source/shared/core_stream.cpp b/source/shared/core_stream.cpp index 788c00ae..920d4799 100644 --- a/source/shared/core_stream.cpp +++ b/source/shared/core_stream.cpp @@ -141,27 +141,23 @@ size_t sqlsrv_stream_read( php_stream* stream, _Out_writes_bytes_(count) char* b } // if the encoding is UTF-8 - if (c_type == SQL_C_WCHAR) { - - count *= 2; // undo the shift to use the full buffer - - // flags set to 0 by default, which means that any invalid characters are dropped rather than causing - // an error. This happens only on XP. - - // convert to UTF-8 + if( c_type == SQL_C_WCHAR ) { + count *= 2; + // undo the shift to use the full buffer + // flags set to 0 by default, which means that any invalid characters are dropped rather than causing + // an error. This happens only on XP. + // convert to UTF-8 #ifndef __linux__ - DWORD flags = 0; - - if (g_osversion.dwMajorVersion >= SQLSRV_OS_VISTA_OR_LATER) { - // Vista (and later) will detect invalid UTF-16 characters and raise an error. - flags = WC_ERR_INVALID_CHARS; - } + DWORD flags = 0; + if( g_osversion.dwMajorVersion >= SQLSRV_OS_VISTA_OR_LATER ) { + // Vista (and later) will detect invalid UTF-16 characters and raise an error. + flags = WC_ERR_INVALID_CHARS; + } #endif - if ( count > INT_MAX || (read >> 1) > INT_MAX ) - { - LOG(SEV_ERROR, "UTF-16 (wide character) string mapping: buffer length exceeded."); - throw core::CoreException(); - } + if( count > INT_MAX || (read >> 1) > INT_MAX ) { + LOG(SEV_ERROR, "UTF-16 (wide character) string mapping: buffer length exceeded."); + throw core::CoreException(); + } #ifdef __linux__ int enc_len = SystemLocale::FromUtf16( ss->encoding, reinterpret_cast( temp_buf.get() ),