From 188aac80bc344c30d15e82931391c833953fd432 Mon Sep 17 00:00:00 2001 From: midipix Date: Sep 26 2015 15:16:54 +0000 Subject: fix incorrect logic (&& vs. &), remove unnecessary comparisons. --- diff --git a/src/argv/ntapi_tt_argv_envp.c b/src/argv/ntapi_tt_argv_envp.c index bfa0cd2..7a08776 100644 --- a/src/argv/ntapi_tt_argv_envp.c +++ b/src/argv/ntapi_tt_argv_envp.c @@ -193,8 +193,7 @@ int32_t __stdcall __ntapi_tt_parse_cmd_line_args_utf16( } else { /* the current character is not a delimiter... */ /* determine wch_next */ - if (((*wch >= 0x0000) && (*wch < 0xD800)) \ - || ((*wch >= 0xE000) && (*wch < 0x10000))) { + if ((*wch < 0xD800) || (*wch >= 0xE000)) { /* in the BMP, single 16-bit representation */ wch_next = wch + 1; } else if ((*wch >= 0xD800) && (*wch < 0xDC00)) { diff --git a/src/argv/ntapi_tt_get_option.c b/src/argv/ntapi_tt_get_option.c index e6f0748..7056a3c 100644 --- a/src/argv/ntapi_tt_get_option.c +++ b/src/argv/ntapi_tt_get_option.c @@ -55,7 +55,7 @@ static int __inline__ __fastcall __is_bmp_code_point(wchar16_t code_point) { return (((code_point >= 0x0000) && (code_point < 0xD800)) \ - || ((code_point >= 0xE000) && (code_point < 0x10000))); + || (code_point >= 0xE000)); } @@ -418,7 +418,7 @@ int32_t __stdcall __ntapi_tt_validate_program_options( /* validate the occurrence */ if (idx_option) { - if (option->flags && NT_OPTION_ALLOWED_ONCE) { + if (option->flags & NT_OPTION_ALLOWED_ONCE) { if (option->option_count) { options_meta->idx_invalid_argument = idx_arg; @@ -428,7 +428,7 @@ int32_t __stdcall __ntapi_tt_validate_program_options( } } - if (option->flags && NT_OPTION_VALUE_REQUIRED) { + if (option->flags & NT_OPTION_VALUE_REQUIRED) { if ((!(*pvalue)) || (*pvalue == HYPHEN)) { options_meta->idx_missing_option_value = idx_arg;