Skip to content

Commit

Permalink
headers: Update the threadlocinfo struct for ucrt
Browse files Browse the repository at this point in the history
This fixes use of _isdigit_l with ucrt.

Signed-off-by: Martin Storsjö <martin@martin.st>
  • Loading branch information
mstorsjo committed Oct 18, 2018
1 parent 9077bf7 commit c69c7a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mingw-w64-headers/crt/crtdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ typedef struct tagLC_ID {
#ifndef _THREADLOCALEINFO
#define _THREADLOCALEINFO
typedef struct threadlocaleinfostruct {
#ifdef __MSVCRT_VERSION__ >= 0x1400
const unsigned short *_locale_pctype;
int _locale_mb_cur_max;
unsigned int _locale_lc_codepage;
#else
int refcount;
unsigned int lc_codepage;
unsigned int lc_collate_cp;
Expand All @@ -465,6 +470,7 @@ typedef struct threadlocaleinfostruct {
const unsigned char *pclmap;
const unsigned char *pcumap;
struct __lc_time_data *lc_time_curr;
#endif
} threadlocinfo;
#endif /* _THREADLOCALEINFO */

Expand Down
5 changes: 5 additions & 0 deletions mingw-w64-headers/crt/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,13 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void);
#endif

#define __chvalidchk(a,b) (__PCTYPE_FUNC[(unsigned char)(a)] & (b))
#ifdef __MSVCRT_VERSION__ >= 0x1400
#define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->_locale_pctype[(unsigned char)(_Char)] & (_Flag))
#define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->_locale_mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale))
#else
#define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[(unsigned char)(_Char)] & (_Flag))
#define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale))
#endif
#define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale)
#define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale)
#define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale)
Expand Down

0 comments on commit c69c7a7

Please sign in to comment.