qcborstreamreader.cpp: Use QT_TRY/QT_CATCH

To avoid build error with no exceptions:
qtbase/src/corelib/serialization/qcborstreamreader.cpp:1586:9: error: cannot use 'try' with exceptions disabled
        try {
        ^
qtbase/src/corelib/serialization/qcborstreamreader.cpp:1629:9: error: cannot use 'try' with exceptions disabled
        try {
        ^
2 errors generated.

Used compiler: https://github.com/mstorsjo/llvm-mingw

It's not a supported configuration, but the change is simple.

Change-Id: I263ce23b458f114b2330e832c5f4fd2a99cbb973
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Nodir Temirkhodjaev 2021-05-19 10:03:40 +03:00 committed by Thiago Macieira
parent 19bb9837a1
commit ffde36c9a3
1 changed files with 4 additions and 4 deletions

View File

@ -1583,9 +1583,9 @@ QCborStreamReaderPrivate::readStringChunk_byte(ReadStringChunk params, qsizetype
handleError(CborErrorDataTooLarge);
return -1;
}
try {
QT_TRY {
params.array->resize(newSize);
} catch (const std::bad_alloc &) {
} QT_CATCH (const std::bad_alloc &) {
// the distinction between DataTooLarge and OOM is mostly for
// compatibility with Qt 5; in Qt 6, we could consider everything
// to be OOM.
@ -1626,9 +1626,9 @@ QCborStreamReaderPrivate::readStringChunk_unicode(ReadStringChunk params, qsizet
// conversion uses the same number of words or less.
QChar *begin = nullptr;
if (params.isString()) {
try {
QT_TRY {
params.string->resize(utf8len);
} catch (const std::bad_alloc &) {
} QT_CATCH (const std::bad_alloc &) {
if (utf8len > MaxStringSize)
handleError(CborErrorDataTooLarge);
else