]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
HGFS: cleanup of server request packets handlers, part III
authorVMware, Inc <>
Fri, 12 Apr 2013 19:43:53 +0000 (12:43 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Wed, 17 Apr 2013 19:16:52 +0000 (12:16 -0700)
Pushing the const usage further along the call chain now into the
platform specific handlers.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/hgfsServer/hgfsServer.c
open-vm-tools/lib/hgfsServer/hgfsServerInt.h
open-vm-tools/lib/hgfsServer/hgfsServerLinux.c

index f74442be76e6773769e100d58323dbdc6a01eea1..47cd1b2dc16f23708067d241543bcfe3484bbbab 100644 (file)
@@ -4610,8 +4610,8 @@ HgfsServerGetLocalNameInfo(const char *cpName,      // IN:  Cross-platform filen
                            size_t *outLen)          // OUT: Length of name out optional
 {
    HgfsNameStatus nameStatus;
-   char const *inEnd;
-   char *next;
+   const char *inEnd;
+   const char *next;
    char *myBufOut;
    char *convertedMyBufOut;
    char *out;
@@ -4639,7 +4639,7 @@ HgfsServerGetLocalNameInfo(const char *cpName,      // IN:  Cross-platform filen
    /*
     * Get first component.
     */
-   len = CPName_GetComponent(cpName, inEnd, (char const **) &next);
+   len = CPName_GetComponent(cpName, inEnd, &next);
    if (len < 0) {
       LOG(4, ("%s: get first component failed\n", __FUNCTION__));
 
@@ -5995,7 +5995,7 @@ HgfsServerSearchOpen(HgfsInputParam *input)  // IN: Input params
                                    &dirName, &dirNameLength, &caseFlags)) {
       nameStatus = HgfsServerGetLocalNameInfo(dirName, dirNameLength, caseFlags,
                                               &shareInfo, &baseDir, &baseDirLen);
-      status = HgfsPlatformSearchDir(nameStatus, (char *)dirName, dirNameLength, caseFlags,
+      status = HgfsPlatformSearchDir(nameStatus, dirName, dirNameLength, caseFlags,
                                      &shareInfo, baseDir, baseDirLen,
                                      input->session, &search);
       if (HGFS_ERROR_SUCCESS == status) {
index fa4783cbb13cda0543bdabe520fe5f454fa2c2aa..cb57e4f5050e0847f5d70f457461cf001abdd1b8 100644 (file)
@@ -789,7 +789,7 @@ HgfsPlatformScanvdir(HgfsGetNameFunc enumNamesGet,     // IN: Function to get na
                      uint32 *numDents);                // OUT: total number of directory entrys
 HgfsInternalStatus
 HgfsPlatformSearchDir(HgfsNameStatus nameStatus,       // IN: name status
-                      char *dirName,                   // IN: relative directory name
+                      const char *dirName,             // IN: relative directory name
                       uint32 dirNameLength,            // IN: length of dirName
                       uint32 caseFlags,                // IN: case flags
                       HgfsShareInfo *shareInfo,        // IN: sharfed folder information
index 0a26f05235b920edf65d8d8f10e4956a95c06b22..0d55a8e92174b4771eb4c46df598b74b28ac25b3 100644 (file)
@@ -4225,7 +4225,7 @@ HgfsPlatformWriteFile(HgfsHandle file,             // IN: Hgfs file handle
 
 HgfsInternalStatus
 HgfsPlatformSearchDir(HgfsNameStatus nameStatus,       // IN: name status
-                      char *dirName,                   // IN: relative directory name
+                      const char *dirName,             // IN: relative directory name
                       uint32 dirNameLength,            // IN: length of dirName
                       uint32 caseFlags,                // IN: case flags
                       HgfsShareInfo *shareInfo,        // IN: sharfed folder information
@@ -4238,8 +4238,8 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus,       // IN: name status
    switch (nameStatus) {
    case HGFS_NAME_STATUS_COMPLETE:
    {
-      char *inEnd;
-      char *next;
+      const char *inEnd;
+      const char *next;
       int len;
 
       ASSERT(baseDir);
@@ -4249,16 +4249,17 @@ HgfsPlatformSearchDir(HgfsNameStatus nameStatus,       // IN: name status
       inEnd = dirName + dirNameLength;
 
       /* Get the first component. */
-      len = CPName_GetComponent(dirName, inEnd, (char const **) &next);
+      len = CPName_GetComponent(dirName, inEnd, &next);
       if (len >= 0) {
          if (*inEnd != '\0') {
+            LOG(4, ("%s: dir name not nul-terminated!\n", __FUNCTION__));
             /*
              * NT4 clients can send the name without a nul-terminator.
-             * The space for the  nul is included and tested for in the size
+             * The space for the nul is included and tested for in the size
              * calculations above. Size of structure (includes a single
              * character of the name) and the full dirname length.
              */
-            *inEnd = '\0';
+            *(char *)inEnd = '\0';
          }
 
          LOG(4, ("%s: dirName: %s.\n", __FUNCTION__, dirName));