diff --git a/Source/build.cpp b/Source/build.cpp index 08373b70..c30bdf06 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -763,7 +763,7 @@ int CEXEBuild::section_add_install_type(int inst_type) ERROR_MSG("Error: can't modify flags when no section is open\n"); return PS_ERROR; } - if (build_cursection->install_types == ~(int)0) + if (build_cursection->install_types == ~0) build_cursection->install_types = 0; build_cursection->install_types|=inst_type; return PS_OK; @@ -858,7 +858,7 @@ int CEXEBuild::add_section(const char *secname, const char *defname, int expand/ build_cursection->code=cur_entries->getlen()/sizeof(entry); build_cursection->code_size=0; build_cursection->size_kb=0; - build_cursection->install_types=*name?0:~(int)0; + build_cursection->install_types=*name?0:~0; if (secname[0]=='-') { diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 1ec4e790..c8a7ddde 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -142,7 +142,7 @@ void NSISCALL build_g_logfile() static void NSISCALL set_language() { int i; - LANGID lang_mask=~(LANGID)0; + LANGID lang_mask=(LANGID)~0; LANGID lang=myatoi(state_language); char *language_table=0; int lang_num=g_inst_cmnheader->language_tables_num; @@ -157,7 +157,7 @@ lang_again: } } if (i == lang_num) { - if (lang_mask == ~(LANGID)0) + if (lang_mask == (LANGID)~0) lang_mask=0x3ff; // primary lang else // we already tried once and we still don't have a language table lang_mask=0; // first lang diff --git a/Source/script.cpp b/Source/script.cpp index 3d562562..1deb03f4 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -1312,13 +1312,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } build_header.install_directory_ptr = add_string_main(p); build_header.install_directory_auto_append = 0; - if (*p && p[strlen(p)-1] != '\\') + if (*p && *CharPrev(p, p + strlen(p)) != '\\') { p = build_strlist.get() + build_header.install_directory_ptr; - char *p2 = strrchr(p, '\\'); + char *p2 = p + strlen(p); + while (p2 >= p && *CharPrev(p, p2) != '\\') p2--;; if (p2) { - p2++; build_header.install_directory_auto_append = build_header.install_directory_ptr + (p2 - p); } } @@ -3382,7 +3382,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) if (process_jump(line,1,&ent.offsets[0]) || process_jump(line,2,&ent.offsets[1])) PRINTHELP() ent.offsets[2]=FLAG_OFFSET(abort); - ent.offsets[3]=(int)~0;//new value mask - keep flag + ent.offsets[3]=~0;//new value mask - keep flag SCRIPT_MSG("IfAbort ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2)); return add_entry(&ent); case TOK_CLEARERRORS: @@ -4127,7 +4127,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) if (process_jump(line,1,&ent.offsets[0]) || process_jump(line,2,&ent.offsets[1])) PRINTHELP() ent.offsets[2]=FLAG_OFFSET(exec_reboot); - ent.offsets[3]=(int)~0;//new value mask - keep flag + ent.offsets[3]=~0;//new value mask - keep flag SCRIPT_MSG("IfRebootFlag ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2)); return add_entry(&ent); case TOK_SETREBOOTFLAG: