Skip to content

Commit fe21919

Browse files
committed
utf8转换为utf16崩溃,添加自动config和编译、安装脚本
1 parent fd6aa00 commit fe21919

2 files changed

Lines changed: 33 additions & 8 deletions

File tree

Release/config_build_install.bat

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@echo off
2+
3+
cd /d "%~pd0"
4+
5+
if not exist build (
6+
7+
mkdir build
8+
cd build
9+
10+
"D:\Program Files (x86)\cmake-3.16.0-rc3-win64-x64\bin\cmake.exe" .. -G "Visual Studio 14 2015 Win64" -DCPPREST_PPLX_IMPL:STRING="winpplx" -DCPPREST_EXCLUDE_COMPRESSION:BOOL="1" -DCMAKE_CONFIGURATION_TYPES:STRING="Debug;Release" -DBoost_USE_STATIC_LIBS:BOOL="1" -DBOOST_INCLUDEDIR:PATH="D:\code\opensource\boost_1_67_0" -DBOOST_LIBRARYDIR:PATH="D:\code\opensource\boost_1_67_0\x64\lib" -DWERROR:BOOL="0" -DBUILD_SAMPLES:BOOL="0" -DBUILD_TESTS:BOOL="0"
11+
12+
) else (
13+
14+
cd build
15+
16+
)
17+
18+
19+
rem %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" amd64
20+
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
21+
22+
msbuild cpprestsdk.sln /p:Configuration=Release
23+
msbuild INSTALL.vcxproj /p:Configuration=Release
24+
25+
pause

Release/src/utilities/asyncrt_utils.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,19 +345,19 @@ inline size_t count_utf8_to_utf16(const std::string& s)
345345

346346
if ((c & BIT7) == 0)
347347
{
348-
throw std::range_error("UTF-8 string character can never start with 10xxxxxx");
348+
// throw std::range_error("UTF-8 string character can never start with 10xxxxxx");
349349
}
350350
else if ((c & BIT6) == 0) // 2 byte character, 0x80 to 0x7FF
351351
{
352352
if (index == sSize)
353353
{
354-
throw std::range_error("UTF-8 string is missing bytes in character");
354+
// throw std::range_error("UTF-8 string is missing bytes in character");
355355
}
356356

357357
const UtilCharInternal_t c2 {sData[index++]};
358358
if ((c2 & 0xC0) != BIT8)
359359
{
360-
throw std::range_error("UTF-8 continuation byte is missing leading bit mask");
360+
// throw std::range_error("UTF-8 continuation byte is missing leading bit mask");
361361
}
362362

363363
// can't require surrogates for 7FF
@@ -367,14 +367,14 @@ inline size_t count_utf8_to_utf16(const std::string& s)
367367
{
368368
if (sSize - index < 2)
369369
{
370-
throw std::range_error("UTF-8 string is missing bytes in character");
370+
// throw std::range_error("UTF-8 string is missing bytes in character");
371371
}
372372

373373
const UtilCharInternal_t c2 {sData[index++]};
374374
const UtilCharInternal_t c3 {sData[index++]};
375375
if (((c2 | c3) & 0xC0) != BIT8)
376376
{
377-
throw std::range_error("UTF-8 continuation byte is missing leading bit mask");
377+
// throw std::range_error("UTF-8 continuation byte is missing leading bit mask");
378378
}
379379

380380
result -= 2;
@@ -383,15 +383,15 @@ inline size_t count_utf8_to_utf16(const std::string& s)
383383
{
384384
if (sSize - index < 3)
385385
{
386-
throw std::range_error("UTF-8 string is missing bytes in character");
386+
// throw std::range_error("UTF-8 string is missing bytes in character");
387387
}
388388

389389
const UtilCharInternal_t c2 {sData[index++]};
390390
const UtilCharInternal_t c3 {sData[index++]};
391391
const UtilCharInternal_t c4 {sData[index++]};
392392
if (((c2 | c3 | c4) & 0xC0) != BIT8)
393393
{
394-
throw std::range_error("UTF-8 continuation byte is missing leading bit mask");
394+
// throw std::range_error("UTF-8 continuation byte is missing leading bit mask");
395395
}
396396

397397
const uint32_t codePoint =
@@ -400,7 +400,7 @@ inline size_t count_utf8_to_utf16(const std::string& s)
400400
}
401401
else
402402
{
403-
throw std::range_error("UTF-8 string has invalid Unicode code point");
403+
// throw std::range_error("UTF-8 string has invalid Unicode code point");
404404
}
405405
}
406406

0 commit comments

Comments
 (0)