From: VMware, Inc <> Date: Fri, 12 Apr 2013 19:43:53 +0000 (-0700) Subject: HGFS: cleanup of server request packets handlers, part III X-Git-Tag: 2013.04.16-1098359~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3cdd4ebc8c63522c4b147f1127eec1afcab9ac30;p=thirdparty%2Fopen-vm-tools.git HGFS: cleanup of server request packets handlers, part III Pushing the const usage further along the call chain now into the platform specific handlers. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index f74442be7..47cd1b2dc 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -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) { diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerInt.h b/open-vm-tools/lib/hgfsServer/hgfsServerInt.h index fa4783cbb..cb57e4f50 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerInt.h +++ b/open-vm-tools/lib/hgfsServer/hgfsServerInt.h @@ -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 diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c index 0a26f0523..0d55a8e92 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c @@ -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));