Nikolay Sivov : ole32: Simplify storage root entry name initialization.

Alexandre Julliard julliard at winehq.org
Fri Jul 13 14:11:19 CDT 2012


Module: wine
Branch: master
Commit: 08303391e91deefbf6785ca202d653f638910eb4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=08303391e91deefbf6785ca202d653f638910eb4

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Jul 13 12:01:53 2012 +0400

ole32: Simplify storage root entry name initialization.

---

 dlls/ole32/storage32.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 47341f7..584f492 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -65,8 +65,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage);
 static const BYTE STORAGE_magic[8]    ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
 static const BYTE STORAGE_oldmagic[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
 
-static const char rootEntryName[] = "Root Entry";
-
 /****************************************************************************
  * Storage32InternalImpl definitions.
  *
@@ -2874,21 +2872,21 @@ static HRESULT StorageImpl_Construct(
    */
   if (create)
   {
+    static const WCHAR rootentryW[] = {'R','o','o','t',' ','E','n','t','r','y',0};
     DirEntry rootEntry;
     /*
      * Initialize the directory table
      */
     memset(&rootEntry, 0, sizeof(rootEntry));
-    MultiByteToWideChar( CP_ACP, 0, rootEntryName, -1, rootEntry.name,
-                         sizeof(rootEntry.name)/sizeof(WCHAR) );
-    rootEntry.sizeOfNameString = (strlenW(rootEntry.name)+1) * sizeof(WCHAR);
+    strcpyW(rootEntry.name, rootentryW);
+    rootEntry.sizeOfNameString = sizeof(rootentryW);
     rootEntry.stgType          = STGTY_ROOT;
-    rootEntry.leftChild = DIRENTRY_NULL;
-    rootEntry.rightChild     = DIRENTRY_NULL;
+    rootEntry.leftChild        = DIRENTRY_NULL;
+    rootEntry.rightChild       = DIRENTRY_NULL;
     rootEntry.dirRootEntry     = DIRENTRY_NULL;
     rootEntry.startingBlock    = BLOCK_END_OF_CHAIN;
-    rootEntry.size.u.HighPart    = 0;
-    rootEntry.size.u.LowPart     = 0;
+    rootEntry.size.u.HighPart  = 0;
+    rootEntry.size.u.LowPart   = 0;
 
     StorageImpl_WriteDirEntry(This, 0, &rootEntry);
   }




More information about the wine-cvs mailing list