From 60cb1041df3783107b5d9a2e23f8b918878c8698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Thu, 24 Feb 2005 20:47:07 +0000 Subject: [PATCH] Fix various warnings svn path=/trunk/; revision=13734 --- reactos/drivers/fs/vfat/blockdev.c | 6 +- reactos/drivers/fs/vfat/create.c | 2 +- reactos/drivers/fs/vfat/dir.c | 4 +- reactos/drivers/fs/vfat/dirwr.c | 2 +- reactos/drivers/fs/vfat/fcb.c | 6 +- reactos/drivers/fs/vfat/fsctl.c | 6 +- reactos/drivers/fs/vfat/rw.c | 8 +-- reactos/drivers/fs/vfat/vfat.h | 106 +++++++++++++++-------------- reactos/drivers/fs/vfat/volume.c | 4 +- 9 files changed, 72 insertions(+), 72 deletions(-) diff --git a/reactos/drivers/fs/vfat/blockdev.c b/reactos/drivers/fs/vfat/blockdev.c index a653fe89567..f2e92d368ee 100644 --- a/reactos/drivers/fs/vfat/blockdev.c +++ b/reactos/drivers/fs/vfat/blockdev.c @@ -15,7 +15,7 @@ /* FUNCTIONS ***************************************************************/ -NTSTATUS STDCALL +static NTSTATUS STDCALL VfatReadWritePartialCompletion (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context) @@ -272,9 +272,9 @@ VfatWriteDiskPartial (IN PVFAT_IRP_CONTEXT IrpContext, NTSTATUS VfatBlockDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, IN ULONG CtlCode, - IN PVOID InputBuffer, + IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferSize, - IN OUT PVOID OutputBuffer, + IN OUT PVOID OutputBuffer OPTIONAL, IN OUT PULONG OutputBufferSize, IN BOOLEAN Override) { diff --git a/reactos/drivers/fs/vfat/create.c b/reactos/drivers/fs/vfat/create.c index d11001574c1..6ff28258bec 100644 --- a/reactos/drivers/fs/vfat/create.c +++ b/reactos/drivers/fs/vfat/create.c @@ -186,7 +186,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt, */ { PWCHAR PathNameBuffer; - ULONG PathNameBufferLength; + USHORT PathNameBufferLength; NTSTATUS Status; PVOID Context = NULL; PVOID Page; diff --git a/reactos/drivers/fs/vfat/dir.c b/reactos/drivers/fs/vfat/dir.c index 064ff79e373..03237ae779a 100644 --- a/reactos/drivers/fs/vfat/dir.c +++ b/reactos/drivers/fs/vfat/dir.c @@ -33,7 +33,7 @@ FsdDosDateTimeToSystemTime (PDEVICE_EXTENSION DeviceExt, USHORT DosDate, USHORT TimeFields.Day = pddate->Day; TimeFields.Month = pddate->Month; - TimeFields.Year = DeviceExt->BaseDateYear + pddate->Year; + TimeFields.Year = (CSHORT)(DeviceExt->BaseDateYear + pddate->Year); RtlTimeFieldsToTime (&TimeFields, &LocalTime); ExLocalTimeToSystemTime(&LocalTime, SystemTime); @@ -261,7 +261,7 @@ VfatGetFileBothInformation (PVFAT_DIRENTRY_CONTEXT DirContext, pInfo->NextEntryOffset = ULONG_ROUND_UP (sizeof (FILE_BOTH_DIR_INFORMATION) + DirContext->LongNameU.Length); RtlCopyMemory(pInfo->ShortName, DirContext->ShortNameU.Buffer, DirContext->ShortNameU.Length); - pInfo->ShortNameLength = DirContext->ShortNameU.Length; + pInfo->ShortNameLength = (CCHAR)DirContext->ShortNameU.Length; RtlCopyMemory (pInfo->FileName, DirContext->LongNameU.Buffer, DirContext->LongNameU.Length); // pInfo->FileIndex=; FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.Fat.CreationDate, diff --git a/reactos/drivers/fs/vfat/dirwr.c b/reactos/drivers/fs/vfat/dirwr.c index b907f3bec91..37edd61b46e 100644 --- a/reactos/drivers/fs/vfat/dirwr.c +++ b/reactos/drivers/fs/vfat/dirwr.c @@ -45,7 +45,7 @@ VfatUpdateEntry (PVFATFCB pFcb) return STATUS_SUCCESS; } - ASSERT (pFcb->parrentFcb); + ASSERT (pFcb->parentFcb); Offset.u.HighPart = 0; Offset.u.LowPart = dirIndex * SizeDirEntry; diff --git a/reactos/drivers/fs/vfat/fcb.c b/reactos/drivers/fs/vfat/fcb.c index ecffdcbb68e..aa44814149e 100644 --- a/reactos/drivers/fs/vfat/fcb.c +++ b/reactos/drivers/fs/vfat/fcb.c @@ -72,7 +72,7 @@ vfatSplitPathName(PUNICODE_STRING PathNameU, PUNICODE_STRING DirNameU, PUNICODE_ VOID vfatInitFcb(PVFATFCB Fcb, PUNICODE_STRING NameU) { - ULONG PathNameBufferLength; + USHORT PathNameBufferLength; if (NameU) PathNameBufferLength = NameU->Length + sizeof(WCHAR); @@ -460,7 +460,7 @@ vfatMakeFCBFromDirEntry(PVCB vcb, { PVFATFCB rcFCB; PWCHAR PathNameBuffer; - ULONG PathNameLength; + USHORT PathNameLength; ULONG Size; ULONG hash; @@ -583,7 +583,7 @@ vfatAttachFCBToFileObject (PDEVICE_EXTENSION vcb, fileObject->SectionObjectPointer = &fcb->SectionObjectPointers; fileObject->FsContext = fcb; fileObject->FsContext2 = newCCB; - DPRINT ("file open: fcb:%x PathName:%wZ file size: %d\n", fcb, &fcb->PathNameU, fcb->entry.FileSize); + DPRINT ("file open: fcb:%x PathName:%wZ\n", fcb, &fcb->PathNameU); return STATUS_SUCCESS; } diff --git a/reactos/drivers/fs/vfat/fsctl.c b/reactos/drivers/fs/vfat/fsctl.c index 0a797c76075..eb22588f2ca 100644 --- a/reactos/drivers/fs/vfat/fsctl.c +++ b/reactos/drivers/fs/vfat/fsctl.c @@ -109,8 +109,8 @@ VfatHasFileSystem(PDEVICE_OBJECT DeviceToMount, } else if (DiskGeometry.MediaType == RemovableMedia && PartitionInfo.PartitionNumber > 0 && - PartitionInfo.StartingOffset.QuadPart == 0LL && - PartitionInfo.PartitionLength.QuadPart > 0LL) + PartitionInfo.StartingOffset.QuadPart == 0 && + PartitionInfo.PartitionLength.QuadPart > 0) { /* This is possible a removable media formated as super floppy */ *RecognizedFS = TRUE; @@ -298,7 +298,7 @@ VfatHasFileSystem(PDEVICE_OBJECT DeviceToMount, FatInfo.SectorsPerCluster = BootFatX->SectorsPerCluster; FatInfo.rootDirectorySectors = BootFatX->SectorsPerCluster; FatInfo.BytesPerCluster = BootFatX->SectorsPerCluster * DiskGeometry.BytesPerSector; - FatInfo.Sectors = PartitionInfo.PartitionLength.QuadPart / DiskGeometry.BytesPerSector; + FatInfo.Sectors = (ULONG)(PartitionInfo.PartitionLength.QuadPart / DiskGeometry.BytesPerSector); if (FatInfo.Sectors / FatInfo.SectorsPerCluster < 65525) { DPRINT("FATX16\n"); diff --git a/reactos/drivers/fs/vfat/rw.c b/reactos/drivers/fs/vfat/rw.c index 6851681dbde..01b875bbb6e 100644 --- a/reactos/drivers/fs/vfat/rw.c +++ b/reactos/drivers/fs/vfat/rw.c @@ -12,13 +12,7 @@ /* INCLUDES *****************************************************************/ -#include -#include -#include - #define NDEBUG -#include - #include "vfat.h" /* @@ -728,7 +722,7 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext) { DPRINT("VfatReadFile returned STATUS_VERIFY_REQUIRED\n"); DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread()); - IoSetDeviceToVerify(PsGetCurrentThread(), NULL); + IoSetDeviceToVerify(PsGetCurrentThread(), DeviceToVerify); Status = IoVerifyVolume (DeviceToVerify, FALSE); if (NT_SUCCESS(Status)) diff --git a/reactos/drivers/fs/vfat/vfat.h b/reactos/drivers/fs/vfat/vfat.h index 7f14a207daa..ed42a31e70e 100644 --- a/reactos/drivers/fs/vfat/vfat.h +++ b/reactos/drivers/fs/vfat/vfat.h @@ -28,6 +28,7 @@ typedef struct _ROS_QUERY_LCN_MAPPING { LARGE_INTEGER LcnDiskOffset; } ROS_QUERY #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) #define ROUND_DOWN(N, S) ((N) - ((N) % (S))) +#include struct _BootSector { unsigned char magic0, res0, magic1; @@ -45,7 +46,7 @@ struct _BootSector unsigned char VolumeLabel[11], SysType[8]; unsigned char Res2[448]; unsigned short Signatur1; -} __attribute__((packed)); +}; struct _BootSector32 { @@ -73,7 +74,7 @@ struct _BootSector32 unsigned char VolumeLabel[11], SysType[8]; // 71 unsigned char Res2[420]; // 90 unsigned short Signature1; // 510 -} __attribute__((packed)); +}; struct _BootSectorFatX { @@ -83,7 +84,7 @@ struct _BootSectorFatX unsigned short FATCount; // 12 unsigned long Unknown; // 14 unsigned char Unused[4078]; // 18 -} __attribute__((packed)); +}; struct _FsInfoSector { @@ -94,10 +95,61 @@ struct _FsInfoSector unsigned long NextCluster; // 492 unsigned char Res7[12]; // 496 unsigned long Signatur2; // 508 -} __attribute__((packed)); +}; typedef struct _BootSector BootSector; +struct _FATDirEntry +{ + union + { + struct { unsigned char Filename[8], Ext[3]; }; + unsigned char ShortName[11]; + }; + unsigned char Attrib; + unsigned char lCase; + unsigned char CreationTimeMs; + unsigned short CreationTime,CreationDate,AccessDate; + unsigned short FirstClusterHigh; // higher + unsigned short UpdateTime; //time create/update + unsigned short UpdateDate; //date create/update + unsigned short FirstCluster; + unsigned long FileSize; +}; + +typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY; + +struct _FATXDirEntry +{ + unsigned char FilenameLength; // 0 + unsigned char Attrib; // 1 + unsigned char Filename[42]; // 2 + unsigned long FirstCluster; // 44 + unsigned long FileSize; // 48 + unsigned short UpdateTime; // 52 + unsigned short UpdateDate; // 54 + unsigned short CreationTime; // 56 + unsigned short CreationDate; // 58 + unsigned short AccessTime; // 60 + unsigned short AccessDate; // 62 +}; + +struct _slot +{ + unsigned char id; // sequence number for slot + WCHAR name0_4[5]; // first 5 characters in name + unsigned char attr; // attribute byte + unsigned char reserved; // always 0 + unsigned char alias_checksum; // checksum for 8.3 alias + WCHAR name5_10[6]; // 6 more characters in name + unsigned char start[2]; // starting cluster number + WCHAR name11_12[2]; // last 2 characters in name +}; + +typedef struct _slot slot; + +#include + #define VFAT_CASE_LOWER_BASE 8 // base is lower case #define VFAT_CASE_LOWER_EXT 16 // extension is lower case @@ -120,37 +172,6 @@ typedef struct _BootSector BootSector; #define FAT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof (FAT_DIR_ENTRY)) #define FATX_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof (FATX_DIR_ENTRY)) -struct _FATDirEntry -{ - unsigned char Filename[8], Ext[3]; - unsigned char Attrib; - unsigned char lCase; - unsigned char CreationTimeMs; - unsigned short CreationTime,CreationDate,AccessDate; - unsigned short FirstClusterHigh; // higher - unsigned short UpdateTime; //time create/update - unsigned short UpdateDate; //date create/update - unsigned short FirstCluster; - unsigned long FileSize; -} __attribute__((packed)); - -typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY; - -struct _FATXDirEntry -{ - unsigned char FilenameLength; // 0 - unsigned char Attrib; // 1 - unsigned char Filename[42]; // 2 - unsigned long FirstCluster; // 44 - unsigned long FileSize; // 48 - unsigned short UpdateTime; // 52 - unsigned short UpdateDate; // 54 - unsigned short CreationTime; // 56 - unsigned short CreationDate; // 58 - unsigned short AccessTime; // 60 - unsigned short AccessDate; // 62 -} __attribute__((packed)); - typedef struct _FATXDirEntry FATX_DIR_ENTRY, *PFATX_DIR_ENTRY; union _DIR_ENTRY @@ -161,21 +182,6 @@ union _DIR_ENTRY typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY; -struct _slot -{ - unsigned char id; // sequence number for slot - WCHAR name0_4[5]; // first 5 characters in name - unsigned char attr; // attribute byte - unsigned char reserved; // always 0 - unsigned char alias_checksum; // checksum for 8.3 alias - WCHAR name5_10[6]; // 6 more characters in name - unsigned char start[2]; // starting cluster number - WCHAR name11_12[2]; // last 2 characters in name -} __attribute__((packed)); - - -typedef struct _slot slot; - #define BLOCKSIZE 512 #define FAT16 (1) diff --git a/reactos/drivers/fs/vfat/volume.c b/reactos/drivers/fs/vfat/volume.c index 3ed1ad22c63..5204c3a648d 100644 --- a/reactos/drivers/fs/vfat/volume.c +++ b/reactos/drivers/fs/vfat/volume.c @@ -204,7 +204,7 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject, LabelLen = FsLabelInfo->VolumeLabelLength / sizeof(WCHAR); RtlZeroMemory(&VolumeLabelDirEntry, SizeDirEntry); StringW.Buffer = FsLabelInfo->VolumeLabel; - StringW.Length = StringW.MaximumLength = FsLabelInfo->VolumeLabelLength; + StringW.Length = StringW.MaximumLength = (USHORT)FsLabelInfo->VolumeLabelLength; StringO.Buffer = cString; StringO.Length = 0; StringO.MaximumLength = 42; @@ -288,7 +288,7 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject, } /* Update volume label in memory */ - DeviceObject->Vpb->VolumeLabelLength = FsLabelInfo->VolumeLabelLength; + DeviceObject->Vpb->VolumeLabelLength = (USHORT)FsLabelInfo->VolumeLabelLength; RtlCopyMemory(DeviceObject->Vpb->VolumeLabel, FsLabelInfo->VolumeLabel, DeviceObject->Vpb->VolumeLabelLength); return Status;