Fix various warnings
authorHervé Poussineau <hpoussin@reactos.org>
Thu, 24 Feb 2005 20:47:07 +0000 (20:47 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Thu, 24 Feb 2005 20:47:07 +0000 (20:47 +0000)
svn path=/trunk/; revision=13734

reactos/drivers/fs/vfat/blockdev.c
reactos/drivers/fs/vfat/create.c
reactos/drivers/fs/vfat/dir.c
reactos/drivers/fs/vfat/dirwr.c
reactos/drivers/fs/vfat/fcb.c
reactos/drivers/fs/vfat/fsctl.c
reactos/drivers/fs/vfat/rw.c
reactos/drivers/fs/vfat/vfat.h
reactos/drivers/fs/vfat/volume.c

index a653fe8..f2e92d3 100644 (file)
@@ -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)
 {
index d110015..6ff2825 100644 (file)
@@ -186,7 +186,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt,
  */
 {
   PWCHAR PathNameBuffer;
-  ULONG PathNameBufferLength;
+  USHORT PathNameBufferLength;
   NTSTATUS Status;
   PVOID Context = NULL;
   PVOID Page;
index 064ff79..03237ae 100644 (file)
@@ -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,
index b907f3b..37edd61 100644 (file)
@@ -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;
index ecffdcb..aa44814 100644 (file)
@@ -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;
 }
index 0a797c7..eb22588 100644 (file)
@@ -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");
index 6851681..01b875b 100644 (file)
 
 /* INCLUDES *****************************************************************/
 
-#include <ddk/ntddk.h>
-#include <wchar.h>
-#include <ntos/minmax.h>
-
 #define NDEBUG
-#include <debug.h>
-
 #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))
index 7f14a20..ed42a31 100644 (file)
@@ -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 <pshpack1.h>
 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,35 +95,17 @@ struct _FsInfoSector
   unsigned long  NextCluster;                          // 492
   unsigned char  Res7[12];                             // 496
   unsigned long  Signatur2;                            // 508
-} __attribute__((packed));
+};
 
 typedef struct _BootSector BootSector;
 
-#define VFAT_CASE_LOWER_BASE   8               // base is lower case
-#define VFAT_CASE_LOWER_EXT    16              // extension is lower case
-
-#define LONGNAME_MAX_LENGTH    256             // max length for a long filename
-
-#define ENTRY_DELETED(DeviceExt, DirEntry) ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_DELETED(&((DirEntry)->FatX)) : FAT_ENTRY_DELETED(&((DirEntry)->Fat)))
-#define ENTRY_VOLUME(DeviceExt, DirEntry)  ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_VOLUME(&((DirEntry)->FatX)) : FAT_ENTRY_VOLUME(&((DirEntry)->Fat)))
-#define ENTRY_END(DeviceExt, DirEntry)     ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_END(&((DirEntry)->FatX)) : FAT_ENTRY_END(&((DirEntry)->Fat)))
-
-#define FAT_ENTRY_DELETED(DirEntry)  ((DirEntry)->Filename[0] == 0xe5)
-#define FAT_ENTRY_END(DirEntry)      ((DirEntry)->Filename[0] == 0)
-#define FAT_ENTRY_LONG(DirEntry)     (((DirEntry)->Attrib & 0x3f) == 0x0f)
-#define FAT_ENTRY_VOLUME(DirEntry)   (((DirEntry)->Attrib & 0x1f) == 0x08)
-
-#define FATX_ENTRY_DELETED(DirEntry) ((DirEntry)->FilenameLength == 0xe5)
-#define FATX_ENTRY_END(DirEntry)     ((DirEntry)->FilenameLength == 0xff)
-#define FATX_ENTRY_LONG(DirEntry)    (FALSE)
-#define FATX_ENTRY_VOLUME(DirEntry)  (((DirEntry)->Attrib & 0x1f) == 0x08)
-
-#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];
+  union
+  {
+     struct { unsigned char Filename[8], Ext[3]; };
+     unsigned char ShortName[11];
+  };
   unsigned char  Attrib;
   unsigned char  lCase;
   unsigned char  CreationTimeMs;
@@ -132,7 +115,7 @@ struct _FATDirEntry
   unsigned short UpdateDate;                            //date create/update
   unsigned short FirstCluster;
   unsigned long  FileSize;
-} __attribute__((packed));
+};
 
 typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY;
 
@@ -149,18 +132,8 @@ struct _FATXDirEntry
    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
-{
-   FAT_DIR_ENTRY Fat;
-   FATX_DIR_ENTRY FatX;
 };
 
-typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY;
-
 struct _slot
 {
   unsigned char id;               // sequence number for slot
@@ -171,11 +144,44 @@ struct _slot
   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;
 
+#include <poppack.h>
+
+#define VFAT_CASE_LOWER_BASE   8               // base is lower case
+#define VFAT_CASE_LOWER_EXT    16              // extension is lower case
+
+#define LONGNAME_MAX_LENGTH    256             // max length for a long filename
+
+#define ENTRY_DELETED(DeviceExt, DirEntry) ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_DELETED(&((DirEntry)->FatX)) : FAT_ENTRY_DELETED(&((DirEntry)->Fat)))
+#define ENTRY_VOLUME(DeviceExt, DirEntry)  ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_VOLUME(&((DirEntry)->FatX)) : FAT_ENTRY_VOLUME(&((DirEntry)->Fat)))
+#define ENTRY_END(DeviceExt, DirEntry)     ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_END(&((DirEntry)->FatX)) : FAT_ENTRY_END(&((DirEntry)->Fat)))
+
+#define FAT_ENTRY_DELETED(DirEntry)  ((DirEntry)->Filename[0] == 0xe5)
+#define FAT_ENTRY_END(DirEntry)      ((DirEntry)->Filename[0] == 0)
+#define FAT_ENTRY_LONG(DirEntry)     (((DirEntry)->Attrib & 0x3f) == 0x0f)
+#define FAT_ENTRY_VOLUME(DirEntry)   (((DirEntry)->Attrib & 0x1f) == 0x08)
+
+#define FATX_ENTRY_DELETED(DirEntry) ((DirEntry)->FilenameLength == 0xe5)
+#define FATX_ENTRY_END(DirEntry)     ((DirEntry)->FilenameLength == 0xff)
+#define FATX_ENTRY_LONG(DirEntry)    (FALSE)
+#define FATX_ENTRY_VOLUME(DirEntry)  (((DirEntry)->Attrib & 0x1f) == 0x08)
+
+#define FAT_ENTRIES_PER_PAGE   (PAGE_SIZE / sizeof (FAT_DIR_ENTRY))
+#define FATX_ENTRIES_PER_PAGE  (PAGE_SIZE / sizeof (FATX_DIR_ENTRY))
+
+typedef struct _FATXDirEntry FATX_DIR_ENTRY, *PFATX_DIR_ENTRY;
+
+union _DIR_ENTRY
+{
+   FAT_DIR_ENTRY Fat;
+   FATX_DIR_ENTRY FatX;
+};
+
+typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY;
+
 #define BLOCKSIZE 512
 
 #define FAT16  (1)
index 3ed1ad2..5204c3a 100644 (file)
@@ -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;