Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.1 KiB

  1. /*****************************************************************/
  2. /** Microsoft Windows for Workgroups **/
  3. /** Copyright (C) Microsoft Corp., 1991-1992 **/
  4. /*****************************************************************/
  5. /*
  6. stricmp.cxx
  7. NLS/DBCS-aware string class: stricmp method
  8. This file contains the implementation of the stricmp method
  9. for the STRING class. It is separate so that clients of STRING which
  10. do not use this operator need not link to it.
  11. FILE HISTORY:
  12. beng 01/18/91 Separated from original monolithic .cxx
  13. beng 02/07/91 Uses lmui.hxx
  14. */
  15. #include "npcommon.h"
  16. extern "C"
  17. {
  18. #include <netlib.h>
  19. }
  20. #if defined(DEBUG)
  21. static const CHAR szFileName[] = __FILE__;
  22. #define _FILENAME_DEFINED_ONCE szFileName
  23. #endif
  24. #include <npassert.h>
  25. #include <npstring.h>
  26. /*******************************************************************
  27. NAME: NLS_STR::stricmp
  28. SYNOPSIS: Case insensitive string compare w/ optional indices
  29. ENTRY: nls - string against which to compare
  30. istrStart1 (optional) - index into "this"
  31. istrStart2 (optional) - index into "nls"
  32. RETURNS: As the C runtime "strcmp".
  33. NOTES: If either string is erroneous, return "match."
  34. This runs contrary to the eqop.
  35. Glock doesn't allow default parameters which require
  36. construction; hence this member is overloaded multiply.
  37. HISTORY:
  38. johnl 11/15/90 Written
  39. beng 07/23/91 Allow on erroneous strings;
  40. simplified CheckIstr
  41. ********************************************************************/
  42. INT NLS_STR::stricmp( const NLS_STR & nls ) const
  43. {
  44. if (QueryError() || !nls)
  45. return 0;
  46. return ::stricmpf( QueryPch(), nls.QueryPch() );
  47. }
  48. INT NLS_STR::stricmp(
  49. const NLS_STR & nls,
  50. const ISTR & istrStart1 ) const
  51. {
  52. if (QueryError() || !nls)
  53. return 0;
  54. CheckIstr( istrStart1 );
  55. return ::stricmpf( QueryPch(istrStart1), nls.QueryPch() );
  56. }
  57. INT NLS_STR::stricmp(
  58. const NLS_STR & nls,
  59. const ISTR & istrStart1,
  60. const ISTR & istrStart2 ) const
  61. {
  62. if (QueryError() || !nls)
  63. return 0;
  64. CheckIstr( istrStart1 );
  65. nls.CheckIstr( istrStart2 );
  66. return ::stricmpf( QueryPch(istrStart1), nls.QueryPch(istrStart2) );
  67. }