From 3558b7b985900e108fe7540f56d58145fce20962 Mon Sep 17 00:00:00 2001 From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> Date: Sat, 23 Dec 2023 21:24:51 +0100 Subject: [PATCH] [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);