From fea7624124ecc5cbd14cfeee5f5d08a3782be854 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Fri, 18 Sep 2015 21:38:26 +0200 Subject: [PATCH] fixed compile error on 32-bit architectures --- .gitignore | 1 + ChangeLog | 3 +++ configure | 6 +++--- configure.ac | 6 +++--- src/fconfig.h | 4 ++-- src/fmenu.cpp | 4 ++-- src/fmenuitem.cpp | 8 ++++---- src/fstring.cpp | 10 +++++++++- src/fstring.h | 3 ++- test/fstring.cpp | 7 +++++++ 10 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 3d2958c1..c8278ddf 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.gcda _configs.sed config.guess +config.h.in~ config.h config.log config.lt diff --git a/ChangeLog b/ChangeLog index d890b991..bab12076 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2015-09-18 Markus Gans + * fixed compile error on 32-bit architectures + 2015-08-08 Markus Gans * Bug fix in FDialog (use GlobalPos to move) * Don't check mouse click position on titlebar again diff --git a/configure b/configure index e3e2254c..0baee7bc 100755 --- a/configure +++ b/configure @@ -1406,7 +1406,7 @@ Optional Features: --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=no] + --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) @@ -4869,7 +4869,7 @@ if test "${enable_static+set}" = set; then : ;; esac else - enable_static=no + enable_static=yes fi @@ -16845,7 +16845,7 @@ $lt_cl_success || as_fn_exit 1 ### This defines the version number of the installed .so files ### using libtool's versioning system. -SO_VERSION="0:0:0" +SO_VERSION="0:1:0" diff --git a/configure.ac b/configure.ac index 6414ce8e..10c5a439 100644 --- a/configure.ac +++ b/configure.ac @@ -39,15 +39,15 @@ AC_SEARCH_LIBS([tgetent], [termcap tinfo curses ncurses]) AC_SEARCH_LIBS([tparm], [termcap tinfo curses ncurses]) # Checks for libtool -AM_ENABLE_SHARED -AM_DISABLE_STATIC +AC_ENABLE_SHARED +AC_ENABLE_STATIC LT_INIT([dlopen]) LT_LANG([C++]) LT_OUTPUT ### This defines the version number of the installed .so files ### using libtool's versioning system. -AC_SUBST(SO_VERSION, ["0:0:0"]) +AC_SUBST(SO_VERSION, ["0:1:0"]) AC_SUBST([LIBTOOL_DEPS]) diff --git a/src/fconfig.h b/src/fconfig.h index 6bbb1b4f..fcb80772 100644 --- a/src/fconfig.h +++ b/src/fconfig.h @@ -1,6 +1,6 @@ #ifndef _SRC_FCONFIG_H #define _SRC_FCONFIG_H 1 - + /* src/fconfig.h. Generated automatically at end of configure. */ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ @@ -171,6 +171,6 @@ #ifndef F_VERSION #define F_VERSION "0.1.1" #endif - + /* once: _SRC_FCONFIG_H */ #endif diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 31a3e028..85df3f6a 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -109,7 +109,7 @@ void FMenu::menu_dimension() if ( item_text.includes(L'&') ) // item has a hotkey '&' len--; - + if ( len > maxItemWidth ) maxItemWidth = len; ++iter; @@ -179,7 +179,7 @@ void FMenu::draw() drawBorder(); drawItems(); - + setUpdateVTerm(true); } diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index 65b36be9..38fda3fc 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -62,9 +62,9 @@ void FMenuItem::init (FWidget* parent) { setSuperMenu( dynamic_cast(parent) ); superMenu()->insert(this); - + //addAccelerator (item->getKey(), item); - + this->addCallback ( "activate", @@ -77,9 +77,9 @@ void FMenuItem::init (FWidget* parent) { setSuperMenu( dynamic_cast(parent) ); superMenu()->insert(this); - + //addAccelerator (item->getKey(), item); - + this->addCallback ( "activate", diff --git a/src/fstring.cpp b/src/fstring.cpp index 14687864..c3dfa9a3 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -792,13 +792,21 @@ const FString operator + (const wchar_t c, const std::wstring& s) return (tmp); } +//---------------------------------------------------------------------- +wchar_t& FString::operator [] (int pos) +{ + FString& s = *this; + assert ( (pos >= 0) && "Invalid index position!" ); + return s[uInt(pos)]; +} + //---------------------------------------------------------------------- wchar_t& FString::operator [] (uInt pos) { assert ( (pos < length) && "Invalid index position!" ); if (pos >= length) throw std::out_of_range(""); - return (string[pos]); + return string[pos]; } //---------------------------------------------------------------------- diff --git a/src/fstring.h b/src/fstring.h index 8be2a4d0..1a72f7a7 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -200,8 +200,9 @@ class FString friend const FString operator + (const char, const FString&); friend const FString operator + (const wchar_t, const std::wstring&); + wchar_t& operator [] (int); wchar_t& operator [] (uInt); - const FString operator () (uInt, uInt); + const FString operator () (uInt, uInt); bool operator < (const FString&) const; bool operator <= (const FString&) const; diff --git a/test/fstring.cpp b/test/fstring.cpp index 2b93a266..5edf8c88 100644 --- a/test/fstring.cpp +++ b/test/fstring.cpp @@ -173,8 +173,15 @@ int main (int, char**) << num3 << " (long double)" << std::endl; FString fnum1, fnum2; +#if defined(__LP64__) || defined(_LP64) + // 64-bit architecture fnum1.setFormatedNumber(0xffffffffffffffff, '\''); fnum2.setFormatedNumber(-9223372036854775807); +#else + // 32-bit architecture + fnum1.setFormatedNumber(0xffffffff, '\''); + fnum2.setFormatedNumber(-2147483647); +#endif std::cout << "setFormatedNumber: " << fnum1 << " (unsigned)" << std::endl; std::cout << "setFormatedNumber: "