Skip to content

Commit

Permalink
use HIBYTE_WORD16/LOBYTE_WORD16 to extract bytes from wParam of MSG_CHAR
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentWei committed Feb 2, 2018
1 parent c6c60b8 commit 7c9fb6e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/control/bidiedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2474,14 +2474,14 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (dwStyle & ES_READONLY)
return 0;

charBuffer [0] = LOBYTE (wParam);
charBuffer [1] = HIBYTE (wParam);
charBuffer [0] = LOBYTE_WORD16 (wParam);
charBuffer [1] = HIBYTE_WORD16 (wParam);
charBuffer [2] = (0x00ff0000 & wParam) >> 16;

if (charBuffer [2]) {
chars = 3;
}
else if (HIBYTE (wParam)) {
else if (HIBYTE_WORD16 (wParam)) {
chars = 2;
}
else {
Expand Down
6 changes: 3 additions & 3 deletions src/control/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,12 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
break;

case MSG_CHAR:
if (HIBYTE (wParam)==0 && BUTTON_IS_CHECKBTN (pctrl)) {
if (HIBYTE_WORD16 (wParam)==0 && BUTTON_IS_CHECKBTN (pctrl)) {
int old_check = BUTTON_GET_CHECK(pctrl);

if (LOBYTE(wParam) == '+' || LOBYTE(wParam) == '=')
if (LOBYTE_WORD16(wParam) == '+' || LOBYTE_WORD16(wParam) == '=')
BUTTON_SET_CHECK(pctrl, BST_CHECKED);
else if (LOBYTE(wParam) == '-')
else if (LOBYTE_WORD16(wParam) == '-')
BUTTON_SET_CHECK(pctrl, BST_UNCHECKED);

if (old_check != BUTTON_GET_CHECK(pctrl))
Expand Down
6 changes: 3 additions & 3 deletions src/control/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2081,14 +2081,14 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (dwStyle & ES_READONLY)
return 0;

charBuffer [0] = LOBYTE (wParam);
charBuffer [1] = HIBYTE (wParam);
charBuffer [0] = LOBYTE_WORD16 (wParam);
charBuffer [1] = HIBYTE_WORD16 (wParam);
charBuffer [2] = (0x00ff0000 & wParam) >> 16;

if (charBuffer [2]) {
chars = 3;
}
else if (HIBYTE (wParam)) {
else if (HIBYTE_WORD16 (wParam)) {
chars = 2;
}
else {
Expand Down
4 changes: 2 additions & 2 deletions src/control/listbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -1885,10 +1885,10 @@ static LRESULT ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
int newTop;
PLISTBOXITEM plbi;

if (HIBYTE (wParam))
if (HIBYTE_WORD16 (wParam))
break;

head [0] = LOBYTE (wParam);
head [0] = LOBYTE_WORD16 (wParam);
head [1] = '\0';

pData = (PLISTBOXDATA)pCtrl->dwAddData2;
Expand Down
2 changes: 1 addition & 1 deletion src/font/utils/makepytab.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void output_gbhz_py_tab (void)
int j;
GBHZ_PINYIN* p = gbhz_py_tab + i;

printf ("\t{0x%04X /* %c%c */, 0, {", p->encoding, HIBYTE (p->encoding), LOBYTE (p->encoding));
printf ("\t{0x%04X /* %c%c */, 0, {", p->encoding, HIBYTE_WORD16 (p->encoding), LOBYTE_WORD16 (p->encoding));
for (j = 0; j < MAX_NR_PINYIN; j++) {
int no_py, tone;
if (p->pinyin [j] == 0)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,9 @@ static LRESULT MsgBoxProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
{
int id = 0;

if (HIBYTE (wParam))
if (HIBYTE_WORD16 (wParam))
break;
switch (LOBYTE (wParam)) {
switch (LOBYTE_WORD16 (wParam)) {
case 'Y':
case 'y':
id = IDYES;
Expand Down
4 changes: 2 additions & 2 deletions src/textedit/mtextedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4327,8 +4327,8 @@ static int mTextEditor_onChar(mTextEditor *self, int asciiCode, DWORD keyFlags)
return 0;
}

ch [0] = LOBYTE (asciiCode);
ch [1] = HIBYTE (asciiCode);
ch [0] = LOBYTE_WORD16 (asciiCode);
ch [1] = HIBYTE_WORD16 (asciiCode);
ch [2] = (0x0ff0000 & asciiCode) >> 16;
if (ch[2]) {
chlen = 3;
Expand Down

0 comments on commit 7c9fb6e

Please sign in to comment.