blob: c4f9a0d02b00759512c40df29a73e816a6a3ed0c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/***
*ismbslead.c - True _ismbslead function
*
* Copyright (c) 1987-1993, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Contains the function _ismbslead, which is a true context-sensitive
* MBCS lead-byte function. While much less efficient than _ismbblead,
* it is also much more sophisticated, in that it determines whether a
* given sub-string pointer points to a lead byte or not, taking into
* account the context in the string.
*
*Revision History:
*
* 08-03-93 KRS Ported from 16-bit tree.
*
*******************************************************************************/
#ifdef _MBCS
#include <cruntime.h>
#include <stddef.h>
#include <mbdata.h>
#include <mbctype.h>
#include <mbstring.h>
/***
* int _ismbslead(const unsigned char *string, const unsigned char *current);
*
*Purpose:
*
* _ismbslead - Check, in context, for MBCS lead byte
*
*Entry:
* unsigned char *string - ptr to start of string or previous known lead byte
* unsigned char *current - ptr to position in string to be tested
*
*Exit:
* TRUE : -1
* FALSE : 0
*
*Exceptions:
*
*******************************************************************************/
int _CRTAPI1 _ismbslead(const unsigned char *string, const unsigned char *current)
{
while (string <= current && *string) {
if (_ISLEADBYTE((*string))) {
if (string++ == current) /* check lead byte */
return -1;
if (!(*string))
return 0;
}
++string;
}
return 0;
}
#endif
|