diff --git a/ChangeLog b/ChangeLog index dffab7fc..76f8b818 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2018-10-14 Markus Gans * A width or height can not be negative. For that reason the change from int to std::size_t. + * FString fix for 32-bit architectures 2018-10-13 Markus Gans * Avoid using dynamic_cast so that you can compile Final Cut diff --git a/src/fstring.cpp b/src/fstring.cpp index b6bcf696..6fefd216 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -452,6 +452,15 @@ wchar_t& FString::operator [] (std::size_t pos) return string[pos]; } +//---------------------------------------------------------------------- +const wchar_t& FString::operator [] (std::size_t pos) const +{ + if ( pos >= length ) + throw std::out_of_range(""); // Invalid index position + + return string[pos]; +} + //---------------------------------------------------------------------- const FString& FString::operator () () { diff --git a/src/ftermxterminal.cpp b/src/ftermxterminal.cpp index d2436da1..2aee3374 100644 --- a/src/ftermxterminal.cpp +++ b/src/ftermxterminal.cpp @@ -417,7 +417,9 @@ void FTermXTerminal::setXTermSize() { if ( term_detection->isXTerminal() ) { - FTerm::putstringf (CSI "8;%lu;%lut", term_height, term_width); + FTerm::putstringf ( CSI "8;%lu;%lut" + , uLong(term_height) + , uLong(term_width) ); std::fflush(stdout); } } diff --git a/src/include/final/fstring.h b/src/include/final/fstring.h index 89aedc39..10738cea 100644 --- a/src/include/final/fstring.h +++ b/src/include/final/fstring.h @@ -133,7 +133,12 @@ class FString const FString& operator >> (double&); const FString& operator >> (float&); - wchar_t& operator [] (std::size_t); + template + wchar_t& operator [] (IndexT); + template + const wchar_t& operator [] (IndexT) const; + wchar_t& operator [] (std::size_t); + const wchar_t& operator [] (std::size_t) const; const FString& operator () (); bool operator < (const FString&) const; @@ -284,6 +289,16 @@ class FString inline const char* FString::getClassName() { return "FString"; } +//---------------------------------------------------------------------- +template +inline wchar_t& FString::operator [] (IndexT pos) +{ return string[std::size_t(pos)]; } + +//---------------------------------------------------------------------- +template +inline const wchar_t& FString::operator [] (IndexT pos) const +{ return string[std::size_t(pos)]; } + //---------------------------------------------------------------------- template inline bool FString::operator < (CharT& s) const