mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:12:59 +00:00
[UCRT] Import Microsoft.Windows.SDK.CRTSource version 10.0.22621.3
Imported from https://www.nuget.org/packages/Microsoft.Windows.SDK.CRTSource/10.0.22621.3 License: MIT
This commit is contained in:
parent
f1b60c66f0
commit
04e0dc4a7a
568 changed files with 115483 additions and 0 deletions
76
sdk/lib/ucrt/mbstring/ismbsle.cpp
Normal file
76
sdk/lib/ucrt/mbstring/ismbsle.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
/***
|
||||
*ismbslead.c - True _ismbslead function
|
||||
*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
*******************************************************************************/
|
||||
#ifndef _MBCS
|
||||
#error This file should only be compiled with _MBCS defined
|
||||
#endif
|
||||
|
||||
#include <corecrt_internal_mbstring.h>
|
||||
#include <locale.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:
|
||||
* Input parameters are validated. Refer to the validation section of the function.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
extern "C" int __cdecl _ismbslead_l(
|
||||
const unsigned char *string,
|
||||
const unsigned char *current,
|
||||
_locale_t plocinfo
|
||||
)
|
||||
{
|
||||
/* validation section */
|
||||
_VALIDATE_RETURN(string != nullptr, EINVAL, 0);
|
||||
_VALIDATE_RETURN(current != nullptr, EINVAL, 0);
|
||||
|
||||
_LocaleUpdate _loc_update(plocinfo);
|
||||
|
||||
if (_loc_update.GetLocaleT()->mbcinfo->ismbcodepage == 0)
|
||||
return 0;
|
||||
|
||||
while (string <= current && *string) {
|
||||
if ( _ismbblead_l((*string), _loc_update.GetLocaleT()) ) {
|
||||
if (string++ == current) /* check lead byte */
|
||||
return -1;
|
||||
if (!(*string))
|
||||
return 0;
|
||||
}
|
||||
++string;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int (__cdecl _ismbslead)(
|
||||
const unsigned char *string,
|
||||
const unsigned char *current
|
||||
)
|
||||
{
|
||||
return _ismbslead_l(string, current, nullptr);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue