https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3558b7b985900e108fe75…
commit 3558b7b985900e108fe7540f56d58145fce20962
Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Sat Dec 23 21:24:51 2023 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Dec 23 21:24:51 2023 +0100
[VFATFS] FATGetNextDirEntry(): Fix 1 MSVC 'warning C4267' (#6179)
Fix `warning C4267: '=': conversion from 'size_t' to 'USHORT',
possible loss of data`
by explicitly casting to USHORT.
This is OK as the line immediately before NULL-terminates the buffer within boundary.
Addendum to commit 096a69471 (r6279).
---
drivers/filesystems/vfatfs/direntry.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/filesystems/vfatfs/direntry.c
b/drivers/filesystems/vfatfs/direntry.c
index 91d115c1eb0..937211ebf49 100644
--- a/drivers/filesystems/vfatfs/direntry.c
+++ b/drivers/filesystems/vfatfs/direntry.c
@@ -460,7 +460,7 @@ FATGetNextDirEntry(
/* Make sure filename is NULL terminate and calculate length */
DirContext->LongNameU.Buffer[DirContext->LongNameU.MaximumLength /
sizeof(WCHAR) - 1]
= UNICODE_NULL;
- DirContext->LongNameU.Length = wcslen(DirContext->LongNameU.Buffer) *
sizeof(WCHAR);
+ DirContext->LongNameU.Length = (USHORT)(wcslen(DirContext->LongNameU.Buffer) *
sizeof(WCHAR));
/* Init short name */
vfat8Dot3ToString(&DirContext->DirEntry.Fat, &DirContext->ShortNameU);