Team Fortress 2 Source Code as on 22/4/2020
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.

53 lines
869 B

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. #include "pch_tier0.h"
  3. #include "tier0_strtools.h"
  4. #define TOLOWERC( x ) (( ( x >= 'A' ) && ( x <= 'Z' ) )?( x + 32 ) : x )
  5. extern "C"
  6. int V_tier0_stricmp(const char *s1, const char *s2 )
  7. {
  8. uint8 const *pS1 = ( uint8 const * ) s1;
  9. uint8 const *pS2 = ( uint8 const * ) s2;
  10. for(;;)
  11. {
  12. int c1 = *( pS1++ );
  13. int c2 = *( pS2++ );
  14. if ( c1 == c2 )
  15. {
  16. if ( !c1 ) return 0;
  17. }
  18. else
  19. {
  20. if ( ! c2 )
  21. {
  22. return c1 - c2;
  23. }
  24. c1 = TOLOWERC( c1 );
  25. c2 = TOLOWERC( c2 );
  26. if ( c1 != c2 )
  27. {
  28. return c1 - c2;
  29. }
  30. }
  31. c1 = *( pS1++ );
  32. c2 = *( pS2++ );
  33. if ( c1 == c2 )
  34. {
  35. if ( !c1 ) return 0;
  36. }
  37. else
  38. {
  39. if ( ! c2 )
  40. {
  41. return c1 - c2;
  42. }
  43. c1 = TOLOWERC( c1 );
  44. c2 = TOLOWERC( c2 );
  45. if ( c1 != c2 )
  46. {
  47. return c1 - c2;
  48. }
  49. }
  50. }
  51. }