Skip to content

Commit d2b1cc2

Browse files
committed
Remove cch parameter from CopyString methods
1 parent 0899264 commit d2b1cc2

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

lib/Parser/Hash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ IdentPtr HashTbl::PidHashNameLenWithHash(_In_reads_(cch) CharType const * prgch,
324324
pid->m_propertyId = Js::Constants::NoProperty;
325325
pid->assignmentState = NotAssigned;
326326

327-
HashTbl::CopyString(pid->m_sz, prgch, end, cch);
327+
HashTbl::CopyString(pid->m_sz, prgch, end);
328328

329329
return pid;
330330
}

lib/Parser/Hash.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -426,22 +426,22 @@ class HashTbl
426426
}
427427
return true;
428428
}
429-
static void CopyString(__in_ecount(cch + 1) LPOLESTR psz1, __in_ecount(cch) LPCOLESTR psz2, LPCOLESTR psz2end, int32 cch)
429+
static void CopyString(__in_ecount((psz2end - psz2) + 1) LPOLESTR psz1, __in_ecount(psz2end - psz2) LPCOLESTR psz2, LPCOLESTR psz2end)
430430
{
431-
Unused(psz2end);
431+
size_t cch = psz2end - psz2;
432432
js_memcpy_s(psz1, cch * sizeof(OLECHAR), psz2, cch * sizeof(OLECHAR));
433433
psz1[cch] = 0;
434434
}
435-
static void CopyString(__in_ecount(cch + 1) LPOLESTR psz1, LPCUTF8 psz2, LPCUTF8 psz2end, int32 cch)
435+
static void CopyString(LPOLESTR psz1, LPCUTF8 psz2, LPCUTF8 psz2end)
436436
{
437-
Unused(cch);
438437
utf8::DecodeUnitsIntoAndNullTerminate(psz1, psz2, psz2end);
439438
}
440-
static void CopyString(__in_ecount(cch + 1) LPOLESTR psz1, __in_ecount(cch) char const * psz2, char const * psz2end, int32 cch)
439+
static void CopyString(LPOLESTR psz1, char const * psz2, char const * psz2end)
441440
{
442-
Unused(psz2end);
443-
while (cch-- > 0)
441+
while (psz2 < psz2end)
442+
{
444443
*(psz1++) = *psz2++;
444+
}
445445
*psz1 = 0;
446446
}
447447

0 commit comments

Comments
 (0)