ReactOS 0.4.16-dev-1041-g8b6907f
lcidtoname_downlevel.cpp File Reference
#include <corecrt_internal.h>
Include dependency graph for lcidtoname_downlevel.cpp:

Go to the source code of this file.

Classes

struct  anonymous_namespace{lcidtoname_downlevel.cpp}::LcidToLocaleName
 
struct  anonymous_namespace{lcidtoname_downlevel.cpp}::LocaleNameIndex
 

Namespaces

namespace  anonymous_namespace{lcidtoname_downlevel.cpp}
 

Functions

static int GetTableIndexFromLocaleName (const wchar_t *localeName) throw ()
 
static int GetTableIndexFromLcid (LCID lcid) throw ()
 
LCID __cdecl __acrt_DownlevelLocaleNameToLCID (LPCWSTR localeName)
 
int __cdecl __acrt_DownlevelLCIDToLocaleName (LCID lcid, LPWSTR outLocaleName, int cchLocaleName)
 

Variables

static const LcidToLocaleName anonymous_namespace{lcidtoname_downlevel.cpp}::LcidToLocaleNameTable []
 
static const LocaleNameIndex anonymous_namespace{lcidtoname_downlevel.cpp}::LocaleNameToIndexTable []
 

Function Documentation

◆ __acrt_DownlevelLCIDToLocaleName()

int __cdecl __acrt_DownlevelLCIDToLocaleName ( LCID  lcid,
LPWSTR  outLocaleName,
int  cchLocaleName 
)

Definition at line 566 of file lcidtoname_downlevel.cpp.

571{
572 size_t count;
573 wchar_t* buffer;
574 int index;
575
576 if (lcid == 0 ||
577 lcid == LOCALE_USER_DEFAULT ||
578 lcid == LOCALE_SYSTEM_DEFAULT)
579 {
580 return 0;
581 }
582
583 if ((outLocaleName == nullptr && cchLocaleName>0) || cchLocaleName < 0)
584 {
585 return 0;
586 }
587
589 if (index < 0)
590 return 0;
591
594
595 if (cchLocaleName > 0)
596 {
597 if ((int)count >= cchLocaleName)
598 return 0;
599
600 _ERRCHECK(wcscpy_s(outLocaleName, cchLocaleName, buffer));
601 }
602
603 return (int) count + 1;
604}
#define index(s, c)
Definition: various.h:29
_In_ int cchLocaleName
#define _ERRCHECK(e)
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLuint index
Definition: glext.h:6031
static int GetTableIndexFromLcid(LCID lcid)
#define wcscpy_s(d, l, s)
Definition: utility.h:201
static const LcidToLocaleName LcidToLocaleNameTable[]
#define LOCALE_NAME_MAX_LENGTH
#define LOCALE_USER_DEFAULT
#define LOCALE_SYSTEM_DEFAULT
size_t __cdecl wcsnlen(wchar_t const *const string, size_t const maximum_count)
Definition: strnlen.cpp:210

Referenced by __acrt_LCIDToLocaleName().

◆ __acrt_DownlevelLocaleNameToLCID()

LCID __cdecl __acrt_DownlevelLocaleNameToLCID ( LPCWSTR  localeName)

Definition at line 551 of file lcidtoname_downlevel.cpp.

552{
553 int index;
554
555 if (localeName == nullptr)
556 return 0;
557
559
560 if (index < 0 || (index >= _countof(LcidToLocaleNameTable)))
561 return 0;
562
564}
static int GetTableIndexFromLocaleName(const wchar_t *localeName)
#define _countof(array)
Definition: sndvol32.h:70

◆ GetTableIndexFromLcid()

static int GetTableIndexFromLcid ( LCID  lcid)
throw (
)
static

Definition at line 527 of file lcidtoname_downlevel.cpp.

528{
529
530 int bottom = 0;
532
533 while (bottom <= top)
534 {
535 int middle = (bottom + top) / 2;
536 int testIndex = lcid - LcidToLocaleNameTable[middle].lcid;
537
538 if (testIndex == 0)
539 return middle;
540
541 if (testIndex < 0)
542 top = middle - 1;
543 else
544 bottom = middle + 1;
545 }
546
547 return -1;
548}
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726

Referenced by __acrt_DownlevelLCIDToLocaleName().

◆ GetTableIndexFromLocaleName()

static int GetTableIndexFromLocaleName ( const wchar_t localeName)
throw (
)
static

Definition at line 503 of file lcidtoname_downlevel.cpp.

504{
505 LocaleNameIndex *localeNamesIndex = (LocaleNameIndex *) LocaleNameToIndexTable;
506 int bottom = 0;
508
509 while (bottom <= top)
510 {
511 int middle = (bottom + top) / 2;
512 int testIndex = __ascii_wcsnicmp(localeName, localeNamesIndex[middle].name, LOCALE_NAME_MAX_LENGTH);
513
514 if (testIndex == 0)
515 return localeNamesIndex[middle].index;
516
517 if (testIndex < 0)
518 top = middle - 1;
519 else
520 bottom = middle + 1;
521 }
522
523 return -1;
524}
_Check_return_ int __cdecl __ascii_wcsnicmp(_In_reads_or_z_(count) const wchar_t *lhs, _In_reads_or_z_(count) const wchar_t *rhs, _In_ size_t count)
static const LocaleNameIndex LocaleNameToIndexTable[]
Definition: name.c:39

Referenced by __acrt_DownlevelLocaleNameToLCID().