Skip to content

Commit 32beebf

Browse files
Fix cast between semantically different integer types (#8414)
This patch fixes 2 instances of internal issues; C6214: Cast between semantically different integer types. Fixes internal bugs: 61940839 and 61940838 --------- Co-authored-by: Deric C. <[email protected]>
1 parent 1f53295 commit 32beebf

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

lib/DxcSupport/FileIOHelper.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,16 @@ static bool TryCreateEmptyBlobUtf(UINT32 codePage, IMalloc *pMalloc,
527527
IDxcBlobEncoding **ppBlobEncoding) {
528528
if (codePage == CP_UTF8) {
529529
InternalDxcBlobUtf8 *internalUtf8;
530-
IFR(InternalDxcBlobUtf8::CreateFromMalloc(nullptr, pMalloc, 0, true,
531-
codePage, &internalUtf8));
530+
if (DXC_FAILED(InternalDxcBlobUtf8::CreateFromMalloc(
531+
nullptr, pMalloc, 0, true, codePage, &internalUtf8)))
532+
return false;
532533
*ppBlobEncoding = internalUtf8;
533534
return true;
534535
} else if (codePage == DXC_CP_WIDE) {
535536
InternalDxcBlobWide *internalWide;
536-
IFR(InternalDxcBlobWide::CreateFromMalloc(nullptr, pMalloc, 0, true,
537-
codePage, &internalWide));
537+
if (DXC_FAILED(InternalDxcBlobWide::CreateFromMalloc(
538+
nullptr, pMalloc, 0, true, codePage, &internalWide)))
539+
return false;
538540
*ppBlobEncoding = internalWide;
539541
return true;
540542
}
@@ -551,14 +553,16 @@ static bool TryCreateBlobUtfFromBlob(IDxcBlob *pFromBlob, UINT32 codePage,
551553
pFromBlob->GetBufferSize(), codePage)) {
552554
if (codePage == CP_UTF8) {
553555
InternalDxcBlobUtf8 *internalUtf8;
554-
IFR(InternalDxcBlobUtf8::CreateFromBlob(pFromBlob, pMalloc, true,
555-
codePage, &internalUtf8));
556+
if (DXC_FAILED(InternalDxcBlobUtf8::CreateFromBlob(
557+
pFromBlob, pMalloc, true, codePage, &internalUtf8)))
558+
return false;
556559
*ppBlobEncoding = internalUtf8;
557560
return true;
558561
} else if (codePage == DXC_CP_WIDE) {
559562
InternalDxcBlobWide *internalWide;
560-
IFR(InternalDxcBlobWide::CreateFromBlob(pFromBlob, pMalloc, true,
561-
codePage, &internalWide));
563+
if (DXC_FAILED(InternalDxcBlobWide::CreateFromBlob(
564+
pFromBlob, pMalloc, true, codePage, &internalWide)))
565+
return false;
562566
*ppBlobEncoding = internalWide;
563567
return true;
564568
}

0 commit comments

Comments
 (0)