Author: cwittich
Date: Thu Feb 12 12:52:12 2009
New Revision: 39571
URL:
http://svn.reactos.org/svn/reactos?rev=39571&view=rev
Log:
-move FCB_TAG to header
-use ExAllocatePoolWithTag / ExFreePoolWithTag
-free the NameListResource when destroying an FCB
-get rid of CdfsWriteNumberInShortName
Modified:
trunk/reactos/drivers/filesystems/cdfs/cdfs.h
trunk/reactos/drivers/filesystems/cdfs/fcb.c
trunk/reactos/drivers/filesystems/cdfs/misc.c
Modified: trunk/reactos/drivers/filesystems/cdfs/cdfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/c…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/cdfs.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/cdfs.h [iso-8859-1] Thu Feb 12 12:52:12 2009
@@ -232,6 +232,7 @@
#endif
#define TAG_CCB TAG('I', 'C', 'C', 'B')
+#define TAG_FCB TAG('I', 'F', 'C', 'B')
typedef struct
{
Modified: trunk/reactos/drivers/filesystems/cdfs/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/fcb.c [iso-8859-1] Thu Feb 12 12:52:12 2009
@@ -35,8 +35,6 @@
/* FUNCTIONS ****************************************************************/
-#define TAG_FCB TAG('I', 'F', 'C', 'B')
-
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
@@ -114,10 +112,11 @@
{
Entry = Fcb->ShortNameList.Flink;
RemoveEntryList(Entry);
- ExFreePool(Entry);
- }
-
- ExFreePool(Fcb);
+ ExFreePoolWithTag(Entry, TAG_FCB);
+ }
+
+ ExDeleteResourceLite(&Fcb->NameListResource);
+ ExFreePoolWithTag(Fcb, TAG_FCB);
}
Modified: trunk/reactos/drivers/filesystems/cdfs/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/m…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/misc.c [iso-8859-1] Thu Feb 12 12:52:12 2009
@@ -95,21 +95,6 @@
((Fcb->Entry.FileFlags & FILE_FLAG_READONLY) ? FILE_ATTRIBUTE_READONLY :
0);
}
-/* Writes a number into a string, ending at the target position. */
-static PWCHAR
-CdfsWriteNumberInShortName
-(PWCHAR EndOfNumberTarget,
- ULONG Number)
-{
- while (Number)
- {
- *EndOfNumberTarget = '0' + (Number % 10);
- EndOfNumberTarget--;
- Number /= 10;
- }
- return EndOfNumberTarget;
-}
-
VOID
CdfsShortNameCacheGet
(PFCB DirectoryFcb,
@@ -118,11 +103,9 @@
PUNICODE_STRING ShortName)
{
BOOLEAN HasSpaces;
- PWCHAR LastDot, Scan;
- ULONG Number = 1;
PLIST_ENTRY Entry;
PCDFS_SHORT_NAME ShortNameEntry;
- GENERATE_NAME_CONTEXT Context = { };
+ GENERATE_NAME_CONTEXT Context = { 0 };
DPRINT("CdfsShortNameCacheGet(%I64u,%wZ)\n", StreamOffset->QuadPart,
LongName);
@@ -165,13 +148,6 @@
DPRINT("Initial Guess %wZ\n", ShortName);
- /* Find the part that'll be numberified */
- LastDot = &ShortName->Buffer[(ShortName->Length / sizeof(WCHAR)) - 1];
- for (Scan = ShortName->Buffer;
- Scan - ShortName->Buffer < ShortName->Length;
- Scan++)
- if (*Scan == '.') LastDot = Scan - 1;
-
/* Make it unique by scanning the cache and bumping */
/* Note that incrementing the ambiguous name is enough, since we add new
* entries at the tail. We'll scan over all collisions. */
@@ -186,14 +162,13 @@
&ShortNameEntry->Name,
TRUE) == 0) /* Match */
{
- Scan = CdfsWriteNumberInShortName(LastDot, ++Number);
- *Scan = '~';
+ RtlGenerate8dot3Name(LongName, FALSE, &Context, ShortName);
DPRINT("Collide; try %wZ\n", ShortName);
}
}
/* We've scanned over all entries and now have a unique one. Cache it. */
- ShortNameEntry = ExAllocatePool(PagedPool, sizeof(CDFS_SHORT_NAME));
+ ShortNameEntry = ExAllocatePoolWithTag(PagedPool, sizeof(CDFS_SHORT_NAME), TAG_FCB);
if (!ShortNameEntry)
{
/* We couldn't cache it, but we can return it. We run the risk of