~ubuntu-branches/ubuntu/oneiric/open-vm-tools/oneiric

« back to all changes in this revision

Viewing changes to lib/hgfs/cpName.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-10-18 12:28:19 UTC
  • mfrom: (1.1.7 upstream) (2.4.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091018122819-00vqew6m0ztpqcqp
Tags: 2009.10.15-201664-1
MergingĀ upstreamĀ versionĀ 2009.10.15-201664.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
         }
102
102
 
103
103
         myNext = walk + 1;
 
104
         /* Skip consecutive path delimiters. */
 
105
         while ((*myNext == '\0') && (myNext != end)) {
 
106
            myNext++;
 
107
         }
104
108
         if (myNext == end) {
105
109
            /* Last character in the buffer is not allowed to be NUL */
 
110
            Log("%s: error: last char can't be NUL\n", __FUNCTION__);
106
111
            return -1;
107
112
         }
108
113
 
113
118
   len = walk - begin;
114
119
 
115
120
   *next = myNext;
116
 
   return ((int) len);
 
121
   return (int) len;
117
122
}
118
123
 
119
124
 
149
154
                           char pathSep)       // IN: Path separator character
150
155
{
151
156
   int result;
152
 
   size_t inputSize;
 
157
   int inputSize;
153
158
   inputSize = HgfsEscape_GetSize(*bufIn, *inSize);
154
 
   if (inputSize != 0) {
 
159
   if (inputSize < 0) {
 
160
      result = -1;
 
161
   } else if (inputSize != 0) {
155
162
      char *savedBufOut = *bufOut;
156
163
      char const *savedOutConst = savedBufOut;
157
164
      size_t savedOutSize = *outSize;
429
436
      nameIn++;
430
437
   }
431
438
 
432
 
    /* Copy the string to the output buf, converting all path separators into '\0'. */
433
 
   for (; *nameIn != '\0' && bufOut < endOut; nameIn++) {
434
 
      *bufOut = (*nameIn == pathSep) ? '\0' : *nameIn;
 
439
    /*
 
440
     * Copy the string to the output buf, converting all path separators into '\0'.
 
441
     * Collapse multiple consecutive path separators into a single one since
 
442
     * CPName_GetComponent can't handle consecutive path separators.
 
443
     */
 
444
   while (*nameIn != '\0' && bufOut < endOut) {
 
445
      if (*nameIn == pathSep) {
 
446
         *bufOut = '\0';
 
447
         do {
 
448
            nameIn++;
 
449
         } while (*nameIn == pathSep);
 
450
      } else {
 
451
         *bufOut = *nameIn;
 
452
         nameIn++;
 
453
      }
435
454
      bufOut++;
436
455
   }
437
456