diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-04-28 16:36:56 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-04-29 13:58:14 -0500 |
commit | bcd3ee7ab858d62beb36af9f5986544b68a3dd35 (patch) | |
tree | 424c4e61a580b7c4b7481712f69ab0193d76b9c4 /src/test/DUtilUnitTest/FileUtilTest.cpp | |
parent | d73c29407fe5ec6a0207af7d9c2547457ae0854c (diff) | |
download | wix-bcd3ee7ab858d62beb36af9f5986544b68a3dd35.tar.gz wix-bcd3ee7ab858d62beb36af9f5986544b68a3dd35.tar.bz2 wix-bcd3ee7ab858d62beb36af9f5986544b68a3dd35.zip |
Clean up more 32-bit assumptions.
Diffstat (limited to 'src/test/DUtilUnitTest/FileUtilTest.cpp')
-rw-r--r-- | src/test/DUtilUnitTest/FileUtilTest.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/test/DUtilUnitTest/FileUtilTest.cpp b/src/test/DUtilUnitTest/FileUtilTest.cpp index 0087a1d5..ac071ef2 100644 --- a/src/test/DUtilUnitTest/FileUtilTest.cpp +++ b/src/test/DUtilUnitTest/FileUtilTest.cpp | |||
@@ -50,7 +50,7 @@ namespace DutilTests | |||
50 | } | 50 | } |
51 | 51 | ||
52 | private: | 52 | private: |
53 | void TestFile(LPWSTR wzDir, LPCWSTR wzTempDir, LPWSTR wzFileName, DWORD dwExpectedStringLength, FILE_ENCODING feExpectedEncoding) | 53 | void TestFile(LPWSTR wzDir, LPCWSTR wzTempDir, LPWSTR wzFileName, size_t cbExpectedStringLength, FILE_ENCODING feExpectedEncoding) |
54 | { | 54 | { |
55 | HRESULT hr = S_OK; | 55 | HRESULT hr = S_OK; |
56 | LPWSTR sczFullPath = NULL; | 56 | LPWSTR sczFullPath = NULL; |
@@ -61,6 +61,7 @@ namespace DutilTests | |||
61 | DWORD cbFile1 = 0; | 61 | DWORD cbFile1 = 0; |
62 | BYTE *pbFile2 = NULL; | 62 | BYTE *pbFile2 = NULL; |
63 | DWORD cbFile2 = 0; | 63 | DWORD cbFile2 = 0; |
64 | size_t cbActualStringLength = 0; | ||
64 | 65 | ||
65 | try | 66 | try |
66 | { | 67 | { |
@@ -77,10 +78,13 @@ namespace DutilTests | |||
77 | NativeAssert::Succeeded(hr, "FileToString() returned NULL for file: {0}", sczFullPath); | 78 | NativeAssert::Succeeded(hr, "FileToString() returned NULL for file: {0}", sczFullPath); |
78 | } | 79 | } |
79 | 80 | ||
80 | if ((DWORD)lstrlenW(sczContents) != dwExpectedStringLength) | 81 | hr = ::StringCchLengthW(sczContents, STRSAFE_MAX_CCH, &cbActualStringLength); |
82 | NativeAssert::Succeeded(hr, "Failed to get length of text from file: {0}", sczFullPath); | ||
83 | |||
84 | if (cbActualStringLength != cbExpectedStringLength) | ||
81 | { | 85 | { |
82 | hr = E_FAIL; | 86 | hr = E_FAIL; |
83 | ExitOnFailure(hr, "FileToString() returned wrong size for file: %ls (expected size %u, found size %u)", sczFullPath, dwExpectedStringLength, lstrlenW(sczContents)); | 87 | ExitOnFailure(hr, "FileToString() returned wrong size for file: %ls (expected size %Iu, found size %Iu)", sczFullPath, cbExpectedStringLength, cbActualStringLength); |
84 | } | 88 | } |
85 | 89 | ||
86 | if (feEncodingFound != feExpectedEncoding) | 90 | if (feEncodingFound != feExpectedEncoding) |