Ticket #2986: 52-fix-wchar_t-ucs2.diff
File 52-fix-wchar_t-ucs2.diff, 1.3 KB (added by , 13 years ago) |
---|
-
src/libs/detail/utf8_codecvt_facet.cpp
old new 231 231 return 2; 232 232 } 233 233 234 // note the following code will generate on some platforms where235 // wchar_t is defined as UCS2. The warnings are superfluous as236 // the specialization is never instantitiated with such compilers.237 234 template<> 238 235 int get_cont_octet_out_count_impl<4>(wchar_t word){ 239 236 if (word < 0x80) { … … 242 239 if (word < 0x800) { 243 240 return 1; 244 241 } 242 243 // Note that the following code will generate warnings on some platforms 244 // where wchar_t is defined as UCS2. The warnings are superfluous as the 245 // specialization is never instantitiated with such compilers, but this 246 // can cause problems if warnings are being treated as errors, so we guard 247 // against that. Including <boost/detail/utf8_codecvt_facet.hpp> as we do 248 // should be enough to get WCHAR_MAX defined. 249 #if !defined(WCHAR_MAX) 250 # error WCHAR_MAX not defined! 251 #endif 252 #if WCHAR_MAX > 0x10000 253 245 254 if (word < 0x10000) { 246 255 return 2; 247 256 } … … 252 261 return 4; 253 262 } 254 263 return 5; 264 265 #else 266 267 return 2; 268 269 #endif 255 270 } 256 271 257 272 } // namespace anonymous