diff --git a/build.sh b/build.sh index 2f64f28e..9dd7f9ae 100755 --- a/build.sh +++ b/build.sh @@ -9,7 +9,7 @@ case "$1" in ;; "--fulldebug"|"fulldebug") - ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy" + ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy" ;; "--profile"|"profile") diff --git a/src/Makefile.clang b/src/Makefile.clang index b4774e90..f88fefda 100644 --- a/src/Makefile.clang +++ b/src/Makefile.clang @@ -91,7 +91,7 @@ OBJS = \ TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses") ifdef DEBUG - OPTIMIZE = -O0 + OPTIMIZE = -O0 -fsanitize=undefined else OPTIMIZE = -O2 endif diff --git a/src/fkey_map.h b/src/fkey_map.h index 24c2e26a..1745935b 100644 --- a/src/fkey_map.h +++ b/src/fkey_map.h @@ -728,7 +728,7 @@ static keyname FkeyName[] = { fc::Fcmkey_menu , "Ctrl+Meta+Menu" }, { fc::Fcmkey_smenu , "Shift+Ctrl+Meta+Menu" }, { fc::Fmkey_tab , "Meta+Tab" }, - { fc::Fmkey_enter , "Meta+Enter" }, + { fc::Fmkey_enter , "Meta+Enter" }, { fc::Fmkey_space , "Meta+Space" }, { fc::Fmkey_bang , "Meta+!" }, { fc::Fmkey_quotes , "Meta+\"" }, diff --git a/src/foptiattr.cpp b/src/foptiattr.cpp index 1ba7ce88..57c4b287 100644 --- a/src/foptiattr.cpp +++ b/src/foptiattr.cpp @@ -83,7 +83,8 @@ inline bool FOptiAttr::colorChange (char_data*& term, char_data*& next) || term->fg_color != next->fg_color || term->bg_color != next->bg_color ); } - return false; + + return false; } //---------------------------------------------------------------------- @@ -199,12 +200,14 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next) char* Sf = F_set_foreground.cap; char* Sb = F_set_background.cap; char* sp = F_set_color_pair.cap; - short fg = next->fg_color; - short bg = next->bg_color; + short fg, bg; if ( monochron || ! term || ! next ) return; + fg = next->fg_color; + bg = next->bg_color; + if ( fg == Default || bg == Default ) { if ( ansi_default_color ) @@ -313,22 +316,24 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next) //---------------------------------------------------------------------- inline bool FOptiAttr::hasAttribute (char_data*& attr) { - if ( ! attr ) - return false; + if ( attr ) + { + return attr->bold == true + || attr->dim == true + || attr->italic == true + || attr->underline == true + || attr->blink == true + || attr->reverse == true + || attr->standout == true + || attr->invisible == true + || attr->protect == true + || attr->crossed_out == true + || attr->dbl_underline == true + || attr->alt_charset == true + || attr->pc_charset == true; + } - return attr->bold == true - || attr->dim == true - || attr->italic == true - || attr->underline == true - || attr->blink == true - || attr->reverse == true - || attr->standout == true - || attr->invisible == true - || attr->protect == true - || attr->crossed_out == true - || attr->dbl_underline == true - || attr->alt_charset == true - || attr->pc_charset == true; + return false; } //---------------------------------------------------------------------- @@ -355,8 +360,11 @@ inline void FOptiAttr::resetAttribute (char_data*& attr) //---------------------------------------------------------------------- inline void FOptiAttr::reset (char_data*& attr) { - resetAttribute(attr); - resetColor(attr); + if ( attr ) + { + resetAttribute(attr); + resetColor(attr); + } } //---------------------------------------------------------------------- @@ -915,8 +923,10 @@ short FOptiAttr::vga2ansi (register short color) 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15 }; + color = lookup_table[color]; } + return color; } diff --git a/test/Makefile.clang b/test/Makefile.clang index 8fb6cecb..79158eb3 100644 --- a/test/Makefile.clang +++ b/test/Makefile.clang @@ -16,7 +16,7 @@ INCLUDES = -I../src RM = rm -f ifdef DEBUG - OPTIMIZE = -O0 + OPTIMIZE = -O0 -fsanitize=undefined else OPTIMIZE = -O2 endif