ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

mbscoll.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:   See COPYING in the top level directory
00003  * PROJECT:     ReactOS system libraries
00004  * FILE:        lib/msvcrt/mbstring/mbscoll.c
00005  * PURPOSE:
00006  * PROGRAMER:   Ariadne
00007  * UPDATE HISTORY:
00008  *              12/04/99: Created
00009  */
00010 
00011 #include <mbstring.h>
00012 
00013 int colldif(unsigned short c1, unsigned short c2);
00014 
00015 /*
00016  * @implemented
00017  */
00018 int _mbscoll(const unsigned char *str1, const unsigned char *str2)
00019 {
00020     unsigned char *s1 = (unsigned char *)str1;
00021     unsigned char *s2 = (unsigned char *)str2;
00022 
00023     unsigned short *short_s1, *short_s2;
00024 
00025     int l1, l2;
00026 
00027     while ( *s1 != 0 ) {
00028 
00029         if (*s1 == 0)
00030             break;
00031 
00032         l1 = _ismbblead(*s1);
00033         l2 = _ismbblead(*s2);
00034         if ( !l1 &&  !l2  ) {
00035 
00036             if (*s1 != *s2)
00037                 return colldif(*s1, *s2);
00038             else {
00039                 s1 += 1;
00040                 s2 += 1;
00041             }
00042         }
00043         else if ( l1 && l2 ){
00044             short_s1 = (unsigned short *)s1;
00045             short_s2 = (unsigned short *)s2;
00046             if ( *short_s1 != *short_s2 )
00047                 return colldif(*short_s1, *short_s2);
00048             else {
00049                 s1 += 2;
00050                 s2 += 2;
00051 
00052             }
00053         }
00054         else
00055             return colldif(*s1, *s2);
00056     } ;
00057     return 0;
00058 }
00059 
00060 #if 0
00061 int _mbsbcoll(const unsigned char *str1, const unsigned char *str2)
00062 {
00063     unsigned char *s1 = (unsigned char *)str1;
00064     unsigned char *s2 = (unsigned char *)str2;
00065 
00066     unsigned short *short_s1, *short_s2;
00067 
00068     int l1, l2;
00069 
00070 
00071     while ( *s1 != 0 ) {
00072 
00073 
00074         l1 = _ismbblead(*s1);
00075         l2 = _ismbblead(*s2);
00076         if ( !l1 &&  !l2  ) {
00077 
00078             if (*s1 != *s2)
00079                 return colldif(*s1, *s2);
00080             else {
00081                 s1 += 1;
00082                 s2 += 1;
00083             }
00084         }
00085         else if ( l1 && l2 ){
00086             short_s1 = (unsigned short *)s1;
00087             short_s2 = (unsigned short *)s2;
00088             if ( *short_s1 != *short_s2 )
00089                 return colldif(*short_s1, *short_s2);
00090             else {
00091                 s1 += 2;
00092                 s2 += 2;
00093             }
00094         }
00095         else
00096             return colldif(*s1, *s2);
00097     } ;
00098     return 0;
00099 }
00100 #endif

Generated on Sat May 26 2012 04:35:27 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.