Author: hbelusca
Date: Sun Feb 2 16:59:03 2014
New Revision: 61923
URL:
http://svn.reactos.org/svn/reactos?rev=61923&view=rev
Log:
[CMLIB]
Use a #define instead of the magic 31.
Modified:
trunk/reactos/lib/cmlib/hivedata.h
trunk/reactos/lib/cmlib/hiveinit.c
Modified: trunk/reactos/lib/cmlib/hivedata.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivedata.h?rev=6…
==============================================================================
--- trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] Sun Feb 2 16:59:03 2014
@@ -107,6 +107,8 @@
* On-disk header for registry hive file.
*/
+#define HIVE_FILENAME_MAXLEN 31
+
typedef struct _HBASE_BLOCK
{
/* Hive identifier "regf" (0x66676572) */
@@ -146,7 +148,7 @@
/* Last 31 UNICODE characters, plus terminating NULL character,
of the full name of the hive file */
- WCHAR FileName[32];
+ WCHAR FileName[HIVE_FILENAME_MAXLEN + 1];
ULONG Reserved1[99];
Modified: trunk/reactos/lib/cmlib/hiveinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hiveinit.c?rev=6…
==============================================================================
--- trunk/reactos/lib/cmlib/hiveinit.c [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hiveinit.c [iso-8859-1] Sun Feb 2 16:59:03 2014
@@ -118,7 +118,7 @@
/* Copy the 31 last characters of the hive file name if any */
if (FileName)
{
- if (FileName->Length / sizeof(WCHAR) <= 31)
+ if (FileName->Length / sizeof(WCHAR) <= HIVE_FILENAME_MAXLEN)
{
RtlCopyMemory(BaseBlock->FileName,
FileName->Buffer,
@@ -127,12 +127,13 @@
else
{
RtlCopyMemory(BaseBlock->FileName,
- FileName->Buffer + FileName->Length / sizeof(WCHAR) - 31,
- 31 * sizeof(WCHAR));
+ FileName->Buffer +
+ FileName->Length / sizeof(WCHAR) - HIVE_FILENAME_MAXLEN,
+ HIVE_FILENAME_MAXLEN * sizeof(WCHAR));
}
/* NULL-terminate */
- BaseBlock->FileName[31] = L'\0';
+ BaseBlock->FileName[HIVE_FILENAME_MAXLEN] = L'\0';
}
BaseBlock->CheckSum = HvpHiveHeaderChecksum(BaseBlock);