xwin: fix unitialized variables
> ../hw/xwin/winclipboard/xevents.c: In function ‘winClipboardSelectionNotifyData.constprop’: > ../hw/xwin/winclipboard/xevents.c:313:23: warning: ‘codepage’ may be used uninitialized in this function [-Wmaybe-uninitialized] > 313 | int iUnicodeLen = MultiByteToWideChar(codepage, 0, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 314 | pszReturnData, -1, NULL, 0); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ../hw/xwin/winclipboard/xevents.c: In function ‘winClipboardFlushXEvents’: > ../hw/xwin/winclipboard/xevents.c:550:35: warning: ‘codepage’ may be used uninitialized in this function [-Wmaybe-uninitialized] > 550 | int iConvertDataLen = WideCharToMultiByte(codepage, 0, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 551 | (LPCWSTR) pszGlobalData, -1, > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 552 | NULL, 0, NULL, NULL); > | ~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
603d9ed456
commit
080d513b88
|
@ -200,7 +200,6 @@ winClipboardSelectionNotifyData(HWND hwnd, xcb_window_t iWindow, xcb_connection_
|
|||
|
||||
BOOL fSetClipboardData = TRUE;
|
||||
char *pszReturnData = NULL;
|
||||
UINT codepage;
|
||||
wchar_t *pwszUnicodeStr = NULL;
|
||||
HGLOBAL hGlobal = NULL;
|
||||
char *pszGlobalData = NULL;
|
||||
|
@ -275,6 +274,8 @@ winClipboardSelectionNotifyData(HWND hwnd, xcb_window_t iWindow, xcb_connection_
|
|||
xtpText_nitems = nitems;
|
||||
}
|
||||
|
||||
UINT codepage = CP_ACP;
|
||||
|
||||
if (xtpText_encoding == atoms->atomUTF8String) {
|
||||
pszReturnData = calloc(1, xtpText_nitems + 1);
|
||||
memcpy(pszReturnData, xtpText_value, xtpText_nitems);
|
||||
|
@ -412,7 +413,6 @@ winClipboardFlushXEvents(HWND hwnd,
|
|||
{
|
||||
char *xtpText_value = NULL;
|
||||
int xtpText_nitems;
|
||||
UINT codepage;
|
||||
|
||||
xcb_selection_request_event_t *selection_request = (xcb_selection_request_event_t *)event;
|
||||
{
|
||||
|
@ -535,6 +535,8 @@ winClipboardFlushXEvents(HWND hwnd,
|
|||
}
|
||||
pszGlobalData = (char *) GlobalLock(hGlobal);
|
||||
|
||||
UINT codepage = CP_ACP;
|
||||
|
||||
/* Convert to target string style */
|
||||
if (selection_request->target == XCB_ATOM_STRING) {
|
||||
codepage = CP_ISO_8559_1; // code page identifier for iso-8559-1
|
||||
|
|
Loading…
Reference in New Issue