~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to lib/dnd/dndCommon.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-07-30 12:56:49 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730125649-97sfj5li8axiseoo
Tags: 2009.07.22-179896-2
* Temporarily building without dumbnet, the recently uploaded
  new dumbnet upstream version broke down (Closes: #539006).
* Using more common name to store local debian additions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
342
342
    * assume that the components are delimited with single NUL characters; if
343
343
    * that is not true, CPName_GetComponent() will fail.
344
344
    */
 
345
 
345
346
   for (begin = *src; *begin == '\0'; begin++)
346
347
      ;
347
348
   end = CPNameUtil_Strrchr(*src, *srcSize, '\0');
352
353
      int escapedLen;
353
354
 
354
355
      if (len < 0) {
355
 
         Log("DnDPrependFileRoot: error getting next component\n");
 
356
         Log("%s: error getting next component\n", __FUNCTION__);
356
357
         if (!firstPass) {
357
358
            free(newData);
358
359
         }
 
360
 
359
361
         return FALSE;
360
362
      }
361
363
 
363
365
       * Append this component to our list: allocate one more for NUL on first
364
366
       * pass and delimiter on all other passes.
365
367
       */
 
368
 
366
369
      escapedLen = HgfsEscape_GetSize(begin, len);
367
370
      if (0 == escapedLen) {
368
371
         newDataLen += rootLen + len + 1;
474
477
   memcpy(fullName + partialNameLen + partialNameSuffixLen, nameIn, nameSize);
475
478
   fullName[fullNameSize] = '\0';
476
479
 
477
 
   LOG(4, ("DnD_LegacyConvertToCPName: generated name is \"%s\"\n", fullName));
 
480
   LOG(4, ("%s: generated name is \"%s\"\n", __FUNCTION__, fullName));
478
481
 
479
482
   /*
480
483
    * CPName_ConvertTo implementation is performed here without calling any
481
484
    * CPName_ functions.  This is safer since those functions might change, but
482
485
    * the legacy behavior we are special casing here will not.
483
486
    */
 
487
 
484
488
   {
485
489
      char const *winNameIn = fullName;
486
490
      char const *origOut = bufOut;
497
501
       * Copy the string to the output buf, converting all path separators into
498
502
       * '\0' and ignoring the specified characters.
499
503
       */
 
504
 
500
505
      for (; *winNameIn != '\0' && bufOut < endOut; winNameIn++) {
501
506
         if (ignores) {
502
507
            char *currIgnore = ignores;
526
531
       * When we get rid of NUL termination here, this test should
527
532
       * also change to "if (*winNameIn != '\0')".
528
533
       */
 
534
 
529
535
      if (bufOut == endOut) {
530
536
         result = -1;
531
537
         goto out;
541
547
         result--;
542
548
      }
543
549
 
544
 
      /* Make exception and call CPName_Print() here, since it's only for logging */
545
 
      LOG(4, ("DnD_LegacyConvertToCPName: CPName is \"%s\"\n",
 
550
      /*
 
551
       * Make exception and call CPName_Print() here, since it's only for
 
552
       * logging
 
553
       */
 
554
 
 
555
      LOG(4, ("%s: CPName is \"%s\"\n", __FUNCTION__, 
546
556
              CPName_Print(origOut, result)));
547
557
   }
548
558
 
549
559
out:
550
560
   free(fullName);
 
561
 
551
562
   return result;
552
563
}
553
564