Cygwin compiled fix for C++11

This commit is contained in:
Markus Gans 2018-12-30 04:24:46 +01:00
parent 3ad4652883
commit 0d1f6a5e51
9 changed files with 35 additions and 12 deletions

View File

@ -1,4 +1,7 @@
2018-12-28 Markus Gans <guru.mail@muenster.de> 2018-12-30 Markus Gans <guru.mail@muenster.de>
* Cygwin compiled fix for C++11
2018-12-29 Markus Gans <guru.mail@muenster.de>
* Text scrolling in FTextView was broken since February 17th! * Text scrolling in FTextView was broken since February 17th!
* Replace redundant FString code with templates * Replace redundant FString code with templates

View File

@ -29,19 +29,20 @@
// Function prototypes // Function prototypes
uInt64 StringToNumber (const finalcut::FString&); sInt64 StringToNumber (const finalcut::FString&);
bool sortAscending (const finalcut::FObject*, const finalcut::FObject*); bool sortAscending (const finalcut::FObject*, const finalcut::FObject*);
bool sortDescending (const finalcut::FObject*, const finalcut::FObject*); bool sortDescending (const finalcut::FObject*, const finalcut::FObject*);
// non-member functions // 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(",", "");
NumString = NumString.replace('.', ""); NumString = NumString.replace('.', "");
uInt64 number = uInt64(NumString.toLong()); sInt64 number = sInt64(NumString.toLong());
return number; return number;
} }
@ -57,8 +58,8 @@ bool sortAscending ( const finalcut::FObject* lhs
{ {
case 2: case 2:
{ {
const uInt64 l_number = StringToNumber(l_item->getText(column)); const sInt64 l_number = StringToNumber(l_item->getText(column));
const uInt64 r_number = StringToNumber(r_item->getText(column)); const sInt64 r_number = StringToNumber(r_item->getText(column));
return bool( l_number < r_number ); // lhs < rhs return bool( l_number < r_number ); // lhs < rhs
} }
case 3: case 3:
@ -85,8 +86,8 @@ bool sortDescending ( const finalcut::FObject* lhs
{ {
case 2: case 2:
{ {
const uInt64 l_number = StringToNumber(l_item->getText(column)); const sInt64 l_number = StringToNumber(l_item->getText(column));
const uInt64 r_number = StringToNumber(r_item->getText(column)); const sInt64 r_number = StringToNumber(r_item->getText(column));
return bool( l_number > r_number ); // lhs > rhs return bool( l_number > r_number ); // lhs > rhs
} }

View File

@ -20,6 +20,11 @@
* <http://www.gnu.org/licenses/>. * * <http://www.gnu.org/licenses/>. *
***********************************************************************/ ***********************************************************************/
#if defined(__CYGWIN__)
#undef __STRICT_ANSI__ // need for realpath and strdup
#include <strings.h> // need for strcasecmp
#endif
#include <vector> #include <vector>
#include "final/ffiledialog.h" #include "final/ffiledialog.h"

View File

@ -21,6 +21,11 @@
***********************************************************************/ ***********************************************************************/
#include <fcntl.h> #include <fcntl.h>
#if defined(__CYGWIN__)
#include <sys/select.h> // need for FD_ZERO, FD_SET, FD_CLR, ...
#endif
#include <string> #include <string>
#include "final/fkeyboard.h" #include "final/fkeyboard.h"

View File

@ -20,6 +20,10 @@
* <http://www.gnu.org/licenses/>. * * <http://www.gnu.org/licenses/>. *
***********************************************************************/ ***********************************************************************/
#if defined(__CYGWIN__)
#include <strings.h> // need for strcasecmp
#endif
#include <memory> #include <memory>
#include <vector> #include <vector>

View File

@ -20,6 +20,10 @@
* <http://www.gnu.org/licenses/>. * * <http://www.gnu.org/licenses/>. *
***********************************************************************/ ***********************************************************************/
#if defined(__CYGWIN__)
#undef __STRICT_ANSI__ // need for fileno
#endif
#include <map> #include <map>
#include "final/ftermios.h" #include "final/ftermios.h"

View File

@ -151,7 +151,7 @@ void FTextView::scrollTo (int x, int y)
if ( xoffset < 0 ) if ( xoffset < 0 )
xoffset = 0; xoffset = 0;
if ( xoffset > xoffset_end && xoffset_end >= 0 ) if ( xoffset > xoffset_end )
xoffset = xoffset_end; xoffset = xoffset_end;
if ( update_scrollbar ) if ( update_scrollbar )

View File

@ -46,7 +46,7 @@ class emptyFString
{ {
public: public:
// Constructors // Constructors
emptyFString() = default; emptyFString() = delete;
// Disable copy constructor // Disable copy constructor
emptyFString (const emptyFString&) = delete; emptyFString (const emptyFString&) = delete;

View File

@ -97,8 +97,9 @@ class FTermBuffer
template <typename type> template <typename type>
inline FTermBuffer& FTermBuffer::operator << (const type& s) inline FTermBuffer& FTermBuffer::operator << (const type& s)
{ {
FString str(s);
std::wostringstream outstream; std::wostringstream outstream;
outstream << s; outstream << str;
write (outstream.str()); write (outstream.str());
return *this; return *this;
} }