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

« back to all changes in this revision

Viewing changes to lib/include/unicodeOperations.h

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2008-08-15 21:21:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080815212140-05fhxj8wroosysmj
Tags: 2008.08.08-109361-1ubuntu1
* Merge from Debian unstable (LP: #258393), remaining Ubuntu change:
  - add ubuntu_toolchain_FTBFS.dpatch patch, fix FTBFS
* Update ubuntu_toolchain_FTBFS.dpatch patch for the new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
/*
278
278
 *-----------------------------------------------------------------------------
279
279
 *
 
280
 * UnicodeEndsWith --
280
281
 * Unicode_EndsWith --
 
282
 * Unicode_EndsWithIgnoreCase --
281
283
 *
282
284
 *      Tests if 'str' ends with 'suffix'.
283
285
 *
291
293
 */
292
294
 
293
295
static INLINE Bool
294
 
Unicode_EndsWith(ConstUnicode str,    // IN
295
 
                 ConstUnicode suffix) // IN
 
296
UnicodeEndsWith(ConstUnicode str,    // IN
 
297
                ConstUnicode suffix, // IN
 
298
                Bool ignoreCase)     // IN
296
299
{
297
 
#ifdef SUPPORT_UNICODE_OPAQUE
298
300
   UnicodeIndex strLength = Unicode_LengthInCodeUnits(str);
299
301
   UnicodeIndex suffixLength = Unicode_LengthInCodeUnits(suffix);
300
302
   UnicodeIndex offset = strLength - suffixLength;
312
314
                               suffix,
313
315
                               0,
314
316
                               suffixLength,
315
 
                               FALSE) == 0;
316
 
#else
317
 
   size_t strLength = strlen(str);
318
 
   size_t suffixLength = strlen(suffix);
319
 
 
320
 
   if (suffixLength > strLength) {
321
 
      return FALSE;
322
 
   }
323
 
   return strcmp(str + strLength - suffixLength, suffix) == 0;
324
 
#endif
 
317
                               ignoreCase) == 0;
 
318
}
 
319
 
 
320
 
 
321
static INLINE Bool
 
322
Unicode_EndsWith(ConstUnicode str,    // IN
 
323
                 ConstUnicode suffix) // IN
 
324
{
 
325
   return UnicodeEndsWith(str, suffix, FALSE);
 
326
}
 
327
 
 
328
 
 
329
static INLINE Bool
 
330
Unicode_EndsWithIgnoreCase(ConstUnicode str,    // IN
 
331
                           ConstUnicode suffix) // IN
 
332
{
 
333
   return UnicodeEndsWith(str, suffix, TRUE);
325
334
}
326
335
 
327
336
 
645
654
                    UnicodeIndex start,
646
655
                    UnicodeIndex length)
647
656
{
648
 
   return Unicode_ReplaceRange(destination, start, length, U(""), 0, 0);
 
657
   return Unicode_ReplaceRange(destination, start, length, "", 0, 0);
649
658
}
650
659
 
651
660
 
686
695
/*
687
696
 *-----------------------------------------------------------------------------
688
697
 *
 
698
 * UnicodeStartsWith --
689
699
 * Unicode_StartsWith --
 
700
 * Unicode_StartsWithIgnoreCase --
690
701
 *
691
702
 *      Tests if 'str' starts with 'prefix'.
692
703
 *
700
711
 */
701
712
 
702
713
static INLINE Bool
703
 
Unicode_StartsWith(ConstUnicode str,    // IN
704
 
                   ConstUnicode prefix) // IN
 
714
UnicodeStartsWith(ConstUnicode str,    // IN
 
715
                  ConstUnicode prefix, // IN
 
716
                  Bool ignoreCase)     // IN
705
717
{
706
 
#ifdef SUPPORT_UNICODE_OPAQUE
707
718
   UnicodeIndex strLength = Unicode_LengthInCodeUnits(str);
708
719
   UnicodeIndex prefixLength = Unicode_LengthInCodeUnits(prefix);
709
720
 
720
731
                               prefix,
721
732
                               0,
722
733
                               prefixLength,
723
 
                               FALSE) == 0;
724
 
#else
725
 
   return strncmp(str, prefix, strlen(prefix)) == 0;
726
 
#endif
 
734
                               ignoreCase) == 0;
 
735
}
 
736
 
 
737
 
 
738
static INLINE Bool
 
739
Unicode_StartsWith(ConstUnicode str,    // IN
 
740
                   ConstUnicode prefix) // IN
 
741
{
 
742
   return UnicodeStartsWith(str, prefix, FALSE);
 
743
}
 
744
 
 
745
 
 
746
static INLINE Bool
 
747
Unicode_StartsWithIgnoreCase(ConstUnicode str,    // IN
 
748
                             ConstUnicode prefix) // IN
 
749
{
 
750
   return UnicodeStartsWith(str, prefix, TRUE);
727
751
}
728
752
 
729
753