code cleanup: utfconv library had some quite confusing formatting, also cleared som warnings.

This commit is contained in:
Campbell Barton
2012-04-12 02:15:33 +00:00
parent 5aaf3ede76
commit cc1259178b
12 changed files with 270 additions and 221 deletions

View File

@@ -114,10 +114,10 @@ const GHOST_TUns8* GHOST_SystemPathsWin32::getBinaryDir() const
return NULL;
}
void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char* filename) const
void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char *filename) const
{
/* SHARD_PATH resolves to SHARD_PATHA for non-UNICODE build */
UTF16_ENCODE(filename)
SHAddToRecentDocs(SHARD_PATHW,filename_16);
UTF16_UN_ENCODE(filename)
UTF16_ENCODE(filename);
SHAddToRecentDocs(SHARD_PATHW, filename_16);
UTF16_UN_ENCODE(filename);
}

View File

@@ -85,7 +85,7 @@ public:
/**
* Add the file to the operating system most recently used files
*/
void addToSystemRecentFiles(const char* filename) const;
void addToSystemRecentFiles(const char *filename) const;
};
#endif // __GHOST_SYSTEMPATHSWIN32_H__

View File

@@ -724,19 +724,25 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
wchar_t utf16[3]={0};
BYTE state[256] ={0};
int r;
GetKeyboardState((PBYTE)state);
GetKeyboardState((PBYTE)state);
if(r = ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout))
if(r = ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout)) {
if((r>0 && r<3)){
utf16[r]=0;
conv_utf_16_to_8(utf16,utf8_char,6);
}
else if (r==-1) {
utf8_char[0] = '\0';
}
}
if((r>0 && r<3)){utf16[r]=0;
conv_utf_16_to_8(utf16,utf8_char,6);}
else if (r==-1) utf8_char[0] = '\0';
if(!keyDown) {utf8_char[0] = '\0'; ascii='\0';}
else ascii = utf8_char[0]& 0x80?'?':utf8_char[0];
if(!keyDown) {
utf8_char[0] = '\0';
ascii='\0';
}
else {
ascii = utf8_char[0]& 0x80?'?' : utf8_char[0];
}
if(0x80&state[VK_MENU]) utf8_char[0]='\0';
@@ -1253,7 +1259,6 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const
if ( IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL) ) {
wchar_t *buffer;
size_t len = 0;
HANDLE hData = GetClipboardData( CF_UNICODETEXT );
if (hData == NULL) {
CloseClipboard();