ReactOS 0.4.16-dev-927-g467dec4
mbsinc.cpp
Go to the documentation of this file.
1/***
2*mbsinc.c - Move MBCS string pointer ahead one charcter.
3*
4* Copyright (c) Microsoft Corporation. All rights reserved.
5*
6*Purpose:
7* Move MBCS string pointer ahead one character.
8*
9*******************************************************************************/
10#ifndef _MBCS
11 #error This file should only be compiled with _MBCS defined
12#endif
13
14#include <corecrt_internal.h>
16#include <stddef.h>
17
18#pragma warning(disable:__WARNING_POTENTIAL_BUFFER_OVERFLOW_NULLTERMINATED) // 26018
19
20/***
21*_mbsinc - Move MBCS string pointer ahead one charcter.
22*
23*Purpose:
24* Move the supplied string pointer ahead by one
25* character. MBCS characters are handled correctly.
26*
27*Entry:
28* const unsigned char *current = current char pointer (legal MBCS boundary)
29*
30*Exit:
31* Returns pointer after moving it.
32*
33*Exceptions:
34* Input parameters are validated. Refer to the validation section of the function.
35*
36*******************************************************************************/
37
38extern "C" unsigned char * __cdecl _mbsinc_l(
39 const unsigned char *current,
41 )
42{
43 if ( (_ismbblead_l)(*(current++),plocinfo))
44 {
45 /* don't move forward two if we get leadbyte, EOS
46 also don't assert here as we are too low level
47 */
48 if(*current!='\0')
49 {
50 current++;
51 }
52 }
53
54 return (unsigned char *)current;
55}
56
57extern "C" unsigned char * (__cdecl _mbsinc)(
58 const unsigned char *current
59 )
60{
61 /* validation section */
62 _VALIDATE_RETURN(current != nullptr, EINVAL, nullptr);
63
64 if ( _ismbblead(*(current++)))
65 {
66 /* don't move forward two if we get leadbyte, EOS
67 also don't assert here as we are too low level
68 */
69 if(*current!='\0')
70 {
71 current++;
72 }
73 }
74
75 return (unsigned char *)current;
76}
#define EINVAL
Definition: acclib.h:90
#define __cdecl
Definition: accygwin.h:79
#define _ismbblead_l(_c, p)
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
_locale_t plocinfo
Definition: ismbbyte.cpp:75
unsigned char *__cdecl _mbsinc(const unsigned char *current)
Definition: mbsinc.cpp:57
unsigned char *__cdecl _mbsinc_l(const unsigned char *current, _locale_t plocinfo)
Definition: mbsinc.cpp:38
struct task_struct * current
Definition: linux.c:32
int __cdecl _ismbblead(unsigned int)
Definition: ismblead.c:20