[UDFS] Fix all GCC warnings! By V. with one little change by me to keep MSVC build...
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 9 Jun 2015 10:40:26 +0000 (10:40 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 9 Jun 2015 10:40:26 +0000 (10:40 +0000)
svn path=/trunk/; revision=68087

32 files changed:
reactos/drivers/filesystems/udfs/Include/Sys_spec_lib.cpp
reactos/drivers/filesystems/udfs/Include/Sys_spec_lib.h
reactos/drivers/filesystems/udfs/Include/phys_lib.cpp
reactos/drivers/filesystems/udfs/Include/regtools.cpp
reactos/drivers/filesystems/udfs/Include/regtools.h
reactos/drivers/filesystems/udfs/Include/udf_common.h
reactos/drivers/filesystems/udfs/Include/wcache_lib.cpp
reactos/drivers/filesystems/udfs/cleanup.cpp
reactos/drivers/filesystems/udfs/close.cpp
reactos/drivers/filesystems/udfs/devcntrl.cpp
reactos/drivers/filesystems/udfs/dircntrl.cpp
reactos/drivers/filesystems/udfs/env_spec.cpp
reactos/drivers/filesystems/udfs/fastio.cpp
reactos/drivers/filesystems/udfs/fileinfo.cpp
reactos/drivers/filesystems/udfs/flush.cpp
reactos/drivers/filesystems/udfs/fscntrl.cpp
reactos/drivers/filesystems/udfs/lockctrl.cpp
reactos/drivers/filesystems/udfs/misc.cpp
reactos/drivers/filesystems/udfs/pnp.cpp
reactos/drivers/filesystems/udfs/protos.h
reactos/drivers/filesystems/udfs/read.cpp
reactos/drivers/filesystems/udfs/udf_dbg.cpp
reactos/drivers/filesystems/udfs/udf_info/alloc.cpp
reactos/drivers/filesystems/udfs/udf_info/dirtree.cpp
reactos/drivers/filesystems/udfs/udf_info/extent.cpp
reactos/drivers/filesystems/udfs/udf_info/mount.cpp
reactos/drivers/filesystems/udfs/udf_info/phys_eject.cpp
reactos/drivers/filesystems/udfs/udf_info/remap.cpp
reactos/drivers/filesystems/udfs/udf_info/udf_info.cpp
reactos/drivers/filesystems/udfs/udf_info/udf_rel.h
reactos/drivers/filesystems/udfs/udfinit.cpp
reactos/drivers/filesystems/udfs/volinfo.cpp

index a840a44..ed29c07 100644 (file)
@@ -663,7 +663,7 @@ UDFNormalizeFileName(
         if (trailIndex != (newIndex - 1)) {
             newIndex = trailIndex + 1;
             needsCRC = TRUE;
-            hasExt = FALSE; //* Trailing period does not make an extension.
+            hasExt = FALSE; // Trailing period does not make an extension.
         }
     }
 
@@ -671,10 +671,10 @@ UDFNormalizeFileName(
         int localExtIndex = 0;
         if (hasExt) {
             int maxFilenameLen;
-            //* Translate extension, and store it in ext. 
+            // Translate extension, and store it in ext. 
             for(index = 0; index<UDF_EXT_SIZE && extIndex + index +1 < udfLen; index++ ) {
                 current = udfName[extIndex + index + 1];
-                if (UDFIsIllegalChar(current) /*|| !UnicodeIsPrint(current)) {
+                if (UDFIsIllegalChar(current) //|| !UnicodeIsPrint(current)) {
                     needsCRC = TRUE;
                     // Replace Illegal and non-displayable chars
                     // with underscore.
@@ -791,7 +791,7 @@ MyAppendUnicodeStringToString_(
 NTSTATUS
 MyAppendUnicodeToString_(
     IN PUNICODE_STRING Str1,
-    IN PWSTR Str2
+    IN PCWSTR Str2
 #ifdef UDF_TRACK_UNICODE_STR
    ,IN PCHAR Tag
 #endif 
@@ -937,7 +937,7 @@ UDFIsDirInfoCached(
 {
     PDIR_INDEX_HDR hDirNdx = DirInfo->Dloc->DirIndex;
     PDIR_INDEX_ITEM DirNdx;
-    for(uint_di i=2; DirNdx = UDFDirIndex(hDirNdx,i); i++) {
+    for(uint_di i=2; (DirNdx = UDFDirIndex(hDirNdx,i)); i++) {
         if(!(DirNdx->FI_Flags & UDF_FI_FLAG_SYS_ATTR) ||
             (DirNdx->FI_Flags & UDF_FI_FLAG_LINKED)) return FALSE;
     }
@@ -1008,7 +1008,7 @@ UDFDoesOSAllowFileToBeUnlinked__(
 //    UDFFlushAFile(FileInfo->Fcb, NULL, &IoStatus, 0);
     hCurDirNdx = FileInfo->Dloc->DirIndex;
     // check if we can delete all files
-    for(i=2; CurDirNdx = UDFDirIndex(hCurDirNdx,i); i++) {
+    for(i=2; (CurDirNdx = UDFDirIndex(hCurDirNdx,i)); i++) {
         // try to open Stream
         if(CurDirNdx->FileInfo)
             return STATUS_CANNOT_DELETE;
index 4326120..371c320 100644 (file)
@@ -108,7 +108,7 @@ NTSTATUS MyAppendUnicodeStringToString_(IN PUNICODE_STRING Str1,
                                        );
 
 NTSTATUS MyAppendUnicodeToString_(IN PUNICODE_STRING Str1,
-                                  IN PWSTR Str2
+                                  IN PCWSTR Str2
 #ifdef UDF_TRACK_UNICODE_STR
                                  ,IN PCHAR Tag
 #endif 
index 4c123c1..e82c780 100644 (file)
@@ -1291,7 +1291,7 @@ UDFRecoverFromError(
 {
     PGET_LAST_ERROR_USER_OUT Error = NULL;
     LARGE_INTEGER delay;
-    OSSTATUS RC;
+//    OSSTATUS RC;
     uint32 i;
     BOOLEAN UpdateBB = FALSE;
 
@@ -1361,7 +1361,7 @@ UDFRecoverFromError(
             }
             KdPrint(("Error recovery: sync cache\n"));
             // ...flush device cache...
-            RC = UDFSyncCache(Vcb);
+            UDFSyncCache(Vcb);
             // wait again & retry
             delay.QuadPart = -1000000; // 0.1 sec
             KeDelayExecutionThread(KernelMode, FALSE, &delay);
@@ -1396,7 +1396,7 @@ UDFRecoverFromError(
                 KeDelayExecutionThread(KernelMode, FALSE, &delay);
                 KdPrint(("Error recovery: sync cache\n"));
                 // ...flush device cache...
-                RC = UDFSyncCache(Vcb);
+                UDFSyncCache(Vcb);
                 // wait again & retry
                 delay.QuadPart = -1000000; // 0.1 sec
                 KeDelayExecutionThread(KernelMode, FALSE, &delay);
@@ -1519,7 +1519,7 @@ bad_rw_seek_recovery:
                Lba+BCount <= Vcb->LastLBA+1) {
                 KdPrint(("bad Session in streaming mode. Lba %x, try fix-up\n", Lba));
                 // ...flush device cache...
-                RC = UDFSyncCache(Vcb);
+                UDFSyncCache(Vcb);
                 // we should wait
                 delay.QuadPart = -10000000; // 1 sec
                 KeDelayExecutionThread(KernelMode, FALSE, &delay);
@@ -1572,7 +1572,7 @@ bad_rw_seek_recovery:
                Lba+BCount <= Vcb->LastLBA+1) {
                 KdPrint(("bad LBA %x in streaming mode, try fix-up\n", Lba));
                 // ...flush device cache...
-                RC = UDFSyncCache(Vcb);
+                UDFSyncCache(Vcb);
                 try_return(status = STATUS_SUCCESS);
             }
 
@@ -1595,7 +1595,7 @@ try_exit: NOTHING;
 #endif //UDF_DBG
     } _SEH2_END;
     if(!OS_SUCCESS(status)) {
-        if((Vcb->MountPhErrorCount != -1) &&
+        if((Vcb->MountPhErrorCount != (ULONG)-1) &&
            (Vcb->MountPhErrorCount < 0x7fffffff)) {
             Vcb->MountPhErrorCount++;
         }
@@ -1647,7 +1647,7 @@ UDFReadDiscTrackInfo(
     BOOLEAN                     ForceFP = FALSE;
     BOOLEAN                     PacketTrack = FALSE;
     BOOLEAN                     MRWRetry = FALSE;
-    BOOLEAN                     ReadCapacityOk = FALSE;
+//    BOOLEAN                     ReadCapacityOk = FALSE;
 #ifdef UDF_FORMAT_MEDIA
     PUDFFmtState            fms = Vcb->fms;
 #endif
@@ -1697,7 +1697,7 @@ MRWRetry_label:
                 // good value from ReadCapacity
                 KdPrint(("Update Last possible LBA %#x.\n", CapacityBuffer.LogicalBlockAddress));
                 Vcb->LastPossibleLBA = CapacityBuffer.LogicalBlockAddress;
-                ReadCapacityOk = TRUE;
+//                ReadCapacityOk = TRUE;
 #ifdef UDF_FORMAT_MEDIA
                 if(fms && fms->opt_disk_info) {
                     UserPrint(("ReadCapacity OK\n"));
@@ -2392,7 +2392,7 @@ UDFUseStandard(
     PREAD_TOC_USER_OUT      toc = (PREAD_TOC_USER_OUT)MyAllocatePool__(NonPagedPool,max(Vcb->BlockSize, sizeof(READ_TOC_USER_OUT)) );
     PGET_LAST_SESSION_USER_OUT LastSes = (PGET_LAST_SESSION_USER_OUT)MyAllocatePool__(NonPagedPool,sizeof(GET_LAST_SESSION_USER_OUT) );
     uint32                  LocalTrackCount;
-    uint32                  LocalTocLength;
+//    uint32                  LocalTocLength;
     uint32                  TocEntry;
 #ifdef _BROWSE_UDF_
     uint32                  OldTrkNum;
@@ -2479,7 +2479,7 @@ UDFUseStandard(
 #endif //_CONSOLE
     
         LocalTrackCount = toc->Tracks.Last_TrackSes - toc->Tracks.First_TrackSes + 1;
-        LocalTocLength = PtrOffset( toc, &(toc->TrackData[LocalTrackCount + 1]) );
+//        LocalTocLength = PtrOffset( toc, &(toc->TrackData[LocalTrackCount + 1]) );  /* FIXME ReactOS Assume PtrOffset is not changing it's arguments? */
       
         // Get out if there is an immediate problem with the TOC.
         if(toc->Tracks.First_TrackSes > toc->Tracks.Last_TrackSes) {
@@ -2720,7 +2720,7 @@ UDFGetBlockSize(
                 TRUE,NULL );
             if(!NT_SUCCESS(RC)) {
                 KdPrint(("UDFGetBlockSize: IOCTL_DISK_GET_PARTITION_INFO failed\n"));
-                if(RC = STATUS_INVALID_DEVICE_REQUEST)
+                if(RC == STATUS_INVALID_DEVICE_REQUEST) /* ReactOS Code Change (was =) */
                     RC = STATUS_UNRECOGNIZED_VOLUME;
                 try_return(RC);
             }
@@ -3704,7 +3704,7 @@ UDFPrepareForReadOperation(
        !(Vcb->VCBFlags & UDF_VCB_FLAGS_NO_SYNC_CACHE) &&
        !(Vcb->CompatFlags & UDF_VCB_IC_NO_SYNCCACHE_AFTER_WRITE)){
 
-        OSSTATUS RC;
+//        OSSTATUS RC;
 
         RC = UDFSyncCache(Vcb);
     }
@@ -3715,8 +3715,8 @@ UDFPrepareForReadOperation(
 #endif //UDF_FORMAT_MEDIA
         TRUE)
     {
-        OSSTATUS RC;
-        RC = UDFSyncCache(Vcb);
+//        OSSTATUS RC;
+        UDFSyncCache(Vcb);
     }
 
 #ifdef _BROWSE_UDF_
@@ -3969,7 +3969,7 @@ UDFReadData(
         return STATUS_NO_SUCH_DEVICE;
     // read tail of the 1st sector if Offset is not sector_size-aligned
     Lba = (uint32)(Offset >> BSh);
-    if(i = (uint32)(Offset & (BS-1))) {
+    if((i = (uint32)(Offset & (BS-1)))) {
         l = (BS - i) < Length ?
             (BS - i) : Length;
         // here we use 'ReadBytes' 'cause now it's set to zero
@@ -4161,7 +4161,7 @@ UDFWriteData(
         return STATUS_NO_SUCH_DEVICE;
     // write tail of the 1st sector if Offset is not sector_size-aligned
     Lba = (uint32)(Offset >> BSh);
-    if(i = ((uint32)Offset & (BS-1))) {
+    if((i = ((uint32)Offset & (BS-1)))) {
         l = (BS - i) < Length ?
             (BS - i) : Length;
         status = UDFWriteInSector(Vcb, Translate, Lba, i, l, Direct, Buffer, WrittenBytes);
@@ -4276,7 +4276,11 @@ UDFSetCaching(
         MODE_READ_WRITE_RECOVERY_PAGE Data;
         CHAR Padding [16];
     } RecoveryPage;
+#ifdef _MSC_VER
 #pragma pack(pop,1)
+#else
+#pragma pack(pop)
+#endif
 
     MODE_SENSE_USER_IN ModeSenseCtl;
     OSSTATUS RC;
index 607e5fc..1b77b59 100644 (file)
@@ -11,7 +11,7 @@
 NTSTATUS
 RegTGetKeyHandle(
     IN HKEY hRootKey,
-    IN PWCHAR KeyName,
+    IN PCWSTR KeyName,
     OUT HKEY* hKey
     )
 {
@@ -21,9 +21,7 @@ RegTGetKeyHandle(
 
     //KdPrint(("RegTGetKeyHandle: h=%x, %S\n", hRootKey, KeyName));
 
-    NameString.Buffer = KeyName;
-    NameString.Length = wcslen(KeyName)*sizeof(WCHAR);
-    NameString.MaximumLength = NameString.Length + sizeof(WCHAR);
+    RtlInitUnicodeString(&NameString, KeyName);
 
     InitializeObjectAttributes(
         &ObjectAttributes,
@@ -100,8 +98,8 @@ RegTCloseKeyHandle(
 BOOLEAN
 RegTGetDwordValue(
     IN HKEY hRootKey,
-    IN PWSTR RegistryPath,
-    IN PWSTR Name,
+    IN PCWSTR RegistryPath,
+    IN PCWSTR Name,
     IN PULONG pUlong
     )
 {
@@ -150,9 +148,7 @@ RegTGetDwordValue(
         return FALSE;
     }
 
-    NameString.Buffer = Name;
-    NameString.Length = wcslen(Name)*sizeof(WCHAR);
-    NameString.MaximumLength = NameString.Length + sizeof(WCHAR);
+    RtlInitUnicodeString(&NameString, Name);
 
     status = ZwQueryValueKey(hKey,
                              &NameString,
@@ -192,8 +188,8 @@ RegTGetDwordValue(
 BOOLEAN
 RegTGetStringValue(
     IN HKEY hRootKey,
-    IN PWSTR RegistryPath,
-    IN PWSTR Name,
+    IN PCWSTR RegistryPath,
+    IN PCWSTR Name,
     IN PWCHAR pStr,
     IN ULONG MaxLen
     )
@@ -240,9 +236,7 @@ RegTGetStringValue(
         return FALSE;
     }
 
-    NameString.Buffer = Name;
-    NameString.Length = wcslen(Name)*sizeof(WCHAR);
-    NameString.MaximumLength = NameString.Length + sizeof(WCHAR);
+    RtlInitUnicodeString(&NameString, Name);
 
     status = ZwQueryValueKey(hKey,
                              &NameString,
index 38f5b5c..00d41d3 100644 (file)
@@ -16,7 +16,7 @@
 NTSTATUS
 RegTGetKeyHandle(
     IN HKEY hRootKey,
-    IN PWCHAR KeyName,
+    IN PCWSTR KeyName,
     OUT HKEY* hKey
     );
 
@@ -28,16 +28,16 @@ RegTCloseKeyHandle(
 BOOLEAN
 RegTGetDwordValue(
     IN HKEY hRootKey,
-    IN PWSTR RegistryPath,
-    IN PWSTR Name,
+    IN PCWSTR RegistryPath,
+    IN PCWSTR Name,
     IN PULONG pUlong
     );
 
 BOOLEAN
 RegTGetStringValue(
     IN HKEY hRootKey,
-    IN PWSTR RegistryPath,
-    IN PWSTR Name,
+    IN PCWSTR RegistryPath,
+    IN PCWSTR Name,
     IN PWCHAR pStr,
     IN ULONG MaxLen
     );
index d8f26ff..c0efbd9 100644 (file)
@@ -27,7 +27,7 @@ typedef struct _UDF_KEY_LIST {
 struct UDF_MEDIA_CLASS_NAMES
 {
     UDFFSD_MEDIA_TYPE MediaClass;
-    PWCHAR ClassName;
+    PCWSTR ClassName;
 };
 
 extern struct UDF_MEDIA_CLASS_NAMES UDFMediaClassName[];
@@ -114,7 +114,7 @@ typedef struct _UDFVolumeControlBlock {
     // device object when requesting a mount operation.
     PDEVICE_OBJECT                      TargetDeviceObject;
     UNICODE_STRING                      TargetDevName;
-    PWSTR                               DefaultRegName;
+    PCWSTR                               DefaultRegName;
     // the volume structure contains a pointer to the root directory FCB
     PtrUDFFCB                           RootDirFCB;
     // the complete name of the user visible drive letter we serve
index 05ff198..ec5011f 100644 (file)
@@ -439,8 +439,10 @@ WCacheFindFrameToRelease(
   Internal routine
  */
 
+#ifdef _MSC_VER
 #pragma warning(push)               
 #pragma warning(disable:4035)               // re-enable below
+#endif
 
 ULONG
 //__fastcall
@@ -566,7 +568,9 @@ EO_while_2:
 
 }
 
+#ifdef _MSC_VER
 #pragma warning(pop) // re-enable warning #4035
+#endif
 
 /*
   WCacheInsertRangeToList() inserts values laying in range described
@@ -823,7 +827,7 @@ WCacheRemoveFrame(
   Internal routine
  */
 #define WCacheGetModFlag(block_array, i) \
-    (((UCHAR)(block_array[i].Sector)) & WCACHE_FLAG_MODIFIED)
+    (*((PULONG)&(block_array[i].Sector)) & WCACHE_FLAG_MODIFIED)
 
 #if 0
 /*
@@ -1643,9 +1647,9 @@ WCacheCheckLimitsRAM(
 //    ULONG BS = Cache->BlockSize;
 //    ULONG PS = BS << Cache->PacketSizeSh; // packet size (bytes)
     ULONG PSs = Cache->PacketSize;
-    ULONG try_count = 0;
+//    ULONG try_count = 0;
     PW_CACHE_ENTRY block_array;
-    OSSTATUS status;
+//    OSSTATUS status;
     ULONG FreeFrameCount = 0;
 //    PVOID addr;
 
@@ -1679,11 +1683,13 @@ Try_Another_Frame:
             try_count = 0;
         }
 #else
+/*
         if(Cache->FrameList[frame].UpdateCount) {
             try_count = MAX_TRIES_FOR_NA;
         } else {
             try_count = 0;
         }
+*/
 #endif
 
         if(FreeFrameCount)
@@ -1700,7 +1706,7 @@ Try_Another_Frame:
             BrutePoint();
             return STATUS_DRIVER_INTERNAL_ERROR;
         }
-        status = WCacheFlushBlocksRAM(Cache, Context, block_array, List, firstPos, lastPos, TRUE);
+        WCacheFlushBlocksRAM(Cache, Context, block_array, List, firstPos, lastPos, TRUE);
 
         WCacheRemoveRangeFromList(List, &(Cache->BlockCount), firstLba, Cache->BlocksPerFrame);
         WCacheRemoveRangeFromList(Cache->CachedModifiedBlocksList, &(Cache->WriteCount), firstLba, Cache->BlocksPerFrame);
@@ -1715,7 +1721,7 @@ Try_Another_Frame:
     // remove(flush) packet
     while((Cache->BlockCount + WCacheGetSortedListIndex(Cache->BlockCount, List, ReqLba) +
            BCount - WCacheGetSortedListIndex(Cache->BlockCount, List, ReqLba+BCount)) > Cache->MaxBlocks) {
-        try_count = 0;
+//        try_count = 0;
 //Try_Another_Block:
 
         ASSERT(Cache->FrameCount <= Cache->MaxFrames);
@@ -1734,7 +1740,7 @@ Try_Another_Frame:
             ASSERT(FALSE);
             return STATUS_DRIVER_INTERNAL_ERROR;
         }
-        status = WCacheFlushBlocksRAM(Cache, Context, block_array, List, firstPos, lastPos, TRUE);
+        WCacheFlushBlocksRAM(Cache, Context, block_array, List, firstPos, lastPos, TRUE);
         WCacheRemoveRangeFromList(List, &(Cache->BlockCount), Lba, PSs);
         WCacheRemoveRangeFromList(Cache->CachedModifiedBlocksList, &(Cache->WriteCount), Lba, PSs);
         // check if frame is empty
@@ -1765,7 +1771,7 @@ WCachePurgeAllRAM(
     ULONG firstPos;
     ULONG lastPos;
     PW_CACHE_ENTRY block_array;
-    OSSTATUS status;
+//    OSSTATUS status;
 
     // remove(flush) some frames
     while(Cache->FrameCount) {
@@ -1783,7 +1789,7 @@ WCachePurgeAllRAM(
             BrutePoint();
             return STATUS_DRIVER_INTERNAL_ERROR;
         }
-        status = WCacheFlushBlocksRAM(Cache, Context, block_array, List, firstPos, lastPos, TRUE);
+        WCacheFlushBlocksRAM(Cache, Context, block_array, List, firstPos, lastPos, TRUE);
 
         WCacheRemoveRangeFromList(List, &(Cache->BlockCount), firstLba, Cache->BlocksPerFrame);
         WCacheRemoveRangeFromList(Cache->CachedModifiedBlocksList, &(Cache->WriteCount), firstLba, Cache->BlocksPerFrame);
@@ -1813,7 +1819,7 @@ WCacheFlushAllRAM(
     ULONG firstPos;
     ULONG lastPos;
     PW_CACHE_ENTRY block_array;
-    OSSTATUS status;
+//    OSSTATUS status;
 
     // flush frames
     while(Cache->WriteCount) {
@@ -1831,7 +1837,7 @@ WCacheFlushAllRAM(
             BrutePoint();
             return STATUS_DRIVER_INTERNAL_ERROR;
         }
-        status = WCacheFlushBlocksRAM(Cache, Context, block_array, List, firstPos, lastPos, FALSE);
+        WCacheFlushBlocksRAM(Cache, Context, block_array, List, firstPos, lastPos, FALSE);
 
         WCacheRemoveRangeFromList(Cache->CachedModifiedBlocksList, &(Cache->WriteCount), firstLba, Cache->BlocksPerFrame);
     }
@@ -2621,14 +2627,14 @@ WCachePurgeAllRW(
     lba_t firstLba;
     lba_t* List = Cache->CachedBlocksList;
     lba_t Lba;
-    ULONG firstPos;
-    ULONG lastPos;
+//    ULONG firstPos;
+//    ULONG lastPos;
     ULONG BSh = Cache->BlockSizeSh;
     ULONG BS = Cache->BlockSize;
     ULONG PS = BS << Cache->PacketSizeSh; // packet size (bytes)
     ULONG PSs = Cache->PacketSize;
     PW_CACHE_ENTRY block_array;
-    OSSTATUS status;
+//    OSSTATUS status;
     ULONG ReadBytes;
     PW_CACHE_ASYNC FirstWContext = NULL;
     PW_CACHE_ASYNC PrevWContext = NULL;
@@ -2640,15 +2646,15 @@ WCachePurgeAllRW(
         Lba = List[0] & ~(PSs-1);
         frame = Lba >> Cache->BlocksPerFrameSh;
         firstLba = frame << Cache->BlocksPerFrameSh;
-        firstPos = WCacheGetSortedListIndex(Cache->BlockCount, List, Lba);
-        lastPos = WCacheGetSortedListIndex(Cache->BlockCount, List, Lba+PSs);
+//        firstPos = WCacheGetSortedListIndex(Cache->BlockCount, List, Lba);
+//        lastPos = WCacheGetSortedListIndex(Cache->BlockCount, List, Lba+PSs);
         block_array = Cache->FrameList[frame].Frame;
         if(!block_array) {
             BrutePoint();   
             return;
         }
 
-        status = WCacheUpdatePacket(Cache, Context, &FirstWContext, &PrevWContext, block_array, firstLba,
+        WCacheUpdatePacket(Cache, Context, &FirstWContext, &PrevWContext, block_array, firstLba,
             Lba, BSh, BS, PS, PSs, &ReadBytes, TRUE, ASYNC_STATE_NONE);
 
         // free memory
@@ -2688,15 +2694,15 @@ WCacheFlushAllRW(
     lba_t firstLba;
     lba_t* List = Cache->CachedModifiedBlocksList;
     lba_t Lba;
-    ULONG firstPos;
-    ULONG lastPos;
+//    ULONG firstPos;
+//    ULONG lastPos;
     ULONG BSh = Cache->BlockSizeSh;
     ULONG BS = Cache->BlockSize;
     ULONG PS = BS << Cache->PacketSizeSh; // packet size (bytes)
     ULONG PSs = Cache->PacketSize;
     ULONG BFs = Cache->BlocksPerFrameSh;
     PW_CACHE_ENTRY block_array;
-    OSSTATUS status;
+//    OSSTATUS status;
     ULONG ReadBytes;
     PW_CACHE_ASYNC FirstWContext = NULL;
     PW_CACHE_ASYNC PrevWContext = NULL;
@@ -2710,15 +2716,15 @@ WCacheFlushAllRW(
         Lba = List[0] & ~(PSs-1);
         frame = Lba >> BFs;
         firstLba = frame << BFs;
-        firstPos = WCacheGetSortedListIndex(Cache->WriteCount, List, Lba);
-        lastPos = WCacheGetSortedListIndex(Cache->WriteCount, List, Lba+PSs);
+//        firstPos = WCacheGetSortedListIndex(Cache->WriteCount, List, Lba);
+//        lastPos = WCacheGetSortedListIndex(Cache->WriteCount, List, Lba+PSs);
         block_array = Cache->FrameList[frame].Frame;
         if(!block_array) {
             BrutePoint();   
             continue;;
         }
         // queue modify request
-        status = WCacheUpdatePacket(Cache, Context, &FirstWContext, &PrevWContext, block_array, firstLba,
+        WCacheUpdatePacket(Cache, Context, &FirstWContext, &PrevWContext, block_array, firstLba,
             Lba, BSh, BS, PS, PSs, &ReadBytes, TRUE, ASYNC_STATE_NONE);
         // clear MODIFIED flag for queued blocks
         WCacheRemoveRangeFromList(List, &(Cache->WriteCount), Lba, PSs);
@@ -2827,15 +2833,15 @@ WCacheFlushBlocksRW(
     lba_t firstLba;
     lba_t* List = Cache->CachedModifiedBlocksList;
     lba_t Lba;
-    ULONG firstPos;
-    ULONG lastPos;
+//    ULONG firstPos;
+//    ULONG lastPos;
     ULONG BSh = Cache->BlockSizeSh;
     ULONG BS = Cache->BlockSize;
     ULONG PS = BS << Cache->PacketSizeSh; // packet size (bytes)
     ULONG PSs = Cache->PacketSize;
     ULONG BFs = Cache->BlocksPerFrameSh;
     PW_CACHE_ENTRY block_array;
-    OSSTATUS status;
+//    OSSTATUS status;
     ULONG ReadBytes;
     PW_CACHE_ASYNC FirstWContext = NULL;
     PW_CACHE_ASYNC PrevWContext = NULL;
@@ -2850,8 +2856,8 @@ WCacheFlushBlocksRW(
     for(Lba = _Lba & ~(PSs-1);Lba < lim ; Lba += PSs) {
         frame = Lba >> BFs;
         firstLba = frame << BFs;
-        firstPos = WCacheGetSortedListIndex(Cache->WriteCount, List, Lba);
-        lastPos = WCacheGetSortedListIndex(Cache->WriteCount, List, Lba+PSs);
+//        firstPos = WCacheGetSortedListIndex(Cache->WriteCount, List, Lba);
+//        lastPos = WCacheGetSortedListIndex(Cache->WriteCount, List, Lba+PSs);
         block_array = Cache->FrameList[frame].Frame;
         if(!block_array) {
             // not cached block may be requested for flush
@@ -2859,7 +2865,7 @@ WCacheFlushBlocksRW(
             continue;
         }
         // queue modify request
-        status = WCacheUpdatePacket(Cache, Context, &FirstWContext, &PrevWContext, block_array, firstLba,
+        WCacheUpdatePacket(Cache, Context, &FirstWContext, &PrevWContext, block_array, firstLba,
             Lba, BSh, BS, PS, PSs, &ReadBytes, TRUE, ASYNC_STATE_NONE);
         // clear MODIFIED flag for queued blocks
         WCacheRemoveRangeFromList(List, &(Cache->WriteCount), Lba, PSs);
index ae88596..4c1b751 100644 (file)
@@ -549,7 +549,7 @@ DiscardDelete:
         if(!(Vcb->VCBFlags & UDF_VCB_FLAGS_VOLUME_READ_ONLY) &&
            !(Fcb->FCBFlags & (UDF_FCB_DELETE_ON_CLOSE |
                               UDF_FCB_DELETED /*|
-                              UDF_FCB_DIRECTORY /*|
+                              UDF_FCB_DIRECTORY |
                               UDF_FCB_READ_ONLY*/)) &&
            !UDFIsAStreamDir(NextFileInfo)) {
             LONGLONG NtTime;
@@ -719,7 +719,7 @@ UDFCloseFileInfoChain(
         ValidateFileInfo(fi);
 
         // acquire parent
-        if(ParentFI = fi->ParentFile) {
+        if((ParentFI = fi->ParentFile)) {
             ParentFcb = fi->Fcb->ParentFcb;
             ASSERT(ParentFcb);
             ASSERT(ParentFcb->NTRequiredFCB);
@@ -734,7 +734,7 @@ UDFCloseFileInfoChain(
         }
         // acquire current file/dir
         // we must assure that no more threads try to reuse this object
-        if(Fcb = fi->Fcb) {
+        if((Fcb = fi->Fcb)) {
             UDF_CHECK_PAGING_IO_RESOURCE(Fcb->NTRequiredFCB);
             UDFAcquireResourceExclusive(&(Fcb->NTRequiredFCB->MainResource),TRUE);
             ASSERT_REF(Fcb->ReferenceCount >= fi->RefCount);
index 84e52fd..24db44b 100644 (file)
@@ -150,7 +150,7 @@ UDFCommonClose(
     BOOLEAN                 AcquiredGD = FALSE;
     PUDF_FILE_INFO          fi;
     ULONG                   i = 0;
-    ULONG                   clean_stat = 0;
+//    ULONG                   clean_stat = 0;
 
 //    BOOLEAN                 CompleteIrp = TRUE;
     BOOLEAN                 PostRequest = FALSE;
@@ -337,7 +337,7 @@ UDFCommonClose(
         AdPrint(("UDF: ReferenceCount:  %x\n",Fcb->ReferenceCount));
 #endif // UDF_DBG
         // try to clean up as long chain as it is possible
-        clean_stat = UDFCleanUpFcbChain(Vcb, fi, i, TRUE);
+        UDFCleanUpFcbChain(Vcb, fi, i, TRUE);
 
 try_exit: NOTHING;
 
@@ -426,7 +426,7 @@ UDFCleanUpFcbChain(
     while(fi) {
 
         // acquire parent
-        if(ParentFI = fi->ParentFile) {
+        if((ParentFI = fi->ParentFile)) {
             ASSERT(fi->Fcb);
             ParentFcb = fi->Fcb->ParentFcb;
             ASSERT(ParentFcb);
@@ -545,7 +545,7 @@ UDFCleanUpFcbChain(
                 fi->Dloc->CommonFcb = NULL;
             }
 
-            if(CleanCode = UDFCleanUpFile__(Vcb, fi)) {
+            if((CleanCode = UDFCleanUpFile__(Vcb, fi))) {
                 // Check, if we can uninitialize & deallocate CommonFcb part
                 // kill some cross links
                 Fcb->FileInfo = NULL;
@@ -865,12 +865,12 @@ UDFBuildTreeItemsList(
     }
 
     // walk through SDir (if any)
-    if(SDirInfo = FileInfo->Dloc->SDirInfo)
+    if((SDirInfo = FileInfo->Dloc->SDirInfo))
         UDFBuildTreeItemsList(Vcb, SDirInfo, CheckItemProc,
                  PassedList, PassedListSize, FoundList, FoundListSize);
 
     // walk through subsequent objects (if any)
-    if(hDirNdx = FileInfo->Dloc->DirIndex) {
+    if((hDirNdx = FileInfo->Dloc->DirIndex)) {
 
         // scan DirIndex
         UDF_DIR_SCAN_CONTEXT ScanContext;
@@ -878,7 +878,7 @@ UDFBuildTreeItemsList(
         PUDF_FILE_INFO CurFileInfo;
 
         if(UDFDirIndexInitScan(FileInfo, &ScanContext, 2)) {
-            while(DirNdx = UDFDirIndexScan(&ScanContext, &CurFileInfo)) {
+            while((DirNdx = UDFDirIndexScan(&ScanContext, &CurFileInfo))) {
                 if(!CurFileInfo)
                     continue;
                 UDFBuildTreeItemsList(Vcb, CurFileInfo, CheckItemProc,
index c7beb58..5b6a7d1 100644 (file)
@@ -884,7 +884,7 @@ notify_media_change:
             //  Copy the data from the Vcb.
             ((PCDROM_DISK_DATA_USER_OUT)(Irp->AssociatedIrp.SystemBuffer))->DiskData = CDROM_DISK_DATA_TRACK;
             for(TrackNumber=Vcb->FirstTrackNum; TrackNumber<Vcb->LastTrackNum; TrackNumber++) {
-                if(Vcb->TrackMap[TrackNumber].TrackParam & Trk_QSubChan_Type_Mask ==
+                if((Vcb->TrackMap[TrackNumber].TrackParam & Trk_QSubChan_Type_Mask) ==
                     Trk_QSubChan_Type_Audio) {
                     ((PCDROM_DISK_DATA_USER_OUT)(Irp->AssociatedIrp.SystemBuffer))->DiskData |= CDROM_DISK_AUDIO_TRACK;
                     break;
@@ -1137,7 +1137,7 @@ UDFGetFileAllocModeFromICB(
     PEXTENDED_IO_STACK_LOCATION IrpSp =
         (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation( Irp );
 
-    PVCB Vcb;
+//    PVCB Vcb;
     PtrUDFFCB Fcb;
     PtrUDFCCB Ccb;
     PUDF_GET_FILE_ALLOCATION_MODE_OUT OutputBuffer;
@@ -1148,7 +1148,7 @@ UDFGetFileAllocModeFromICB(
     // user volume opens.
     Ccb = (PtrUDFCCB)(IrpSp->FileObject->FsContext2);
     Fcb = Ccb->Fcb;
-    Vcb = Fcb->Vcb;
+//    Vcb = Fcb->Vcb;
 
     Irp->IoStatus.Information = 0;
     if(IrpSp->Parameters.FileSystemControl.OutputBufferLength < sizeof(UDF_GET_FILE_ALLOCATION_MODE_OUT))
index 40d918a..60f9215 100644 (file)
@@ -545,6 +545,9 @@ UDFQueryDirectory(
                 NamesInfo->FileIndex = NextMatch;
                 NamesInfo->FileNameLength = FileNameBytes;
                 break;
+
+            default:
+                break;
             }
             if (FileNameBytes) {
                 //  This is a Unicode name, we can copy the bytes directly.
@@ -634,7 +637,7 @@ UDFFindNextMatch(
 #define IgnoreCase    (FNM_Flags & UDF_FNM_FLAG_IGNORE_CASE)
 #define ContainsWC    (FNM_Flags & UDF_FNM_FLAG_CONTAINS_WC)
 
-    for(;DirNdx = UDFDirIndex(hDirIndex, EntryNumber);EntryNumber++) {
+    for(;(DirNdx = UDFDirIndex(hDirIndex, EntryNumber));EntryNumber++) {
         if(!DirNdx->FName.Buffer ||
            UDFIsDeleted(DirNdx))
             continue;
index c87ad38..5ea45ce 100644 (file)
@@ -316,10 +316,14 @@ UDFPhWriteSynchronous(
 
 #ifdef DBG
     if(UDF_SIMULATE_WRITES) {
+/* FIXME ReactOS
+   If this function is to force a read from the bufffer to simulate any segfaults, then it makes sense.
+   Else, this forloop is useless.
         UCHAR a;
         for(ULONG i=0; i<Length; i++) {
             a = ((PUCHAR)Buffer)[i];
         }
+*/
         *WrittenBytes = Length;
         return STATUS_SUCCESS;
     }
@@ -621,7 +625,8 @@ UDFNotifyVolumeEvent(
     IN ULONG EventCode
     )
 {
-    if(!FsRtlNotifyVolumeEvent)
+/* ReactOS FIXME This is always true, and we return anyway. */
+//    if(!FsRtlNotifyVolumeEvent)
         return;
     //FsRtlNotifyVolumeEvent(FileObject, EventCode);
 } // end UDFNotifyVolumeEvent()
index eb0a5c5..0fae689 100644 (file)
@@ -260,7 +260,7 @@ UDFFastIoQueryStdInfo(
     LONG             Length = sizeof(FILE_STANDARD_INFORMATION);
     PtrUDFFCB        Fcb;
     PtrUDFCCB        Ccb;
-    PtrUDFNTRequiredFCB NtReqFcb = NULL;
+//    PtrUDFNTRequiredFCB NtReqFcb = NULL;
 //    BOOLEAN          MainResourceAcquired = FALSE;
 
     FsRtlEnterFileSystem();
@@ -277,7 +277,7 @@ UDFFastIoQueryStdInfo(
             ASSERT(Ccb);
             Fcb = Ccb->Fcb;
             ASSERT(Fcb);
-            NtReqFcb = Fcb->NTRequiredFCB;
+//            NtReqFcb = Fcb->NTRequiredFCB;
             //Fcb->Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
 
 /*                
index ca8d7e2..f364dd3 100644 (file)
@@ -544,7 +544,7 @@ UDFGetBasicInformation(
 
     _SEH2_TRY {
 
-        if(*PtrReturnedLength < sizeof(FILE_BASIC_INFORMATION)) {
+        if(*PtrReturnedLength < (LONG)sizeof(FILE_BASIC_INFORMATION)) {
             try_return(RC = STATUS_BUFFER_OVERFLOW);
         }
 
@@ -619,13 +619,13 @@ UDFGetStandardInformation(
 {
     NTSTATUS            RC = STATUS_SUCCESS;
     PUDF_FILE_INFO      FileInfo;
-    PVCB Vcb;
+//    PVCB Vcb;
 
     AdPrint(("UDFGetStandardInformation: \n"));
 
     _SEH2_TRY {
 
-        if(*PtrReturnedLength < sizeof(FILE_STANDARD_INFORMATION)) {
+        if(*PtrReturnedLength < (LONG)sizeof(FILE_STANDARD_INFORMATION)) {
             try_return(RC = STATUS_BUFFER_OVERFLOW);
         }
 
@@ -639,7 +639,7 @@ UDFGetStandardInformation(
             AdPrint(("!!!! GetStandardInfo to unopened file !!!!\n"));
             try_return(RC = STATUS_INVALID_PARAMETER);
         }
-        Vcb = Fcb->Vcb;
+//        Vcb = Fcb->Vcb;
         PtrBuffer->NumberOfLinks = UDFGetFileLinkCount(FileInfo);
         PtrBuffer->DeletePending = (Fcb->FCBFlags & UDF_FCB_DELETE_ON_CLOSE) ? TRUE : FALSE;
 
@@ -686,7 +686,7 @@ UDFGetNetworkInformation(
 
     _SEH2_TRY {
 
-        if(*PtrReturnedLength < sizeof(FILE_NETWORK_OPEN_INFORMATION)) {
+        if(*PtrReturnedLength < (LONG)sizeof(FILE_NETWORK_OPEN_INFORMATION)) {
             try_return(RC = STATUS_BUFFER_OVERFLOW);
         }
 
@@ -752,7 +752,7 @@ UDFGetInternalInformation(
 
     _SEH2_TRY {
 
-        if(*PtrReturnedLength < sizeof(FILE_INTERNAL_INFORMATION)) {
+        if(*PtrReturnedLength < (LONG)sizeof(FILE_INTERNAL_INFORMATION)) {
             try_return(RC = STATUS_BUFFER_OVERFLOW);
         }
 
@@ -803,7 +803,7 @@ UDFGetEaInformation(
 
     _SEH2_TRY {
 
-        if(*PtrReturnedLength < sizeof(FILE_EA_INFORMATION)) {
+        if(*PtrReturnedLength < (LONG)sizeof(FILE_EA_INFORMATION)) {
             try_return(RC = STATUS_BUFFER_OVERFLOW);
         }
 
@@ -903,7 +903,7 @@ UDFGetPositionInformation(
  IN OUT PLONG                     PtrReturnedLength
     )
 {
-    if(*PtrReturnedLength < sizeof(FILE_POSITION_INFORMATION)) {
+    if(*PtrReturnedLength < (LONG)sizeof(FILE_POSITION_INFORMATION)) {
         return(STATUS_BUFFER_OVERFLOW);
     }
     PtrBuffer->CurrentByteOffset = FileObject->CurrentByteOffset;
@@ -960,7 +960,7 @@ UDFGetFileStreamInformation(
         NTFileInfo = (PFILE_BOTH_DIR_INFORMATION)MyAllocatePool__(NonPagedPool, sizeof(FILE_BOTH_DIR_INFORMATION)+UDF_NAME_LEN*sizeof(WCHAR));
         if(!NTFileInfo) try_return(RC = STATUS_INSUFFICIENT_RESOURCES);
 
-        for(i=2; SDirIndex = UDFDirIndex(hSDirIndex,i); i++) {
+        for(i=2; (SDirIndex = UDFDirIndex(hSDirIndex,i)); i++) {
             if((SDirIndex->FI_Flags & UDF_FI_FLAG_FI_INTERNAL) ||
                 UDFIsDeleted(SDirIndex) ||
                 !SDirIndex->FName.Buffer )
@@ -1176,7 +1176,7 @@ UDFMarkStreamsForDeletion(
                 UDFDirIndexInitScan(SDirInfo, &ScanContext, 2)) {
 
                 // Check if we can delete Streams 
-                while(DirNdx = UDFDirIndexScan(&ScanContext, &FileInfo)) {
+                while((DirNdx = UDFDirIndexScan(&ScanContext, &FileInfo))) {
                     if(!FileInfo)
                         continue;
                     if(FileInfo->Fcb) {
@@ -1631,7 +1631,7 @@ UDFSetEOF(
     PDIR_INDEX_ITEM DirNdx;
     PtrUDFNTRequiredFCB NtReqFcb = NULL;
     LONGLONG        OldFileSize;
-    BOOLEAN         ZeroBlock;
+//    BOOLEAN         ZeroBlock;
     BOOLEAN         CacheMapInitialized = FALSE;
     BOOLEAN         AcquiredPagingIo = FALSE;
 
@@ -1712,8 +1712,10 @@ UDFSetEOF(
 
             // Yes. Do the FSD specific stuff i.e. increase reserved
             // space on disk.
+/*
             if (FileObject->PrivateCacheMap)
                 ZeroBlock = TRUE;
+*/
 
             // reference file to pretend that it is opened
             UDFReferenceFile__(Fcb->FileInfo);
@@ -1828,7 +1830,7 @@ UDFSetEOF(
                 UDFZeroDataEx(NtReqFcb,
                               OldFileSize,
                               PtrBuffer->EndOfFile.QuadPart - OldFileSize,
-                              TRUE/*CanWait, Vcb, FileObject);
+                              TRUE // CanWait, Vcb, FileObject);
             }*/
             Fcb->NTRequiredFCB->NtReqFCBFlags |= UDF_NTREQ_FCB_MODIFIED;
 
index 75d5d2f..9fd044f 100644 (file)
@@ -293,7 +293,7 @@ UDFFlushAFile(
     )
 {
     BOOLEAN SetArchive = FALSE;
-    BOOLEAN PurgeCache = FALSE;
+//    BOOLEAN PurgeCache = FALSE;
     ULONG ret_val = 0;
 
     KdPrint(("UDFFlushAFile: \n"));
@@ -339,7 +339,7 @@ UDFFlushAFile(
             // notice, that we should purge cache
             // we can't do it now, because it may cause last Close
             // request & thus, structure deallocation
-            PurgeCache = TRUE;
+//            PurgeCache = TRUE;
 
 #ifndef UDF_READ_ONLY_BUILD
             if(Ccb) {
@@ -420,7 +420,7 @@ UDFFlushADirectory(
     )
 {
     KdPrint(("UDFFlushADirectory: \n"));
-    PDIR_INDEX_HDR hDI;
+//    PDIR_INDEX_HDR hDI;
     PDIR_INDEX_ITEM DI;
 //    BOOLEAN Referenced = FALSE;
     ULONG ret_val = 0;
@@ -429,7 +429,7 @@ UDFFlushADirectory(
         return 0;
 
     if(!FI || !FI->Dloc || !FI->Dloc->DirIndex) goto SkipFlushDir;
-    hDI = FI->Dloc->DirIndex;
+//    hDI = FI->Dloc->DirIndex;
 
     // Flush Security if required
     _SEH2_TRY {
@@ -455,7 +455,7 @@ UDFFlushADirectory(
         PUDF_FILE_INFO      tempFI;
 
         if(UDFDirIndexInitScan(FI, &ScanContext, 2)) {
-            while(DI = UDFDirIndexScan(&ScanContext, &tempFI)) {
+            while((DI = UDFDirIndexScan(&ScanContext, &tempFI))) {
                 // Flush Dir entry
                 _SEH2_TRY {
                     if(!tempFI) continue;
index 6ebb2a6..72640e7 100644 (file)
@@ -851,7 +851,7 @@ UDFStartEjectWaiter(
     IN PVCB    Vcb
     )
 {
-    NTSTATUS RC;
+//    NTSTATUS RC;
     PREVENT_MEDIA_REMOVAL_USER_IN Buff;
     KdPrint(("UDFStartEjectWaiter:\n"));
 
@@ -879,11 +879,11 @@ UDFStartEjectWaiter(
             // prevent media removal
             KdPrint(("UDFStartEjectWaiter: lock media\n"));
             Buff.PreventMediaRemoval = TRUE;
-            RC = UDFTSendIOCTL( IOCTL_STORAGE_MEDIA_REMOVAL,
-                                 Vcb,
-                                 &Buff,sizeof(PREVENT_MEDIA_REMOVAL_USER_IN),
-                                 NULL,0,
-                                 FALSE,NULL );
+            UDFTSendIOCTL( IOCTL_STORAGE_MEDIA_REMOVAL,
+                           Vcb,
+                           &Buff,sizeof(PREVENT_MEDIA_REMOVAL_USER_IN),
+                           NULL,0,
+                           FALSE,NULL );
             Vcb->VCBFlags |= UDF_VCB_FLAGS_MEDIA_LOCKED;
         }
         KdPrint(("UDFStartEjectWaiter: prepare to start\n"));
@@ -1267,9 +1267,7 @@ bl_unwind_1:
     DirNdx->FileCharacteristics = FILE_DIRECTORY;
     DirNdx->FI_Flags = UDF_FI_FLAG_SYS_ATTR;
     DirNdx->SysAttr = FILE_ATTRIBUTE_READONLY;
-    DirNdx->FName.Buffer = L".";
-    DirNdx->FName.Length =
-    (DirNdx->FName.MaximumLength = sizeof(L".")) - sizeof(WCHAR);
+    RtlInitUnicodeString(&DirNdx->FName, L".");
     DirNdx->FileInfo = RootFcb->FileInfo;
     DirNdx->FI_Flags |= UDFBuildHashEntry(Vcb, &(DirNdx->FName), &(DirNdx->hashes), HASH_ALL | HASH_KEEP_NAME);
 
@@ -1279,9 +1277,7 @@ bl_unwind_1:
         DirNdx->FI_Flags |= UDF_FI_FLAG_FI_INTERNAL;
     }
     DirNdx->SysAttr = FILE_ATTRIBUTE_READONLY;
-    DirNdx->FName.Buffer = L"Blank.CD";
-    DirNdx->FName.Length =
-    (DirNdx->FName.MaximumLength = sizeof(L"Blank.CD")) - sizeof(WCHAR);
+    RtlInitUnicodeString(&DirNdx->FName, L"Blank.CD");
     DirNdx->FI_Flags |= UDFBuildHashEntry(Vcb, &(DirNdx->FName), &(DirNdx->hashes), HASH_ALL);
 
     RootFcb->FileInfo->Dloc->DirIndex = hDirNdx;
@@ -1820,12 +1816,12 @@ UDFLockVolume(
     IoAcquireVpbSpinLock( &SavedIrql );
 
     if (!(Vcb->Vpb->Flags & VPB_LOCKED) &&
-        (Vcb->VolumeLockPID == -1) &&
+        (Vcb->VolumeLockPID == (ULONG)-1) &&
         (Vcb->VCBOpenCount <= UDF_RESIDUAL_REFERENCE+1) &&
         (Vcb->Vpb->ReferenceCount == 2)) {
 
         // Mark volume as locked
-        if(PID == -1) {
+        if(PID == (ULONG)-1) {
             Vcb->Vpb->Flags |= VPB_LOCKED;
         }
         Vcb->VCBFlags |= UDF_VCB_FLAGS_VOLUME_LOCKED;
@@ -2075,7 +2071,7 @@ UDFGetVolumeBitmap(
     IN PIRP Irp
     )
 {
-    NTSTATUS RC;
+//    NTSTATUS RC;
 
     PEXTENDED_IO_STACK_LOCATION IrpSp =
         (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation( Irp );
@@ -2095,7 +2091,8 @@ UDFGetVolumeBitmap(
     LARGE_INTEGER StartingLcn;
     PVOLUME_BITMAP_BUFFER OutputBuffer;
     ULONG i, lim;
-    PULONG FSBM, Dest;
+    PULONG FSBM;
+//    PULONG Dest;
     ULONG LSh;
 
     // Decode the file object, the only type of opens we accept are
@@ -2149,12 +2146,12 @@ UDFGetVolumeBitmap(
     if (OutputBufferLength < (DesiredClusters + 7) / 8) {
 
         BytesToCopy = OutputBufferLength;
-        RC = STATUS_BUFFER_OVERFLOW;
+//        RC = STATUS_BUFFER_OVERFLOW;
 
     } else {
 
         BytesToCopy = (DesiredClusters + 7) / 8;
-        RC = STATUS_SUCCESS;
+//        RC = STATUS_SUCCESS;
     }
 
     UDFAcquireResourceExclusive(&(Vcb->VCBResource), TRUE );
@@ -2169,7 +2166,7 @@ UDFGetVolumeBitmap(
         lim = BytesToCopy * 8;
         FSBM = (PULONG)(Vcb->FSBM_Bitmap);
         LSh = Vcb->LB2B_Bits;
-        Dest = (PULONG)(&OutputBuffer->Buffer[0]);
+//        Dest = (PULONG)(&OutputBuffer->Buffer[0]);
 
         for(i=StartingCluster & ~7; i<lim; i++) {
             if(UDFGetFreeBit(FSBM, i<<LSh))
index a59da5a..0e2e48f 100644 (file)
@@ -109,7 +109,7 @@ UDFCommonLockControl(
     NTSTATUS            RC = STATUS_SUCCESS;
     PIO_STACK_LOCATION  IrpSp = NULL;
     //IO_STATUS_BLOCK     LocalIoStatus;
-    BOOLEAN             CompleteRequest = FALSE;
+//    BOOLEAN             CompleteRequest = FALSE;
     BOOLEAN             PostRequest = FALSE;
     BOOLEAN             CanWait = FALSE;
     PtrUDFNTRequiredFCB NtReqFcb = NULL;
@@ -137,7 +137,7 @@ UDFCommonLockControl(
         if ( (Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) ||
              (Fcb->FCBFlags & UDF_FCB_DIRECTORY)) {
 
-            CompleteRequest = TRUE;
+//            CompleteRequest = TRUE;
             try_return(RC = STATUS_INVALID_PARAMETER);
         }
 
@@ -153,7 +153,7 @@ UDFCommonLockControl(
         AcquiredFCB = TRUE;
 
         RC = FsRtlProcessFileLock(&(NtReqFcb->FileLock), Irp, NULL);
-        CompleteRequest = TRUE;
+//        CompleteRequest = TRUE;
 
 try_exit: NOTHING;
 
@@ -253,7 +253,7 @@ UDFFastLock (
 
         //  Now call the FsRtl routine to do the actual processing of the
         //  Lock request
-        if (Results = FsRtlFastLock( &(Fcb->NTRequiredFCB->FileLock),
+        if ((Results = FsRtlFastLock( &(Fcb->NTRequiredFCB->FileLock),
                                      FileObject,
                                      FileOffset,
                                      Length,
@@ -263,7 +263,7 @@ UDFFastLock (
                                      ExclusiveLock,
                                      IoStatus,
                                      NULL,
-                                     FALSE )) {
+                                     FALSE ))) {
 
             //  Set the flag indicating if Fast I/O is possible
             Fcb->NTRequiredFCB->CommonFCBHeader.IsFastIoPossible = UDFIsFastIoPossible(Fcb);
index 7a0a7e9..d512ca8 100644 (file)
@@ -1750,7 +1750,7 @@ UDFGetMediaClass(
 typedef ULONG
 (*ptrUDFGetParameter)(
     IN PVCB Vcb, 
-    IN PWSTR Name,
+    IN PCWSTR Name,
     IN ULONG DefValue
     );
 
@@ -1759,7 +1759,7 @@ UDFUpdateCompatOption(
     PVCB Vcb,
     BOOLEAN Update,
     BOOLEAN UseCfg,
-    PWCHAR Name,
+    PCWSTR Name,
     ULONG Flag,
     BOOLEAN Default
     )
@@ -1824,7 +1824,7 @@ UDFReadRegKeys(
     if(!Vcb->BM_FlushPriod) {
         Vcb->BM_FlushPriod = UDF_DEFAULT_BM_FLUSH_TIMEOUT;
     } else
-    if(Vcb->BM_FlushPriod == -1) {
+    if(Vcb->BM_FlushPriod == (ULONG)-1) {
         Vcb->BM_FlushPriod = 0;
     }
     Vcb->Tree_FlushPriod = UDFGetParameter(Vcb, UDF_TREE_FLUSH_PERIOD_NAME,
@@ -1832,7 +1832,7 @@ UDFReadRegKeys(
     if(!Vcb->Tree_FlushPriod) {
         Vcb->Tree_FlushPriod = UDF_DEFAULT_TREE_FLUSH_TIMEOUT;
     } else
-    if(Vcb->Tree_FlushPriod == -1) {
+    if(Vcb->Tree_FlushPriod == (ULONG)-1) {
         Vcb->Tree_FlushPriod = 0;
     }
     Vcb->SkipCountLimit = UDFGetParameter(Vcb, UDF_NO_UPDATE_PERIOD_NAME,
@@ -1982,7 +1982,7 @@ UDFReadRegKeys(
 ULONG
 UDFGetRegParameter(
     IN PVCB Vcb, 
-    IN PWSTR Name,
+    IN PCWSTR Name,
     IN ULONG DefValue
     )
 {
@@ -1996,7 +1996,7 @@ UDFGetRegParameter(
 ULONG
 UDFGetCfgParameter(
     IN PVCB Vcb, 
-    IN PWSTR Name,
+    IN PCWSTR Name,
     IN ULONG DefValue
     )
 {
@@ -2221,9 +2221,9 @@ UDFReleaseVCB(
 ULONG
 UDFRegCheckParameterValue(
     IN PUNICODE_STRING RegistryPath,
-    IN PWSTR Name,
+    IN PCWSTR Name,
     IN PUNICODE_STRING PtrVolumePath,
-    IN PWSTR DefaultPath,
+    IN PCWSTR DefaultPath,
     IN ULONG DefValue
     )
 {
@@ -2357,19 +2357,19 @@ UDFRegCheckParameterValue(
 
 
         // *** Read GLOBAL_DEFAULTS from
-        // \DwUdf\Parameters_Unknown\
+        // "\DwUdf\Parameters_Unknown\"
 
         status = RegTGetDwordValue(NULL, paramPath.Buffer, Name, &val);
 
         // *** Read DEV_CLASS_SPEC_DEFAULTS (if any) from
-        // \DwUdf\Parameters_%DevClass%\
+        // "\DwUdf\Parameters_%DevClass%\"
 
         if(DefaultPath) {
             status = RegTGetDwordValue(NULL, defaultParamPath.Buffer, Name, &val);
         }
 
         // *** Read DEV_SPEC_PARAMS from (if device supports GetDevName)
-        // \DwUdf\Parameters\%DevName%\
+        // "\DwUdf\Parameters\%DevName%\"
 
         status = RegTGetDwordValue(NULL, paramDevPath.Buffer, Name, &val);
 
index 1c83186..1c44dea 100644 (file)
@@ -414,7 +414,7 @@ UDFPnpRemove (
     //  The device will be going away.  Remove our lock (benign
     //  if we never had it).
     if((Vcb->Vpb->Flags & VPB_LOCKED) ||
-       (Vcb->VolumeLockPID != -1) ) {
+       (Vcb->VolumeLockPID != (ULONG)-1) ) {
         Vcb->Vpb->Flags &= ~VPB_LOCKED;
         Vcb->VCBFlags &= ~UDF_VCB_FLAGS_VOLUME_LOCKED;
         Vcb->VolumeLockFileObject = NULL;
@@ -628,7 +628,7 @@ try_exit:   NOTHING;
     return RC;
 }
 
-/*\f
+/*
 NTSTATUS
 UDFPnpCancelRemove (
     PtrUDFIrpContext PtrIrpContext,
@@ -636,6 +636,7 @@ UDFPnpCancelRemove (
     PVCB Vcb
     )
 
+*/
 /*++
 
 Routine Description:
index 43ae831..6bf5e4e 100644 (file)
@@ -658,13 +658,13 @@ UDFReadRegKeys(
 
 extern ULONG UDFGetRegParameter(
     IN PVCB Vcb, 
-    IN PWSTR Name,
+    IN PCWSTR Name,
     IN ULONG DefValue = 0);
 
 extern ULONG
 UDFGetCfgParameter(
     IN PVCB Vcb, 
-    IN PWSTR Name,
+    IN PCWSTR Name,
     IN ULONG DefValue
     );
 
@@ -673,9 +673,9 @@ extern VOID UDFReleaseVCB(
 
 extern ULONG UDFRegCheckParameterValue(
     IN PUNICODE_STRING RegistryPath,
-    IN PWSTR Name,
+    IN PCWSTR Name,
     IN PUNICODE_STRING PtrVolumePath,
-    IN PWSTR DefaultPath,
+    IN PCWSTR DefaultPath,
     IN ULONG DefValue = 0);
 
 extern VOID UDFInitializeIrpContextFromLite (
index 903a4eb..c3079eb 100644 (file)
@@ -452,7 +452,7 @@ UDFCommonRead(
             NonBufferedIo = TRUE;
         }
 
-        if(ByteOffset.HighPart == 0xFFFFFFFF) {
+        if(ByteOffset.HighPart == -1) {
             if(ByteOffset.LowPart == FILE_USE_FILE_POINTER_POSITION) {
                 ByteOffset = FileObject->CurrentByteOffset;
             }
index 5958365..d253d92 100644 (file)
@@ -498,12 +498,12 @@ DbgWaitForSingleObject_(
 {
     PLARGE_INTEGER to;
     LARGE_INTEGER dto;
-    LARGE_INTEGER cto;
+//    LARGE_INTEGER cto;
     NTSTATUS RC;
     ULONG c = 20;
 
     dto.QuadPart = -5LL*1000000LL*10LL; // 5 sec
-    cto.QuadPart = Timeout->QuadPart;
+//    cto.QuadPart = Timeout->QuadPart;
     if(Timeout) {
         if(dto.QuadPart > Timeout->QuadPart) {
             to = Timeout;
index f538594..2fd18ae 100644 (file)
@@ -1151,7 +1151,7 @@ UDFGetTotalSpace(
             s+=Vcb->Partitions[i].PartitionLen;
         }
     } else {
-        if(s & ((int64)1 << 64)) s=0;
+        if(s & ((int64)1 << 63)) s=0;  /* FIXME ReactOS this shift value was 64, which is undefiened behavior. */
         s= Vcb->LastPossibleLBA - Vcb->Partitions[0].PartitionRoot;
     }
     return s >> Vcb->LB2B_Bits;
@@ -1197,9 +1197,13 @@ UDFIsBlockAllocated(
 
 #ifdef _X86_
 
+#ifdef _MSC_VER
 #pragma warning(disable:4035)               // re-enable below
+#endif
 
+#ifdef _MSC_VER
 __declspec (naked)
+#endif
 BOOLEAN
 __fastcall
 UDFGetBit__(
@@ -1233,7 +1237,9 @@ UDFGetBit__(
 #endif
 } // end UDFGetBit__()
 
+#ifdef _MSC_VER
 __declspec (naked)
+#endif
 void
 __fastcall
 UDFSetBit__(
@@ -1339,7 +1345,9 @@ EO_sb_loop:
 #endif
 } // end UDFSetBits__()
 
+#ifdef _MSC_VER
 __declspec (naked)
+#endif
 void
 __fastcall
 UDFClrBit__(
@@ -1445,5 +1453,7 @@ EO_cp_loop:
 #endif
 } // end UDFClrBits__()
 
+#ifdef _MSC_VER
 #pragma warning(default:4035)
+#endif
 #endif // _X86_
index 459d7f5..e941e24 100644 (file)
@@ -236,11 +236,15 @@ UDFDirIndexTrunc(
 } // end UDFDirIndexTrunc()
 
 #if defined _X86_ && !defined UDF_LIMIT_DIR_SIZE
+#ifdef _MSC_VER
 #pragma warning(disable:4035)               // re-enable below
+#endif
 /*
     This routine returns pointer to DirIndex item with index i.
  */
+#ifdef _MSC_VER
 __declspec (naked)
+#endif
 PDIR_INDEX_ITEM
 __fastcall
 UDFDirIndex(
@@ -299,7 +303,9 @@ udi_OK:
     return NULL;
 #endif
 }
+#ifdef _MSC_VER
 #pragma warning(default:4035)
+#endif
 #endif // _X86_
 
 /*
@@ -397,7 +403,7 @@ UDFDirIndexScan(
     }
 
     if(_FileInfo) {
-        if(FileInfo = Context->DirNdx->FileInfo) {
+        if((FileInfo = Context->DirNdx->FileInfo)) {
             if(FileInfo->ParentFile != Context->DirInfo) {
                 ParFileInfo = UDFLocateParallelFI(Context->DirInfo, 
                                                   Context->i,
@@ -507,7 +513,7 @@ UDFIndexDirectory(
     PDIR_INDEX_ITEM DirNdx;
     PFILE_IDENT_DESC FileId;
     uint32 Offset = 0;
-    uint32 prevOffset = 0;
+//    uint32 prevOffset = 0;
     uint_di Count = 0;
     OSSTATUS status;
     int8* buff;
@@ -541,7 +547,7 @@ UDFIndexDirectory(
     // scan Dir to get entry counter
     FileId = (PFILE_IDENT_DESC)buff;
     DirPrint(("  ExtInfo->Length %x\n", ExtInfo->Length));
-    prevOffset = 0;
+//    prevOffset = 0;
     while(Offset<ExtInfo->Length) {
         DirPrint(("  Offset %x\n", Offset));
         if(!FileId->descTag.tagIdent) {
@@ -566,7 +572,7 @@ UDFIndexDirectory(
                 FileInfo->Dloc->DirIndex->DelCount = Vcb->PackDirThreshold+1;
             }
         }
-        prevOffset = Offset;
+//        prevOffset = Offset;
         Offset += (FileId->lengthFileIdent + FileId->lengthOfImpUse + sizeof(FILE_IDENT_DESC) + 3) & (~((uint32)3));
         FileId = (PFILE_IDENT_DESC)((buff)+Offset);
         Count++;
@@ -603,7 +609,7 @@ UDFIndexDirectory(
     ASSERT(PartNum != -1);
     DirNdx->FileEntryLoc.logicalBlockNum =
         UDFPhysLbaToPart(Vcb, PartNum, FileInfo->Dloc->FELoc.Mapping[0].extLocation);
-    if(DirNdx->FileEntryLoc.logicalBlockNum == -1) {
+    if(DirNdx->FileEntryLoc.logicalBlockNum == (ULONG)-1) {
         DirPrint(("  err: FileEntryLoc=-1\n"));
         DbgFreePool(buff);
         return STATUS_FILE_CORRUPT_ERROR;
@@ -613,9 +619,7 @@ UDFIndexDirectory(
                          FILE_DIRECTORY;
 //    DirNdx->Offset = 0;
 //    DirNdx->Length = 0;
-    DirNdx->FName.Buffer = L".";
-    DirNdx->FName.Length =
-    (DirNdx->FName.MaximumLength = sizeof(L".")) - sizeof(WCHAR);
+    RtlInitUnicodeString(&DirNdx->FName, L".");
     DirNdx->FileInfo = FileInfo;
     DirNdx->FI_Flags |= UDF_FI_FLAG_KEEP_NAME;
     DirNdx->FI_Flags |= UDFBuildHashEntry(Vcb, &(DirNdx->FName), &(DirNdx->hashes),
@@ -623,7 +627,7 @@ UDFIndexDirectory(
     Count++;
     FileId = (PFILE_IDENT_DESC)buff;
     status = STATUS_SUCCESS;
-    prevOffset = 0;
+//    prevOffset = 0;
     while((Offset<ExtInfo->Length) && FileId->descTag.tagIdent) {
         // add new entry to index list
         if(FileId->descTag.tagIdent != TID_FILE_IDENT_DESC) {
@@ -656,9 +660,7 @@ UDFIndexDirectory(
             // init 'parent' entry
             // '..' points to Parent Object (if any),
             // otherwise it points to the Dir itself
-            DirNdx->FName.Buffer = L"..";
-            DirNdx->FName.Length =
-            (DirNdx->FName.MaximumLength = sizeof(L"..")) - sizeof(WCHAR);
+            RtlInitUnicodeString(&DirNdx->FName, L"..");
             DirNdx->FileInfo = (FileInfo->ParentFile) ?
                                       FileInfo->ParentFile : FileInfo;
             DirNdx->FI_Flags |= UDF_FI_FLAG_KEEP_NAME;
@@ -707,7 +709,7 @@ UDFIndexDirectory(
             FileId->fileCharacteristics |= FILE_DELETED;
         }
 #endif // UDF_CHECK_DISK_ALLOCATION
-        prevOffset = Offset;
+//        prevOffset = Offset;
         Offset += DirNdx->Length;
         FileId = (PFILE_IDENT_DESC)(((int8*)FileId)+DirNdx->Length);
         Count++;
@@ -788,7 +790,7 @@ UDFPackDirectory__(
     PartNum = (uint16)UDFGetPartNumByPhysLba(Vcb, FileInfo->Dloc->FELoc.Mapping[0].extLocation);
     ASSERT(PartNum != -1);
 
-    while(DirNdx = UDFDirIndexScan(&ScanContext, NULL)) {
+    while((DirNdx = UDFDirIndexScan(&ScanContext, NULL))) {
 
         if(UDFIsDeleted(DirNdx))
             dc++;
@@ -932,7 +934,7 @@ UDFReTagDirectory(
     PartNum = (uint16)UDFGetPartNumByPhysLba(Vcb, FileInfo->Dloc->FELoc.Mapping[0].extLocation);
     ASSERT(PartNum != -1);
 
-    while(DirNdx = UDFDirIndexScan(&ScanContext, NULL)) {
+    while((DirNdx = UDFDirIndexScan(&ScanContext, NULL))) {
 
         status = UDFReadFile__(Vcb, FileInfo, Offset = DirNdx->Offset,
                                                    l = DirNdx->Length, FALSE, Buf, &ReadBytes);
@@ -996,7 +998,7 @@ UDFFindFile(
 
     UDFBuildHashEntry(Vcb, Name, &hashes, HASH_POSIX | HASH_ULFN);
 
-    if(CanBe8d3 = UDFCanNameBeA8dot3(Name)) {
+    if((CanBe8d3 = UDFCanNameBeA8dot3(Name))) {
         ShortName.MaximumLength = 13 * sizeof(WCHAR);
         ShortName.Buffer = (PWCHAR)&ShortNameBuffer;
     }
@@ -1007,7 +1009,7 @@ UDFFindFile(
     if(!IgnoreCase && !CanBe8d3) {
         // perform case sensetive sequential directory scan
 
-        while(DirNdx = UDFDirIndexScan(&ScanContext, NULL)) {
+        while((DirNdx = UDFDirIndexScan(&ScanContext, NULL))) {
             if( (DirNdx->hashes.hPosix == hashes.hPosix) &&
                  DirNdx->FName.Buffer &&
                 (!RtlCompareUnicodeString(&(DirNdx->FName), Name, FALSE)) &&
@@ -1021,7 +1023,7 @@ UDFFindFile(
 
     if(hashes.hPosix == hashes.hLfn) {
 
-        while(DirNdx = UDFDirIndexScan(&ScanContext, NULL)) {
+        while((DirNdx = UDFDirIndexScan(&ScanContext, NULL))) {
             if(!DirNdx->FName.Buffer ||
                (NotDeleted && UDFIsDeleted(DirNdx)) )
                 continue;
@@ -1042,7 +1044,7 @@ UDFFindFile(
 
     } else {
 
-        while(DirNdx = UDFDirIndexScan(&ScanContext, NULL)) {
+        while((DirNdx = UDFDirIndexScan(&ScanContext, NULL))) {
             // perform sequential directory scan
             if(!DirNdx->FName.Buffer ||
                (NotDeleted && UDFIsDeleted(DirNdx)) )
@@ -1244,7 +1246,7 @@ UDFStoreDloc(
     PUDF_DATALOC_INFO Dloc;
 
     if(!Lba) return STATUS_INVALID_PARAMETER;
-    if(Lba == (-1)) return STATUS_INVALID_PARAMETER;
+    if(Lba == (ULONG)-1) return STATUS_INVALID_PARAMETER;
 
     UDFAcquireResourceExclusive(&(Vcb->DlocResource),TRUE);
 
index f54b224..991ae3b 100644 (file)
@@ -86,10 +86,12 @@ UDFNextExtentToLba(
 {
 //    uint32 Lba;
 
-    uint32 l, d;
+    uint32 l;
+//    uint32 d;
 
     // scan extent table for suitable range (frag)
-    d = (l = (Extent->extLength & UDF_EXTENT_LENGTH_MASK));
+//    d = (l = (Extent->extLength & UDF_EXTENT_LENGTH_MASK));
+    l = (Extent->extLength & UDF_EXTENT_LENGTH_MASK);
 
     if(!l) {
         (*Index) = -1;
@@ -120,7 +122,7 @@ UDFLocateLbaInExtent(
     uint32 l, BSh = Vcb->BlockSizeBits;
     uint32 i=0;
 
-    while(l = ((Extent->extLength & UDF_EXTENT_LENGTH_MASK) >> BSh)) {
+    while((l = ((Extent->extLength & UDF_EXTENT_LENGTH_MASK) >> BSh))) {
 
         if(Extent->extLocation   >= lba &&
            Extent->extLocation+l <  lba) {
@@ -300,7 +302,8 @@ UDFShortAllocDescToMapping(
     OUT PEXTENT_INFO AllocLoc
     )
 {
-    uint32 i, lim, l, len, BSh, type;
+    uint32 i, lim, l, len, type;
+//    uint32 BSh;
     PEXTENT_MAP Extent, Extent2, AllocMap;
     EXTENT_AD AllocExt;
     PALLOC_EXT_DESC NextAllocDesc;
@@ -314,7 +317,7 @@ UDFShortAllocDescToMapping(
     if(SubCallCount > ALLOC_DESC_MAX_RECURSE) return NULL;
 
     locAddr.partitionReferenceNum = (uint16)PartNum;
-    BSh = Vcb->BlockSizeBits;
+//    BSh = Vcb->BlockSizeBits;
     l = ((lim = (AllocDescLength/sizeof(SHORT_AD))) + 1 ) * sizeof(EXTENT_AD);
     Extent = (PEXTENT_MAP)MyAllocatePoolTag__(NonPagedPool, l, MEM_EXTMAP_TAG);
     if(!Extent) return NULL;
@@ -461,7 +464,8 @@ UDFLongAllocDescToMapping(
     OUT PEXTENT_INFO AllocLoc // .Mapping must be intialized (non-Zero)
     )
 {
-    uint32 i, lim, l, len, BSh, type;
+    uint32 i, lim, l, len, type;
+//    uint32 BSh;
     PEXTENT_MAP Extent, Extent2, AllocMap;
     EXTENT_AD AllocExt;
     PALLOC_EXT_DESC NextAllocDesc;
@@ -472,7 +476,7 @@ UDFLongAllocDescToMapping(
 
     if(SubCallCount > ALLOC_DESC_MAX_RECURSE) return NULL;
 
-    BSh = Vcb->BlockSizeBits;
+//    BSh = Vcb->BlockSizeBits;
     l = ((lim = (AllocDescLength/sizeof(LONG_AD))) + 1 ) * sizeof(EXTENT_AD);
     Extent = (PEXTENT_MAP)MyAllocatePoolTag__(NonPagedPool, l, MEM_EXTMAP_TAG);
     if(!Extent) return NULL;
@@ -598,7 +602,8 @@ UDFExtAllocDescToMapping(
     OUT PEXTENT_INFO AllocLoc // .Mapping must be intialized (non-Zero)
     )
 {
-    uint32 i, lim, l, len, BSh, type;
+    uint32 i, lim, l, len, type;
+//    uint32 BSh;
     PEXTENT_MAP Extent, Extent2, AllocMap;
     EXTENT_AD AllocExt;
     PALLOC_EXT_DESC NextAllocDesc;
@@ -609,7 +614,7 @@ UDFExtAllocDescToMapping(
 
     if(SubCallCount > ALLOC_DESC_MAX_RECURSE) return NULL;
 
-    BSh = Vcb->BlockSizeBits;
+//    BSh = Vcb->BlockSizeBits;
     l = ((lim = (AllocDescLength/sizeof(EXT_AD))) + 1 ) * sizeof(EXTENT_AD);
     Extent = (PEXTENT_MAP)MyAllocatePoolTag__(NonPagedPool, l, MEM_EXTMAP_TAG);
     if(!Extent) return NULL;
@@ -852,7 +857,7 @@ UDFBuildShortAllocDescs(
     ValidateFileInfo(FileInfo);
     ExtPrint(("UDFBuildShortAllocDescs: FE %x\n", FileInfo->Dloc->FELoc.Mapping[0].extLocation));
     // calculate length
-    for(len=0; i=(Extent[len].extLength & UDF_EXTENT_LENGTH_MASK); len++, ph_len+=i) {
+    for(len=0; (i=(Extent[len].extLength & UDF_EXTENT_LENGTH_MASK)); len++, ph_len+=i) {
         ExtPrint(("bShExt: type %x, loc %x, len %x\n",
             Extent[len].extLength >> 30, Extent[len].extLocation, Extent[len].extLength & UDF_EXTENT_LENGTH_MASK));
     }
@@ -1039,7 +1044,7 @@ UDFBuildLongAllocDescs(
     ExtPrint(("UDFBuildLongAllocDescs: FE %x\n", FileInfo->Dloc->FELoc.Mapping[0].extLocation));
     // calculate length
     //for(len=0; i=(Extent[len].extLength & UDF_EXTENT_LENGTH_MASK); len++, ph_len+=i);
-    for(len=0; i=(Extent[len].extLength & UDF_EXTENT_LENGTH_MASK); len++, ph_len+=i) {
+    for(len=0; (i=(Extent[len].extLength & UDF_EXTENT_LENGTH_MASK)); len++, ph_len+=i) {
         ExtPrint(("bLnExt: type %x, loc %x, len %x\n",
             Extent[len].extLength >> 30, Extent[len].extLocation, Extent[len].extLength & UDF_EXTENT_LENGTH_MASK));
     }
@@ -1749,7 +1754,7 @@ UDFFreeFESpace(
                 j = i;
             }
         }
-        if(j != -1) {
+        if(j != (ULONG)-1) {
             i = j;
             Ext->Mapping[i].extLocation = Lba;
             Ext->Mapping[i].extLength   = Vcb->LBlockSize | (EXTENT_NOT_RECORDED_ALLOCATED << 30);
@@ -1828,7 +1833,7 @@ UDFMarkAllocatedAsRecorded(
     // I don't know what else comment can be added here.
     // Just belive that it works
     lba = UDFExtentOffsetToLba(Vcb, ExtInfo->Mapping, (Offset & ~((int64)LBS-1)), NULL, NULL, NULL, &i);
-    if(i == -1) return STATUS_INVALID_PARAMETER;
+    if(i == (ULONG)-1) return STATUS_INVALID_PARAMETER;
 #ifdef UDF_DBG
     check_size = UDFGetExtentLength(ExtInfo->Mapping);
     ASSERT(!(check_size & (LBS-1)));
@@ -1962,7 +1967,7 @@ UDFMarkNotAllocatedAsAllocated(
 #endif
     AdPrint(("Not->Alloc  ExtInfo %x, Extent %x\n", ExtInfo, Extent));
     UDFExtentOffsetToLba(Vcb, ExtInfo->Mapping, Offset, NULL, NULL, NULL, &i);
-    if(i == -1) return STATUS_INVALID_PARAMETER;
+    if(i == (ULONG)-1) return STATUS_INVALID_PARAMETER;
     if((Extent[i].extLength >> 30) != EXTENT_NOT_RECORDED_NOT_ALLOCATED) return STATUS_SUCCESS;
 
     uint32 PartNum = UDFGetPartNumByPhysLba(Vcb, Extent[0].extLocation);
@@ -2120,7 +2125,7 @@ UDFMarkAllocatedAsNotXXX(
 
     DeadMapping[0].extLocation =
         UDFExtentOffsetToLba(Vcb, ExtInfo->Mapping, Offset, NULL, NULL, NULL, &i);
-    if(i == -1) {
+    if(i == (ULONG)-1) {
         BrutePoint();
         return STATUS_INVALID_PARAMETER;
     }
@@ -2620,7 +2625,7 @@ UDFBuildAllocDescs(
     OUT int8** AllocData
     )
 {
-    PEXTENT_MAP InMap;
+//    PEXTENT_MAP InMap;
 //    uint32 i=0;
     int8* Allocs;
     uint16 AllocMode;
@@ -2637,7 +2642,7 @@ UDFBuildAllocDescs(
         return STATUS_INSUFFICIENT_RESOURCES;
     }
     RtlZeroMemory(Allocs, InitSz);
-    InMap = FileInfo->Dloc->DataLoc.Mapping;
+//    InMap = FileInfo->Dloc->DataLoc.Mapping;
     UDFCheckSpaceAllocation(Vcb, 0, InMap, AS_USED); // check if used
 
     // TODO: move data from mapped locations here
@@ -2860,7 +2865,7 @@ UDFUnPackMapping(
 
     j=0;
     d = LBS >> Vcb->BlockSizeBits;
-    for(i=0; l = (Mapping[i].extLength & UDF_EXTENT_LENGTH_MASK); i++) {
+    for(i=0; (l = (Mapping[i].extLength & UDF_EXTENT_LENGTH_MASK)); i++) {
         base = Mapping[i].extLocation;
         type = Mapping[i].extLength & UDF_EXTENT_FLAG_MASK;
         for(; l>=(LONG)LBS; j++) {
@@ -2912,7 +2917,7 @@ UDFIsExtentCached(
     PEXTENT_MAP Extent = ExtInfo->Mapping;   // Extent array
     uint32 to_read, Lba, sect_offs, flags, i;
 
-    WCacheStartDirect__(&(Vcb->FastCache), Vcb, TRUE/*FALSE/*ForWrite*/);
+    WCacheStartDirect__(&(Vcb->FastCache), Vcb, TRUE/*FALSE*//*ForWrite*/);
     if(!ExtInfo || !ExtInfo->Mapping) goto EO_IsCached;
     if(!Length) {
         retstat = TRUE;
@@ -3078,7 +3083,7 @@ UDFReadExtentLocation(
     int32 SubExtInfoSz = *_SubExtInfoSz;
     int64 Length;
     int64 NextOffset;
-    OSSTATUS status = STATUS_BUFFER_OVERFLOW;
+//    OSSTATUS status = STATUS_BUFFER_OVERFLOW;
 
     (*_SubExtInfo) = NULL;
     (*_SubExtInfoSz) = 0;
@@ -3121,7 +3126,7 @@ UDFReadExtentLocation(
         // prepare for reading next frag...
         Length -= to_read;
         if(!Length) {
-            status = STATUS_SUCCESS;
+//            status = STATUS_SUCCESS;
             break;
         }
         ASSERT(to_read);
@@ -3132,8 +3137,10 @@ UDFReadExtentLocation(
     return STATUS_SUCCESS;
 } // end UDFReadExtentLocation()
 
+#ifdef _MSC_VER
 #pragma warning(push)               
 #pragma warning(disable:4035)               // re-enable below
+#endif
 
 uint32
 UDFGetZeroLength(
@@ -3150,7 +3157,9 @@ UDFGetZeroLength(
     return Length*sizeof(uint32);
 }
 
+#ifdef _MSC_VER
 #pragma warning(pop) // re-enable warning #4035
+#endif
 
 #ifndef UDF_READ_ONLY_BUILD
 /*
index 3eb1e10..930444d 100644 (file)
 
 #include "udf.h"
 
-/* FIXME*/
+/* FIXME */
+#ifdef XCHG_DD
+#undef XCHG_DD
+#endif
+
 #define XCHG_DD(a,b)              \
 {                                 \
     ULONG  _temp_;                \
@@ -197,13 +201,13 @@ UDFUpdateXSpaceBitmaps(
     int8* FSBM=NULL;
     uint32 USl, FSl;
     EXTENT_INFO FSBMExtInfo, USBMExtInfo;
-    lb_addr locAddr;
+//    lb_addr locAddr;
     uint32 WrittenBytes;
 
     UDF_CHECK_BITMAP_RESOURCE(Vcb);
 
     plen = UDFPartLen(Vcb, PartNum);
-    locAddr.partitionReferenceNum = (uint16)PartNum;
+//    locAddr.partitionReferenceNum = (uint16)PartNum;
     // prepare bitmaps for updating
 
     status =  UDFPrepareXSpaceBitmap(Vcb, &(phd->unallocatedSpaceBitmap), &USBMExtInfo, &USBM, &USl);
@@ -996,7 +1000,7 @@ UDFUmount__(
     return STATUS_SUCCESS;
 } // end UDFUmount__()
 
-/*************************************************************************
+/*************************************************************************/
 
 /*
     Find an anchor volume descriptor.
@@ -1668,9 +1672,9 @@ UDFVerifyXSpaceBitmap(
     )
 {
     int8* tmp;
-    int8* tmp_bm;
-//    uint32 i, lim, j, lba, l, lim2, l2, k;
-    uint32 i, lim, j, lba, lim2;
+//    int8* tmp_bm;
+//    uint32 i, l2, k, lim, j, lim2;
+    uint32 lba;
     lb_addr locAddr;
     OSSTATUS status;
     uint16 Ident;
@@ -1684,7 +1688,7 @@ UDFVerifyXSpaceBitmap(
     KdPrint((" UDFVerifyXSpaceBitmap: part %x\n", PartNum));
 
     if(!(Length = (bm->extLength & UDF_EXTENT_LENGTH_MASK))) return STATUS_SUCCESS;
-    i=UDFPartStart(Vcb, PartNum);
+//    i=UDFPartStart(Vcb, PartNum);
     flags = bm->extLength >> 30;
     if(!flags /*|| flags == EXTENT_NOT_RECORDED_ALLOCATED*/) {
         tmp = (int8*)DbgAllocatePool(NonPagedPool, max(Length, Vcb->BlockSize));
@@ -1707,9 +1711,9 @@ err_vfyxsbm_1:
         if(!OS_SUCCESS(status = UDFReadData(Vcb, FALSE, ((uint64)lba)<<Vcb->BlockSizeBits, Length, FALSE, tmp, &ReadBytes)))
             goto err_vfyxsbm_1;
         UDFRegisterFsStructure(Vcb, lba, Length);
-        lim = min(i + ((lim2 = ((PSPACE_BITMAP_DESC)tmp)->numOfBits) << Vcb->LB2B_Bits), Vcb->FSBM_BitCount);
-        tmp_bm = tmp + sizeof(SPACE_BITMAP_DESC);
-        j = 0;
+//        lim = min(i + ((lim2 = ((PSPACE_BITMAP_DESC)tmp)->numOfBits) << Vcb->LB2B_Bits), Vcb->FSBM_BitCount);
+//        tmp_bm = tmp + sizeof(SPACE_BITMAP_DESC);
+//        j = 0;
 /*        for(;(l = UDFGetBitmapLen((uint32*)tmp_bm, j, lim2)) && (i<lim);) {
             // expand LBlocks to Sectors...
             l2 = l << Vcb->LB2B_Bits;
@@ -2364,7 +2368,7 @@ UDFProcessSequence(
     OSSTATUS    RC = STATUS_SUCCESS;
     int8*       Buf = (int8*)MyAllocatePool__(NonPagedPool,Vcb->BlockSize);
     UDF_VDS_RECORD vds[VDS_POS_LENGTH];
-    GenericDesc   *gd;
+//    GenericDesc   *gd;
     uint32   i,j;
     uint16  ident;
     int8*  Buf2 = NULL;
@@ -2416,7 +2420,7 @@ UDFProcessSequence(
                         RC = UDFReadTagged(Vcb,Buf2, j, j, &ident);
                         if(!OS_SUCCESS(RC)) try_return(RC);
                         UDFRegisterFsStructure(Vcb, j, Vcb->BlockSize);
-                        gd = (struct GenericDesc *)Buf2;
+//                        gd = (struct GenericDesc *)Buf2;
                         if(ident == TID_PARTITION_DESC) {
                             RC = UDFLoadPartDesc(Vcb,Buf2);
                             if(!OS_SUCCESS(RC)) try_return(RC);
@@ -2465,7 +2469,7 @@ UDFVerifySequence(
     OSSTATUS    RC = STATUS_SUCCESS;
     int8*       Buf = (int8*)MyAllocatePool__(NonPagedPool,Vcb->BlockSize);
     UDF_VDS_RECORD vds[VDS_POS_LENGTH];
-    GenericDesc   *gd;
+//    GenericDesc   *gd;
     uint32   i,j;
     uint16  ident;
     int8*  Buf2 = NULL;
@@ -2502,7 +2506,7 @@ UDFVerifySequence(
                         RC = UDFReadTagged(Vcb,Buf2, j, j, &ident);
                         if(!OS_SUCCESS(RC)) try_return(RC);
                         UDFRegisterFsStructure(Vcb, j, Vcb->BlockSize);
-                        gd = (struct GenericDesc *)Buf2;
+//                        gd = (struct GenericDesc *)Buf2;
                         if(ident == TID_PARTITION_DESC) {
                             RC = UDFVerifyPartDesc(Vcb,Buf2);
                             if(!OS_SUCCESS(RC)) try_return(RC);
@@ -2927,11 +2931,12 @@ UDFCheckZeroBuf(
     IN uint32 Length
     )
 {
-    BOOLEAN RC = FALSE;
 
 //#ifdef _X86_
 #ifdef _MSC_VER
 
+    BOOLEAN RC = FALSE;
+
     uint32 len = Length;
     __asm push  ecx
     __asm push  edi
index 47802fb..1bab962 100644 (file)
@@ -55,7 +55,7 @@ UDFEjectReqWaiter(
     BOOLEAN SkipEject = FALSE;
     BOOLEAN SkipFlush = FALSE;
 
-    BOOLEAN FlushAndEject = FALSE;
+//    BOOLEAN FlushAndEject = FALSE;
 
     KdPrint(("    UDFEjectReqWaiter: start\n"));
     uint8 supported_evt_classes = 0;
@@ -604,7 +604,7 @@ media_loss:
                     try_return(RC);
                 }
             }
-            FlushAndEject = TRUE;
+//            FlushAndEject = TRUE;
 device_failure:
             // Ok. Lets flush all we have in memory, dismount volume & eject disc
             // Acquire Vcb resource
@@ -707,7 +707,7 @@ UDFDoDismountSequence(
     )
 {
     LARGE_INTEGER delay;
-    OSSTATUS      RC;
+//    OSSTATUS      RC;
     ULONG i;
 
     // flush system cache
@@ -731,11 +731,11 @@ UDFDoDismountSequence(
         KdPrint(("  cleanup tray-lock (%d+2):\n", Vcb->MediaLockCount));
         for(i=0; i<Vcb->MediaLockCount+2; i++) {
             Buf->PreventMediaRemoval = FALSE;
-            RC = UDFPhSendIOCTL(IOCTL_STORAGE_MEDIA_REMOVAL,
-                                Vcb->TargetDeviceObject,
-                                Buf,sizeof(PREVENT_MEDIA_REMOVAL_USER_IN),
-                                NULL,0,
-                                FALSE,NULL);
+            UDFPhSendIOCTL(IOCTL_STORAGE_MEDIA_REMOVAL,
+                           Vcb->TargetDeviceObject,
+                           Buf,sizeof(PREVENT_MEDIA_REMOVAL_USER_IN),
+                           NULL,0,
+                           FALSE,NULL);
             KeDelayExecutionThread(KernelMode, FALSE, &delay);
         }
         delay.QuadPart = -2000000; // 0.2 sec
@@ -771,11 +771,11 @@ UDFDoDismountSequence(
                 CBuff.Byte2.Flags = CloseTrkSes_Ses;
                 CBuff.TrackNum = 1;
 
-                RC = UDFPhSendIOCTL(IOCTL_CDRW_CLOSE_TRK_SES,
-                                    Vcb->TargetDeviceObject,
-                                    &CBuff,sizeof(CLOSE_TRK_SES_USER_IN),
-                                    &CBuff,sizeof(CLOSE_TRK_SES_USER_IN),
-                                    FALSE, NULL );
+                UDFPhSendIOCTL(IOCTL_CDRW_CLOSE_TRK_SES,
+                               Vcb->TargetDeviceObject,
+                               &CBuff,sizeof(CLOSE_TRK_SES_USER_IN),
+                               &CBuff,sizeof(CLOSE_TRK_SES_USER_IN),
+                               FALSE, NULL );
     /*        } else
             if(Vcb->MediaClassEx == CdMediaClass_DVDRW) {
                 KdPrint(("    Close BG-formatted track\n"));
@@ -800,11 +800,11 @@ UDFDoDismountSequence(
         if(Eject &&
            (Vcb->VCBFlags & UDF_VCB_FLAGS_REMOVABLE_MEDIA)) {
 
-            RC = UDFPhSendIOCTL(IOCTL_STORAGE_EJECT_MEDIA,
-                                Vcb->TargetDeviceObject,
-                                NULL,0,
-                                NULL,0,
-                                FALSE,NULL);
+            UDFPhSendIOCTL(IOCTL_STORAGE_EJECT_MEDIA,
+                           Vcb->TargetDeviceObject,
+                           NULL,0,
+                           NULL,0,
+                           FALSE,NULL);
         }
         // notify media change
     /*    if(Vcb->VCBFlags & UDF_VCB_FLAGS_OUR_DEVICE_DRIVER) {
index e615d03..18736ce 100644 (file)
@@ -117,7 +117,7 @@ UDFVWaitQueued(
         w = InterlockedIncrement((PLONG)&(VerifyCtx->WaiterCount));
         KdPrint(("  %d waiters\n", w));
         DbgWaitForSingleObject(&(VerifyCtx->vrfEvent), NULL);
-        if(w = InterlockedDecrement((PLONG)&(VerifyCtx->WaiterCount))) {
+        if((w = InterlockedDecrement((PLONG)&(VerifyCtx->WaiterCount)))) {
             KdPrint(("  still %d waiters, q %d\n", w, VerifyCtx->QueuedCount));
             if(!VerifyCtx->QueuedCount) {
                 KdPrint(("  pulse event\n", w));
@@ -543,7 +543,7 @@ UDFVWorkItem(
 {
     PVCB Vcb = VerifyReq->Vcb;
     ULONG ReadBytes;
-    OSSTATUS RC;
+//    OSSTATUS RC;
     ULONG i;
 
     ReadBytes = (ULONG)Vcb;
@@ -551,20 +551,20 @@ UDFVWorkItem(
     if(Vcb->SparingCountFree) {
         WCacheStartDirect__(&(Vcb->FastCache), Vcb, TRUE);
         for(i=0; i<VerifyReq->nReq; i++) {
-            RC = UDFTIOVerify(Vcb,
-                           VerifyReq->Buffer,     // Target buffer
-                           VerifyReq->vr[i].BCount << Vcb->BlockSizeBits,
-                           VerifyReq->vr[i].lba,
-                           &ReadBytes,
-                           PH_TMP_BUFFER | PH_VCB_IN_RETLEN /*| PH_LOCK_CACHE*/);
+            UDFTIOVerify(Vcb,
+                         VerifyReq->Buffer,     // Target buffer
+                         VerifyReq->vr[i].BCount << Vcb->BlockSizeBits,
+                         VerifyReq->vr[i].lba,
+                         &ReadBytes,
+                         PH_TMP_BUFFER | PH_VCB_IN_RETLEN /*| PH_LOCK_CACHE*/);
         }
         WCacheEODirect__(&(Vcb->FastCache), Vcb);
     } else {
         for(i=0; i<VerifyReq->nReq; i++) {
             KdPrint(("!!! No more space for remap !!!\n"));
             KdPrint(("  try del from verify cache @ %x\n", VerifyReq->vr[i].lba));
-            RC = UDFVRead(Vcb, VerifyReq->Buffer, VerifyReq->vr[i].BCount, VerifyReq->vr[i].lba,
-                          PH_FORGET_VERIFIED | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER);
+            UDFVRead(Vcb, VerifyReq->Buffer, VerifyReq->vr[i].BCount, VerifyReq->vr[i].lba,
+                     PH_FORGET_VERIFIED | PH_READ_VERIFY_CACHE | PH_TMP_BUFFER);
         }
     }
 #else
@@ -775,7 +775,7 @@ UDFCheckArea(
     buff = (uint8*)DbgAllocatePoolWithTag(NonPagedPool, Vcb->WriteBlockSize, 'bNWD' );
     if(buff) {
         for(i=0; i<BCount; i+=d) {
-            if(!(LBA+i & (PS-1)) &&
+            if(!((LBA+i) & (PS-1)) &&
                (i+PS <= BCount)) {
                 d = PS;
             } else {
@@ -821,7 +821,7 @@ UDFRemapPacket(
         BS = Vcb->SparingBlockSize;
 
         // use sparing table for relocation
-        if(Vcb->SparingCountFree == -1) {
+        if(Vcb->SparingCountFree == (ULONG)-1) {
             KdPrint(("calculate free spare areas\n"));
 re_check:
             KdPrint(("verify spare area\n"));
index d16e0f2..73e9b72 100644 (file)
@@ -356,11 +356,15 @@ UDFUnicodeInString(
     Decides whether character passed is an illegal character for a
     DOS file name.
 */
+#ifdef _MSC_VER
 #pragma warning(push)               
 #pragma warning(disable:4035)               // re-enable below
+#endif
 
 #ifdef _X86_
+#ifdef _MSC_VER
 __declspec (naked)
+#endif
 #endif // _X86_
 BOOLEAN
 __fastcall
@@ -398,7 +402,9 @@ ERR_IIC2:
 #endif // _X86_
 } // end UDFIsIllegalChar()
 
+#ifdef _MSC_VER
 #pragma warning(pop)  // re-enable warning #4035
+#endif
 
 /*
     Translate udfName to dosName using OSTA compliant.
@@ -881,7 +887,7 @@ UDFDOSName201(
     /* If the name has illegal characters or and extension, it */
     /* is not a DOS device name. */
 
-/*    if (needsCRC == FALSE && extLen == 0) {
+/*    if (needsCRC == FALSE && extLen == 0) { */
         /* If this is the name of a DOS device, a CRC code should */
         /* be appended to the file name. 
         if (IsDeviceName(udfName, udfLen))
@@ -976,7 +982,7 @@ UDFBuildFileEntry(
 {
     PFILE_ENTRY FileEntry;
     OSSTATUS status;
-    EntityID* eID;
+//    EntityID* eID;
     uint32 l;
     EXTENT_INFO _FEExtInfo;
     uint16* lcp;
@@ -1021,11 +1027,11 @@ UDFBuildFileEntry(
     FileEntry->gid = Vcb->DefaultGID;
 
     if(Extended) {
-        eID = &(((PEXTENDED_FILE_ENTRY)FileEntry)->impIdent);
+//        eID = &(((PEXTENDED_FILE_ENTRY)FileEntry)->impIdent);
         lcp = &(((PEXTENDED_FILE_ENTRY)FileEntry)->fileLinkCount);
         ((PEXTENDED_FILE_ENTRY)FileEntry)->checkpoint = 1;
     } else {
-        eID = &(FileEntry->impIdent);
+//        eID = &(FileEntry->impIdent);
         lcp = &(FileEntry->fileLinkCount);
         ((PFILE_ENTRY)FileEntry)->checkpoint = 1;
     }
@@ -1523,7 +1529,7 @@ UDFChangeFileCounter(
     counter = FileCounter ?
         &(Vcb->numFiles) :
         &(Vcb->numDirs);
-    if(*counter == -1)
+    if(*counter == (ULONG)-1)
         return;
     if(Increase) {
         UDFInterlockedIncrement((int32*)counter);
@@ -1950,13 +1956,13 @@ UDFUnlinkAllFilesInDir(
 
     hCurDirNdx = DirInfo->Dloc->DirIndex;
     // check if we can delete all files
-    for(i=2; CurDirNdx = UDFDirIndex(hCurDirNdx,i); i++) {
+    for(i=2; (CurDirNdx = UDFDirIndex(hCurDirNdx,i)); i++) {
         // try to open Stream
         if(CurDirNdx->FileInfo)
             return STATUS_CANNOT_DELETE;
     }
     // start deletion
-    for(i=2; CurDirNdx = UDFDirIndex(hCurDirNdx,i); i++) {
+    for(i=2; (CurDirNdx = UDFDirIndex(hCurDirNdx,i)); i++) {
         // try to open Stream
         status = UDFOpenFile__(Vcb, FALSE, TRUE, NULL, DirInfo, &FileInfo, &i);
         if(status == STATUS_FILE_DELETED) {
@@ -2030,7 +2036,7 @@ UDFOpenFile__(
     // some routines may send invalid Index
     if(!(DirNdx = UDFDirIndex(hDirNdx,i)))
         return STATUS_OBJECT_NAME_NOT_FOUND;
-    if(FileInfo = DirNdx->FileInfo) {
+    if((FileInfo = DirNdx->FileInfo)) {
         // file is already opened.
         if((DirNdx->FileCharacteristics & FILE_DELETED) && NotDeleted) {
             AdPrint(("  FILE_DELETED on open\n"));
@@ -2307,7 +2313,7 @@ UDFCleanUpFile__(
 
     IsASDir = UDFIsAStreamDir(FileInfo);
 
-    if(Dloc = FileInfo->Dloc) {
+    if((Dloc = FileInfo->Dloc)) {
 
 #ifdef UDF_DBG
         DirInfo = FileInfo->ParentFile;
@@ -2349,7 +2355,7 @@ UDFCleanUpFile__(
 
         if(Dloc->DirIndex) {
             uint_di i;
-            for(i=2; DirNdx = UDFDirIndex(Dloc->DirIndex,i); i++) {
+            for(i=2; (DirNdx = UDFDirIndex(Dloc->DirIndex,i)); i++) {
                 if(DirNdx->FileInfo) {
                     if(!KeepDloc) {
                         BrutePoint();
@@ -2433,7 +2439,7 @@ UDFCleanUpFile__(
 #endif //UDF_TRACK_ONDISK_ALLOCATION
             if(FileInfo->Dloc->DirIndex) {
                 uint_di i;
-                for(i=2; DirNdx = UDFDirIndex(Dloc->DirIndex,i); i++) {
+                for(i=2; (DirNdx = UDFDirIndex(Dloc->DirIndex,i)); i++) {
                     ASSERT(!DirNdx->FileInfo);
                     if(DirNdx->FName.Buffer)
                         MyFreePool__(DirNdx->FName.Buffer);
@@ -2736,7 +2742,7 @@ CreateUndel:
 #endif // UDF_LIMIT_DIR_SIZE
             // search for suitable unused entry
             if(UDFDirIndexInitScan(DirInfo, &ScanContext, 2)) {
-                while(DirNdx = UDFDirIndexScan(&ScanContext, NULL)) {
+                while((DirNdx = UDFDirIndexScan(&ScanContext, NULL))) {
                     if((DirNdx->Length == l) && UDFIsDeleted(DirNdx) &&
                        !DirNdx->FileInfo ) {
                         // free unicode-buffer with old name
@@ -2773,7 +2779,7 @@ CreateUndel:
             DirNdx->Offset = 0;
         }
         // new terminator is recorded by UDFDirIndexGrow()
-        if( ((d = (LBS - (DirNdx->Offset + l + DirInfo->Dloc->DataLoc.Offset) & (LBS-1) )) < sizeof(FILE_IDENT_DESC)) &&
+        if( ((d = ((LBS - (DirNdx->Offset + l + DirInfo->Dloc->DataLoc.Offset)) & (LBS-1) )) < sizeof(FILE_IDENT_DESC)) &&
               d ) {
             // insufficient space at the end of last sector for
             // next FileIdent's tag. fill it with ImpUse data
@@ -4269,8 +4275,10 @@ UDFCompareFileInfo(
     This routine computes 32-bit hash based on CRC-32 from SSH
  */
 
+#ifdef _MSC_VER
 #pragma warning(push)               
 #pragma warning(disable:4035)               // re-enable below
+#endif
 
 //#ifdef _X86_
 #ifdef _MSC_VER
@@ -4573,7 +4581,9 @@ EO_CRC:
 
 } // end UDFCrc()
 
+#ifdef _MSC_VER
 #pragma warning(pop)    // re-enable warning #4035
+#endif
 
 /*
     Read the first block of a tagged descriptor & check it.
index 51a17b8..3031c1f 100644 (file)
@@ -423,8 +423,8 @@ typedef struct _FE_LIST_ENTRY {
 #define UNICODE_PERIOD    0x002E
 #define UNICODE_SPACE     0x0020
 
-#define LBA_OUT_OF_EXTENT       ((LONG)(-1))
-#define LBA_NOT_ALLOCATED       ((LONG)(-2))
+#define LBA_OUT_OF_EXTENT       ((ULONG)(-1))
+#define LBA_NOT_ALLOCATED       ((ULONG)(-2))
 
 typedef struct _EXT_RELOCATION_ENTRY {
     uint32 extLength;
index adcc7ac..627d40b 100644 (file)
@@ -169,17 +169,9 @@ DriverEntry(
 
             RegTGetKeyHandle(NULL, UDFGlobalData.SavedRegPath.Buffer, &hUdfRootKey);
 
-            UDFGlobalData.UnicodeStrRoot.Buffer = L"\\"; //(PWCHAR)&(UDFGlobalData.UnicodeStrRootBuffer);
-            UDFGlobalData.UnicodeStrRoot.Length = sizeof(WCHAR);
-            UDFGlobalData.UnicodeStrRoot.MaximumLength = 2*sizeof(WCHAR);
-
-            UDFGlobalData.UnicodeStrSDir.Buffer = L":";
-            UDFGlobalData.UnicodeStrSDir.Length = sizeof(WCHAR);
-            UDFGlobalData.UnicodeStrSDir.MaximumLength = 2*sizeof(WCHAR);
-
-            UDFGlobalData.AclName.Buffer = UDF_SN_NT_ACL;
-            UDFGlobalData.AclName.Length =
-            (UDFGlobalData.AclName.MaximumLength = sizeof(UDF_SN_NT_ACL)) - sizeof(WCHAR);
+            RtlInitUnicodeString(&UDFGlobalData.UnicodeStrRoot, L"\\");
+            RtlInitUnicodeString(&UDFGlobalData.UnicodeStrSDir, L":");
+            RtlInitUnicodeString(&UDFGlobalData.AclName, UDF_SN_NT_ACL);
 
             KdPrint(("UDF: Init delayed close queues\n"));
 #ifdef UDF_DELAYED_CLOSE
@@ -214,7 +206,7 @@ DriverEntry(
             // create a device object representing the driver itself
             //  so that requests can be targeted to the driver ...
             //  e.g. for a disk-based FSD, "mount" requests will be sent to
-            //        this device object by the I/O Manager.\
+            //        this device object by the I/O Manager.
             //        For a redirector/server, you may have applications
             //        send "special" IOCTL's using this device object ...
 
@@ -689,13 +681,13 @@ UDFDismountDevice(
             DbgCompareMemory(&Buffer->FileSystemName[0],name  , sizeof(name)) == sizeof(name))
                     
         if (NT_SUCCESS(RC) &&
-           (UDF_CHECK_FS_NAME(UDF_FS_TITLE_CDR)    ||
-            UDF_CHECK_FS_NAME(UDF_FS_TITLE_CDRW)   ||
-            UDF_CHECK_FS_NAME(UDF_FS_TITLE_DVDR)   ||
-            UDF_CHECK_FS_NAME(UDF_FS_TITLE_DVDRW)  ||
-            UDF_CHECK_FS_NAME(UDF_FS_TITLE_DVDpR)  ||
-            UDF_CHECK_FS_NAME(UDF_FS_TITLE_DVDpRW) ||
-            UDF_CHECK_FS_NAME(UDF_FS_TITLE_DVDRAM) )) try_return(STATUS_SUCCESS);
+           (UDF_CHECK_FS_NAME((PVOID)UDF_FS_TITLE_CDR)    ||
+            UDF_CHECK_FS_NAME((PVOID)UDF_FS_TITLE_CDRW)   ||
+            UDF_CHECK_FS_NAME((PVOID)UDF_FS_TITLE_DVDR)   ||
+            UDF_CHECK_FS_NAME((PVOID)UDF_FS_TITLE_DVDRW)  ||
+            UDF_CHECK_FS_NAME((PVOID)UDF_FS_TITLE_DVDpR)  ||
+            UDF_CHECK_FS_NAME((PVOID)UDF_FS_TITLE_DVDpRW) ||
+            UDF_CHECK_FS_NAME((PVOID)UDF_FS_TITLE_DVDRAM) )) try_return(STATUS_SUCCESS);
         
         KdPrint(("\n*** UDFDismountDevice: LockVolume\n"));
         RC = ZwFsControlFile(NtFileHandle,
@@ -874,6 +866,7 @@ UDFRemountAll(
     UNICODE_STRING  unicodeCdRomDeviceName;
     LARGE_INTEGER   delay;
 
+*/
 /*    delay.QuadPart = -80*10000000;
     KeDelayExecutionThread(KernelMode, FALSE, &delay);        //10 seconds*/
     
index 5ff1cc7..bf9ca46 100644 (file)
@@ -493,11 +493,10 @@ UDFQueryFsAttributeInfo(
     ULONG BytesToCopy;
 
     NTSTATUS Status = STATUS_SUCCESS;
-    PWCHAR FsTypeTitle;
+    PCWSTR FsTypeTitle;
     ULONG FsTypeTitleLen;
 
     PAGED_CODE();
-
     KdPrint(("  UDFQueryFsAttributeInfo: \n"));
     //  Fill out the fixed portion of the buffer.
     Buffer->FileSystemAttributes = FILE_CASE_SENSITIVE_SEARCH |