diff --git a/ChangeLog b/ChangeLog index 9c6e7ba0..1e4cebfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -2018-12-28 Markus Gans +2018-12-30 Markus Gans + * Cygwin compiled fix for C++11 + +2018-12-29 Markus Gans * Text scrolling in FTextView was broken since February 17th! * Replace redundant FString code with templates diff --git a/examples/treeview.cpp b/examples/treeview.cpp index 46df5fd1..5079e3a1 100644 --- a/examples/treeview.cpp +++ b/examples/treeview.cpp @@ -29,19 +29,20 @@ // Function prototypes -uInt64 StringToNumber (const finalcut::FString&); +sInt64 StringToNumber (const finalcut::FString&); bool sortAscending (const finalcut::FObject*, const finalcut::FObject*); bool sortDescending (const finalcut::FObject*, const finalcut::FObject*); // non-member functions //---------------------------------------------------------------------- -uInt64 StringToNumber (const finalcut::FString& str) +sInt64 StringToNumber (const finalcut::FString& str) { - auto NumString = str; + // Cut off one character (because LONG_MAX = 2147483647) + auto NumString = str.left(str.getLength() - 1); NumString = NumString.replace(",", ""); NumString = NumString.replace('.', ""); - uInt64 number = uInt64(NumString.toLong()); + sInt64 number = sInt64(NumString.toLong()); return number; } @@ -57,8 +58,8 @@ bool sortAscending ( const finalcut::FObject* lhs { case 2: { - const uInt64 l_number = StringToNumber(l_item->getText(column)); - const uInt64 r_number = StringToNumber(r_item->getText(column)); + const sInt64 l_number = StringToNumber(l_item->getText(column)); + const sInt64 r_number = StringToNumber(r_item->getText(column)); return bool( l_number < r_number ); // lhs < rhs } case 3: @@ -85,8 +86,8 @@ bool sortDescending ( const finalcut::FObject* lhs { case 2: { - const uInt64 l_number = StringToNumber(l_item->getText(column)); - const uInt64 r_number = StringToNumber(r_item->getText(column)); + const sInt64 l_number = StringToNumber(l_item->getText(column)); + const sInt64 r_number = StringToNumber(r_item->getText(column)); return bool( l_number > r_number ); // lhs > rhs } diff --git a/src/ffiledialog.cpp b/src/ffiledialog.cpp index df578c9f..e557ea33 100644 --- a/src/ffiledialog.cpp +++ b/src/ffiledialog.cpp @@ -20,6 +20,11 @@ * . * ***********************************************************************/ +#if defined(__CYGWIN__) + #undef __STRICT_ANSI__ // need for realpath and strdup + #include // need for strcasecmp +#endif + #include #include "final/ffiledialog.h" diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index 25ce15e9..a3e907bd 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -21,6 +21,11 @@ ***********************************************************************/ #include + +#if defined(__CYGWIN__) + #include // need for FD_ZERO, FD_SET, FD_CLR, ... +#endif + #include #include "final/fkeyboard.h" diff --git a/src/flistview.cpp b/src/flistview.cpp index efc0601e..0fda28b2 100644 --- a/src/flistview.cpp +++ b/src/flistview.cpp @@ -20,6 +20,10 @@ * . * ***********************************************************************/ +#if defined(__CYGWIN__) + #include // need for strcasecmp +#endif + #include #include diff --git a/src/ftermios.cpp b/src/ftermios.cpp index dfe05201..e7f5706a 100644 --- a/src/ftermios.cpp +++ b/src/ftermios.cpp @@ -20,6 +20,10 @@ * . * ***********************************************************************/ +#if defined(__CYGWIN__) + #undef __STRICT_ANSI__ // need for fileno +#endif + #include #include "final/ftermios.h" diff --git a/src/ftextview.cpp b/src/ftextview.cpp index dee3a45a..bb894813 100644 --- a/src/ftextview.cpp +++ b/src/ftextview.cpp @@ -151,7 +151,7 @@ void FTextView::scrollTo (int x, int y) if ( xoffset < 0 ) xoffset = 0; - if ( xoffset > xoffset_end && xoffset_end >= 0 ) + if ( xoffset > xoffset_end ) xoffset = xoffset_end; if ( update_scrollbar ) diff --git a/src/include/final/emptyfstring.h b/src/include/final/emptyfstring.h index 804ba570..2fc24026 100644 --- a/src/include/final/emptyfstring.h +++ b/src/include/final/emptyfstring.h @@ -46,7 +46,7 @@ class emptyFString { public: // Constructors - emptyFString() = default; + emptyFString() = delete; // Disable copy constructor emptyFString (const emptyFString&) = delete; diff --git a/src/include/final/ftermbuffer.h b/src/include/final/ftermbuffer.h index 8b66f6df..61a59c43 100644 --- a/src/include/final/ftermbuffer.h +++ b/src/include/final/ftermbuffer.h @@ -97,8 +97,9 @@ class FTermBuffer template inline FTermBuffer& FTermBuffer::operator << (const type& s) { + FString str(s); std::wostringstream outstream; - outstream << s; + outstream << str; write (outstream.str()); return *this; }