FString fix for 32-bit architectures

This commit is contained in:
Markus Gans 2018-10-15 01:34:57 +02:00
parent 6b753c54ed
commit de4be23a04
4 changed files with 29 additions and 2 deletions

View File

@ -1,6 +1,7 @@
2018-10-14 Markus Gans <guru.mail@muenster.de> 2018-10-14 Markus Gans <guru.mail@muenster.de>
* A width or height can not be negative. * A width or height can not be negative.
For that reason the change from int to std::size_t. For that reason the change from int to std::size_t.
* FString fix for 32-bit architectures
2018-10-13 Markus Gans <guru.mail@muenster.de> 2018-10-13 Markus Gans <guru.mail@muenster.de>
* Avoid using dynamic_cast so that you can compile Final Cut * Avoid using dynamic_cast so that you can compile Final Cut

View File

@ -452,6 +452,15 @@ wchar_t& FString::operator [] (std::size_t pos)
return string[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 () () const FString& FString::operator () ()
{ {

View File

@ -417,7 +417,9 @@ void FTermXTerminal::setXTermSize()
{ {
if ( term_detection->isXTerminal() ) 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); std::fflush(stdout);
} }
} }

View File

@ -133,7 +133,12 @@ class FString
const FString& operator >> (double&); const FString& operator >> (double&);
const FString& operator >> (float&); const FString& operator >> (float&);
template <typename IndexT>
wchar_t& operator [] (IndexT);
template <typename IndexT>
const wchar_t& operator [] (IndexT) const;
wchar_t& operator [] (std::size_t); wchar_t& operator [] (std::size_t);
const wchar_t& operator [] (std::size_t) const;
const FString& operator () (); const FString& operator () ();
bool operator < (const FString&) const; bool operator < (const FString&) const;
@ -284,6 +289,16 @@ class FString
inline const char* FString::getClassName() inline const char* FString::getClassName()
{ return "FString"; } { return "FString"; }
//----------------------------------------------------------------------
template <typename IndexT>
inline wchar_t& FString::operator [] (IndexT pos)
{ return string[std::size_t(pos)]; }
//----------------------------------------------------------------------
template <typename IndexT>
inline const wchar_t& FString::operator [] (IndexT pos) const
{ return string[std::size_t(pos)]; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template <class CharT> template <class CharT>
inline bool FString::operator < (CharT& s) const inline bool FString::operator < (CharT& s) const