Revision: 10735 https://osdn.net/projects/ttssh2/scm/svn/commits/10735 Author: zmatsuo Date: 2023-06-04 01:56:06 +0900 (Sun, 04 Jun 2023) Log Message: ----------- コンパイル時警告が出ないよう修正 - warning: suggest parentheses around '&&' within '||' [-Wparentheses] - warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits] - warning: variable 'is_update' set but not used [-Wunused-but-set-variable] Modified Paths: -------------- branches/input_charset/teraterm/teraterm/charset.c branches/input_charset/teraterm/teraterm/vtterm.c -------------- next part -------------- Modified: branches/input_charset/teraterm/teraterm/charset.c =================================================================== --- branches/input_charset/teraterm/teraterm/charset.c 2023-06-03 16:55:57 UTC (rev 10734) +++ branches/input_charset/teraterm/teraterm/charset.c 2023-06-03 16:56:06 UTC (rev 10735) @@ -151,7 +151,7 @@ if (ts.KanjiCode==IdSJIS || (ts.FallbackToCP932 && ts.KanjiCode==IdUTF8)) { - if ((0x80<b) && (b<0xa0) || (0xdf<b) && (b<0xfd)) { + if (((0x80<b) && (b<0xa0)) || ((0xdf<b) && (b<0xfd))) { Fallbacked = TRUE; return TRUE; // SJIS kanji } @@ -187,9 +187,9 @@ { VttermKanjiWork *w = &KanjiWork; if (KanjiIn) { - if ((! ConvJIS) && (0x3F<b) && (b<0xFD) || - ConvJIS && ( (0x20<b) && (b<0x7f) || - (0xa0<b) && (b<0xff) )) + if (((! ConvJIS) && (0x3F<b) && (b<0xFD)) || + (ConvJIS && ( ((0x20<b) && (b<0x7f)) || + ((0xa0<b) && (b<0xff)) )) ) { unsigned long u32; Kanji = Kanji + b; @@ -308,11 +308,11 @@ } if ((w->Gn[w->Glr[1]] != IdASCII) || - (ts.KanjiCode==IdEUC) && EUCkanaIn || + ((ts.KanjiCode==IdEUC) && EUCkanaIn) || (ts.KanjiCode==IdSJIS) || - (ts.KanjiCode==IdJIS) && - (ts.JIS7Katakana==0) && - ((ts.TermFlag & TF_FIXEDJIS)!=0)) { + ((ts.KanjiCode==IdJIS) && + (ts.JIS7Katakana==0) && + ((ts.TermFlag & TF_FIXEDJIS)!=0))) { // b\x82\xCDsjis\x82̔\xBC\x8Ap\x83J\x83^\x83J\x83i unsigned long u32 = CP932ToUTF32(b); PutU32(u32); @@ -337,9 +337,9 @@ { VttermKanjiWork *w = &KanjiWork; if (KanjiIn) { - if ((0x41<=b) && (b<=0x5A) || - (0x61<=b) && (b<=0x7A) || - (0x81<=b) && (b<=0xFE)) + if (((0x41<=b) && (b<=0x5A)) || + ((0x61<=b) && (b<=0x7A)) || + ((0x81<=b) && (b<=0xFE))) { unsigned long u32 = 0; if (ts.KanjiCode == IdKoreanCP51949) { @@ -411,8 +411,8 @@ VttermKanjiWork *w = &KanjiWork; if (KanjiIn) { // TODO - if ((0x40<=b) && (b<=0x7e) || - (0xa1<=b) && (b<=0xFE)) + if (((0x40<=b) && (b<=0x7e)) || + ((0xa1<=b) && (b<=0xFE))) { unsigned long u32 = 0; Kanji = Kanji + b; Modified: branches/input_charset/teraterm/teraterm/vtterm.c =================================================================== --- branches/input_charset/teraterm/teraterm/vtterm.c 2023-06-03 16:55:57 UTC (rev 10734) +++ branches/input_charset/teraterm/teraterm/vtterm.c 2023-06-03 16:56:06 UTC (rev 10735) @@ -239,22 +239,6 @@ SaveCursorBuf(Buff); } -static void RestoreCursorBuff(PStatusBuff Buff) -{ - if (Buff->CursorX > NumOfColumns-1) - Buff->CursorX = NumOfColumns-1; - if (Buff->CursorY > NumOfLines-1-StatusLine) - Buff->CursorY = NumOfLines-1-StatusLine; - MoveCursor(Buff->CursorX, Buff->CursorY); - - CharAttr = Buff->Attr; - BuffSetCurCharAttr(CharAttr); - CharSetLoadState(&Buff->CharSetState); - - AutoWrapMode = Buff->AutoWrapMode; - RelativeOrgMode = Buff->RelativeOrgMode; -} - static void RestoreCursor() { PStatusBuff Buff; @@ -2349,7 +2333,8 @@ attr->Back = AttrDefaultBG; break; } - /* fall through to aixterm style back color */ + // fall through + // to aixterm style back color case 101: case 102: @@ -4046,7 +4031,7 @@ static void ControlSequence(BYTE b) { - if ((b<=US) || (b>=0x80) && (b<=0x9F)) + if ((b<=US) || ((b>=0x80) && (b<=0x9F))) ParseControl(b); /* ctrl char */ else if ((b>=0x40) && (b<=0x7E)) ParseCS(b); /* terminate char */ @@ -4576,7 +4561,7 @@ { static int utf8_stat = 0; - if (ESCFlag && (b=='\\') || (b==ST && ts.KanjiCode!=IdSJIS && utf8_stat == 0)) { + if ((ESCFlag && (b=='\\')) || (b==ST && ts.KanjiCode!=IdSJIS && utf8_stat == 0)) { if (! WaitKeyId) DefineUserKey(NewKeyId,NewKeyStr,NewKeyLen); ESCFlag = FALSE; ParseMode = ModeFirst; @@ -4847,7 +4832,7 @@ size_t blen = len * 3 / 4 + 1; char *cbbuff = malloc(blen); len = b64decode(cbbuff, blen, p); - if (len < 0 || len >= blen) { + if (len >= blen) { free(cbbuff); return; } @@ -5265,7 +5250,6 @@ { int r; - BOOL is_update; BOOL SpecialNew = FALSE; if (code <= 0xff) { @@ -5326,7 +5310,6 @@ // \x83o\x83b\x83t\x83@\x82ɕ\xB6\x8E\x9A\x82\xF0\x93\xFC\x82\xEA\x82\xE9 // BuffPutUnicode()\x82\xB5\x82\xBD\x96߂\xE8\x92l\x82ŕ\xB6\x8E\x9A\x82̃Z\x83\x8B\x90\x94\x82\xF0\x92m\x82邱\x82Ƃ\xAA\x82ł\xAB\x82\xE9 // \x83G\x83\x89\x81[\x8E\x9E\x82̓J\x81[\x83\\x83\x8B\x88ʒu\x82\xF0\x8C\x9F\x93\xA2\x82\xB7\x82\xE9 - is_update = FALSE; CharAttrTmp.AttrEx = CharAttrTmp.Attr; retry: r = BuffPutUnicode(code, CharAttrTmp, InsertMode); @@ -5614,8 +5597,8 @@ tmpx[1] = 0; } else { - tmpx[0] = (x >> 6) & 0x1f | 0xc0; - tmpx[1] = x & 0x3f | 0x80; + tmpx[0] = ((x >> 6) & 0x1f) | 0xc0; + tmpx[1] = (x & 0x3f) | 0x80; tmpx[2] = 0; } if (y < 128) { @@ -5623,8 +5606,8 @@ tmpy[1] = 0; } else { - tmpy[0] = (x >> 6) & 0x1f | 0xc0; - tmpy[1] = y & 0x3f | 0x80; + tmpy[0] = ((x >> 6) & 0x1f) | 0xc0; + tmpy[1] = (y & 0x3f) | 0x80; tmpy[2] = 0; } return _snprintf_s_l(buff, buffsize, _TRUNCATE, "M%c%s%s", CLocale, mb+32, tmpx, tmpy);