SDL  2.0
SDL_syslocale.c File Reference
#include <Windows.h>
#include "../../SDL_internal.h"
#include "../SDL_syslocale.h"
#include <wchar.h>
+ Include dependency graph for SDL_syslocale.c:

Go to the source code of this file.

Functions

void SDL_SYS_GetPreferredLocales (char *buf, size_t buflen)
 

Function Documentation

◆ SDL_SYS_GetPreferredLocales()

void SDL_SYS_GetPreferredLocales ( char *  buf,
size_t  buflen 
)

Definition at line 31 of file SDL_syslocale.c.

32 {
33  WCHAR wbuffer[128] = L"";
34  int ret = 0;
35 
36  /* !!! FIXME: do we not have GetUserPreferredUILanguages on WinPhone or UWP? */
37 # if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
38  ret = GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_SNAME, wbuffer, SDL_arraysize(wbuffer));
39 # else
40  ret = GetSystemDefaultLocaleName(wbuffer, SDL_arraysize(wbuffer));
41 # endif
42 
43  if (ret > 0)
44  {
45  /* Need to convert LPWSTR to LPSTR, that is wide char to char. */
46  int i;
47 
48  if ( ((size_t) ret) >= (buflen - 1) ) {
49  ret = (int) (buflen - 1);
50  }
51  for (i = 0; i < ret; i++) {
52  buf[i] = (char) wbuffer[i]; /* assume this was ASCII anyhow. */
53  }
54  }
55 }
GLenum GLuint GLenum GLsizei const GLchar * buf
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:121
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
typedef int(__stdcall *FARPROC)()

References i, int(), and SDL_arraysize.