Skip to content

Commit

Permalink
KeyToText bug
Browse files Browse the repository at this point in the history
  • Loading branch information
skirda1008 committed Jan 26, 2015
1 parent d8520fd commit 5c0474a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
7 changes: 6 additions & 1 deletion far/changelog
@@ -1,4 +1,9 @@
drkns 24.01.2015 09:09:05 +0200 - build 4255
svs 26.01.2015 15:43:08 +0300 - build 4256

1. Падение дебажного FAR при вызове "__FARKEY_ToName(-1)".
В KeyToTextImpl() "KeyText[0]=(wchar_t)(Key&0xFFFF);" приводило к невалидному символу...

drkns 24.01.2015 09:09:05 +0200 - build 4255

1. Уточнение 4254.2.

Expand Down
3 changes: 3 additions & 0 deletions far/keyboard.cpp
Expand Up @@ -1721,6 +1721,9 @@ bool KeyToTextImpl(int Key0, string& strKeyText, tfkey_to_text ToText, add_separ
{
strKeyText.clear();

if (Key0 == -1)
return false;

DWORD Key=(DWORD)Key0, FKey=(DWORD)Key0&0xFFFFFF;

GetShiftKeyName(strKeyText, Key, ToText, AddSeparator);
Expand Down
12 changes: 12 additions & 0 deletions far/syslog.cpp
Expand Up @@ -1307,6 +1307,9 @@ string __MCODE_ToName(DWORD OpCode)
string __FARKEY_ToName(int Key)
{
#if defined(SYSLOG)
if (!IsLogON())
return L"";

string Name;
if (!(Key >= KEY_MACRO_BASE && Key <= KEY_MACRO_ENDBASE) && KeyToText(Key,Name))
{
Expand Down Expand Up @@ -1523,6 +1526,9 @@ string __DLGMSG_ToName(DWORD Msg)
string __VK_KEY_ToName(int VkKey)
{
#if defined(SYSLOG)
if (!IsLogON())
return L"";

#define DEF_VK(k) { VK_##k , L#k }
__XXX_Name VK[]=
{
Expand Down Expand Up @@ -1617,6 +1623,9 @@ string __VK_KEY_ToName(int VkKey)
string __MOUSE_EVENT_RECORD_Dump(const MOUSE_EVENT_RECORD *rec)
{
#if defined(SYSLOG)
if (!IsLogON())
return L"";

string Records = str_printf(
L"MOUSE_EVENT_RECORD: [%d,%d], Btn=0x%08X (%c%c%c%c%c), Ctrl=0x%08X (%c%c%c%c%c - %c%c%c%c), Flgs=0x%08X (%s)",
rec->dwMousePosition.X,
Expand Down Expand Up @@ -1659,6 +1668,9 @@ string __MOUSE_EVENT_RECORD_Dump(const MOUSE_EVENT_RECORD *rec)
string __INPUT_RECORD_Dump(const INPUT_RECORD *rec)
{
#if defined(SYSLOG)
if (!IsLogON())
return L"";

string Records;

if (!rec)
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4255)m4_dnl
m4_define(BUILD,4256)m4_dnl

0 comments on commit 5c0474a

Please sign in to comment.