1 /******************************************************************************
2 *
3 * Copyright (C) 2009, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * Author: Alexey Krivonogov ( gentee )
11 *
12 ******************************************************************************/
13
14 #include "ged.h"
15
16 int cmpubyte( pubyte left, pubyte right, uint len )
17 {
18 if ( *left < *right ) return -1;
19 if ( *left > *right ) return 1;
20 return 0;
21 }
22
23 int cmpushort( pushort left, pushort right, uint len )
24 {
25 if ( *left < *right ) return -1;
26 if ( *left > *right ) return 1;
27 return 0;
28 }
29
30 int cmpuint( puint left, puint right, uint len )
31 {
32 if ( *left < *right ) return -1;
33 if ( *left > *right ) return 1;
34 return 0;
35 }
36
37 int cmpbyte( char* left, char* right, uint len )
38 {
39 if ( *left < *right ) return -1;
40 if ( *left > *right ) return 1;
41 return 0;
42 }
43
44 int cmpshort( pshort left, pshort right, uint len )
45 {
46 if ( *left < *right ) return -1;
47 if ( *left > *right ) return 1;
48 return 0;
49 }
50
51 int cmpint( pint left, pint right, uint len )
52 {
53 if ( *left < *right ) return -1;
54 if ( *left > *right ) return 1;
55 return 0;
56 }
57
58 int cmpstr( pubyte left, pubyte right, uint len )
59 {
60 int ret;
61
62 ret = CompareString( LOCALE_USER_DEFAULT, NORM_IGNORECASE,
63 left, len, right, len );
64 if ( ret == CSTR_LESS_THAN )
65 return -1;
66 if ( ret == CSTR_GREATER_THAN )
67 return 1;
68 return 0;
69 }
70
71 int cmpustr( pushort left, pushort right, uint len )
72 {
73 int ret;
74
75 ret = CompareStringW( LOCALE_USER_DEFAULT, NORM_IGNORECASE,
76 left, len, right, len );
77 if ( ret == CSTR_LESS_THAN )
78 return -1;
79 if ( ret == CSTR_GREATER_THAN )
80 return 1;
81 return 0;
82 }
Редактировать