mirror of https://github.com/acidanthera/audk.git
fixed operator order
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8887 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b4b9fbc40e
commit
0158294b9b
|
@ -2005,6 +2005,7 @@ CopyReplace(
|
||||||
IN CONST CHAR16 *FindTarget,
|
IN CONST CHAR16 *FindTarget,
|
||||||
IN CONST CHAR16 *ReplaceWith
|
IN CONST CHAR16 *ReplaceWith
|
||||||
){
|
){
|
||||||
|
UINTN Size;
|
||||||
if ( (SourceString == NULL)
|
if ( (SourceString == NULL)
|
||||||
|| (NewString == NULL)
|
|| (NewString == NULL)
|
||||||
|| (FindTarget == NULL)
|
|| (FindTarget == NULL)
|
||||||
|
@ -2018,12 +2019,14 @@ CopyReplace(
|
||||||
while (*SourceString != L'\0') {
|
while (*SourceString != L'\0') {
|
||||||
if (StrnCmp(SourceString, FindTarget, StrLen(FindTarget)) == 0) {
|
if (StrnCmp(SourceString, FindTarget, StrLen(FindTarget)) == 0) {
|
||||||
SourceString += StrLen(FindTarget);
|
SourceString += StrLen(FindTarget);
|
||||||
if ((StrSize(NewString) + (StrLen(ReplaceWith)*sizeof(CHAR16))) > NewSize) {
|
Size = StrSize(NewString);
|
||||||
|
if ((Size + (StrLen(ReplaceWith)*sizeof(CHAR16))) > NewSize) {
|
||||||
return (EFI_BUFFER_TOO_SMALL);
|
return (EFI_BUFFER_TOO_SMALL);
|
||||||
}
|
}
|
||||||
StrCat(NewString, ReplaceWith);
|
StrCat(NewString, ReplaceWith);
|
||||||
} else {
|
} else {
|
||||||
if (StrSize(NewString) + sizeof(CHAR16) > NewSize) {
|
Size = StrSize(NewString);
|
||||||
|
if (Size + sizeof(CHAR16) > NewSize) {
|
||||||
return (EFI_BUFFER_TOO_SMALL);
|
return (EFI_BUFFER_TOO_SMALL);
|
||||||
}
|
}
|
||||||
StrnCat(NewString, SourceString, 1);
|
StrnCat(NewString, SourceString, 1);
|
||||||
|
|
Loading…
Reference in New Issue