////////////////////////////////////////////////////////////////////
// Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
// All rights reserved
+// This file was released under the GPLv2 on June 2015.
////////////////////////////////////////////////////////////////////
/*
Module name:
return STATUS_SUCCESS;
} // UDFReadFileEntry()
-//#ifndef _X86_
-#ifndef _MSC_VER
+#if !defined (_X86_) || !defined (_MSC_VER)
/*
Decides if a Unicode character matches one of a list
of ASCII characters.
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
)
{
// Genuine illegal char's for DOS.
-//#ifdef _X86_
-#ifdef _MSC_VER
+#if defined (_X86_) && defined (_MSC_VER)
_asm {
push ebx
#endif // _X86_
} // end UDFIsIllegalChar()
+#ifdef _MSC_VER
#pragma warning(pop) // re-enable warning #4035
+#endif
/*
Translate udfName to dosName using OSTA compliant.
/* 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))
{
PFILE_ENTRY FileEntry;
OSSTATUS status;
- EntityID* eID;
+// EntityID* eID;
uint32 l;
EXTENT_INFO _FEExtInfo;
uint16* lcp;
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;
}
counter = FileCounter ?
&(Vcb->numFiles) :
&(Vcb->numDirs);
- if(*counter == -1)
+ if(*counter == (ULONG)-1)
return;
if(Increase) {
UDFInterlockedIncrement((int32*)counter);
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) {
// 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"));
IsASDir = UDFIsAStreamDir(FileInfo);
- if(Dloc = FileInfo->Dloc) {
+ if((Dloc = FileInfo->Dloc)) {
#ifdef UDF_DBG
DirInfo = FileInfo->ParentFile;
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();
if(!KeepDloc) {
+#ifdef UDF_DBG
ASSERT(!Modified);
+#endif
#ifndef UDF_TRACK_ONDISK_ALLOCATION
if(Dloc->DataLoc.Mapping) MyFreePool__(Dloc->DataLoc.Mapping);
#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);
#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
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
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
+#if defined (_X86_) && defined (_MSC_VER)
__declspec (naked)
#endif // _X86_
uint32
IN uint32 len // EDX
)
{
-//#ifdef _X86_
-#ifdef _MSC_VER
+#if defined (_X86_) && defined (_MSC_VER)
// uint32 _Size = len;
__asm {
The polynomial used is: x^16 + x^12 + x^15 + 1
*/
-//#ifdef _X86_
-#ifdef _MSC_VER
+#if defined (_X86_) && defined (_MSC_VER)
__declspec (naked)
#endif // _X86_
uint16
uint32 n // EDX
)
{
-//#ifdef _X86_
-#ifdef _MSC_VER
+#if defined (_X86_) && defined (_MSC_VER)
// uint32 _Size = n;
__asm {
#endif // _X86_
} // end UDFUnicodeCksum()
-//#ifdef _X86_
-#ifdef _MSC_VER
+#if defined (_X86_) && defined (_MSC_VER)
__declspec (naked)
#endif // _X86_
uint16
uint32 n // EDX
)
{
-//#ifdef _X86_
-#ifdef _MSC_VER
+#if defined (_X86_) && defined (_MSC_VER)
// uint32 _Size = n;
__asm {
The OSTA-UDF(tm) 1.50 standard states that using CRCs is mandatory.
The polynomial used is: x^16 + x^12 + x^15 + 1
*/
-//#ifdef _X86_
-#ifdef _MSC_VER
+#if defined (_X86_) && defined (_MSC_VER)
__declspec (naked)
#endif // _X86_
uint16
IN uint32 Size // EDX
)
{
-//#ifdef _X86_
-#ifdef _MSC_VER
+#if defined (_X86_) && defined (_MSC_VER)
// uint32 _Size = Size;
__asm {
} // end UDFCrc()
+#ifdef _MSC_VER
#pragma warning(pop) // re-enable warning #4035
+#endif
/*
Read the first block of a tagged descriptor & check it.