fixed compile error on 32-bit architectures

This commit is contained in:
Markus Gans 2015-09-18 21:38:26 +02:00
parent 8c7c2fc7a2
commit fea7624124
10 changed files with 36 additions and 16 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@
*.gcda *.gcda
_configs.sed _configs.sed
config.guess config.guess
config.h.in~
config.h config.h
config.log config.log
config.lt config.lt

View File

@ -1,3 +1,6 @@
2015-09-18 Markus Gans <guru.mail@muenster.de>
* fixed compile error on 32-bit architectures
2015-08-08 Markus Gans <guru.mail@muenster.de> 2015-08-08 Markus Gans <guru.mail@muenster.de>
* Bug fix in FDialog (use GlobalPos to move) * Bug fix in FDialog (use GlobalPos to move)
* Don't check mouse click position on titlebar again * Don't check mouse click position on titlebar again

6
configure vendored
View File

@ -1406,7 +1406,7 @@ Optional Features:
--disable-dependency-tracking --disable-dependency-tracking
speeds up one-time build speeds up one-time build
--enable-shared[=PKGS] build shared libraries [default=yes] --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] --enable-fast-install[=PKGS]
optimize for fast installation [default=yes] optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds) --disable-libtool-lock avoid locking (might break parallel builds)
@ -4869,7 +4869,7 @@ if test "${enable_static+set}" = set; then :
;; ;;
esac esac
else else
enable_static=no enable_static=yes
fi fi
@ -16845,7 +16845,7 @@ $lt_cl_success || as_fn_exit 1
### This defines the version number of the installed .so files ### This defines the version number of the installed .so files
### using libtool's versioning system. ### using libtool's versioning system.
SO_VERSION="0:0:0" SO_VERSION="0:1:0"

View File

@ -39,15 +39,15 @@ AC_SEARCH_LIBS([tgetent], [termcap tinfo curses ncurses])
AC_SEARCH_LIBS([tparm], [termcap tinfo curses ncurses]) AC_SEARCH_LIBS([tparm], [termcap tinfo curses ncurses])
# Checks for libtool # Checks for libtool
AM_ENABLE_SHARED AC_ENABLE_SHARED
AM_DISABLE_STATIC AC_ENABLE_STATIC
LT_INIT([dlopen]) LT_INIT([dlopen])
LT_LANG([C++]) LT_LANG([C++])
LT_OUTPUT LT_OUTPUT
### This defines the version number of the installed .so files ### This defines the version number of the installed .so files
### using libtool's versioning system. ### using libtool's versioning system.
AC_SUBST(SO_VERSION, ["0:0:0"]) AC_SUBST(SO_VERSION, ["0:1:0"])
AC_SUBST([LIBTOOL_DEPS]) AC_SUBST([LIBTOOL_DEPS])

View File

@ -792,13 +792,21 @@ const FString operator + (const wchar_t c, const std::wstring& s)
return (tmp); 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) wchar_t& FString::operator [] (uInt pos)
{ {
assert ( (pos < length) && "Invalid index position!" ); assert ( (pos < length) && "Invalid index position!" );
if (pos >= length) if (pos >= length)
throw std::out_of_range(""); throw std::out_of_range("");
return (string[pos]); return string[pos];
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -200,6 +200,7 @@ class FString
friend const FString operator + (const char, const FString&); friend const FString operator + (const char, const FString&);
friend const FString operator + (const wchar_t, const std::wstring&); friend const FString operator + (const wchar_t, const std::wstring&);
wchar_t& operator [] (int);
wchar_t& operator [] (uInt); wchar_t& operator [] (uInt);
const FString operator () (uInt, uInt); const FString operator () (uInt, uInt);

View File

@ -173,8 +173,15 @@ int main (int, char**)
<< num3 << " (long double)" << std::endl; << num3 << " (long double)" << std::endl;
FString fnum1, fnum2; FString fnum1, fnum2;
#if defined(__LP64__) || defined(_LP64)
// 64-bit architecture
fnum1.setFormatedNumber(0xffffffffffffffff, '\''); fnum1.setFormatedNumber(0xffffffffffffffff, '\'');
fnum2.setFormatedNumber(-9223372036854775807); fnum2.setFormatedNumber(-9223372036854775807);
#else
// 32-bit architecture
fnum1.setFormatedNumber(0xffffffff, '\'');
fnum2.setFormatedNumber(-2147483647);
#endif
std::cout << "setFormatedNumber: " std::cout << "setFormatedNumber: "
<< fnum1 << " (unsigned)" << std::endl; << fnum1 << " (unsigned)" << std::endl;
std::cout << "setFormatedNumber: " std::cout << "setFormatedNumber: "