Minor changes
This commit is contained in:
parent
e74dccf481
commit
9f1bd87151
|
@ -96,12 +96,14 @@ RotoZoomer::RotoZoomer (finalcut::FWidget* parent, bool b, int l)
|
|||
{
|
||||
for (std::size_t i{0}; i < 8; i++)
|
||||
{
|
||||
data[h++] = L' ';
|
||||
data[h] = L' ';
|
||||
h++;
|
||||
}
|
||||
|
||||
for (std::size_t i{0}; i < 8; i++)
|
||||
{
|
||||
data[h++] = L'+';
|
||||
data[h] = L'+';
|
||||
h++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,12 +111,14 @@ RotoZoomer::RotoZoomer (finalcut::FWidget* parent, bool b, int l)
|
|||
{
|
||||
for (std::size_t i{0}; i < 8; i++)
|
||||
{
|
||||
data[h++] = L'x';
|
||||
data[h] = L'x';
|
||||
h++;
|
||||
}
|
||||
|
||||
for (std::size_t i{0}; i < 8; i++)
|
||||
{
|
||||
data[h++] = L' ';
|
||||
data[h] = L' ';
|
||||
h++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,9 +97,9 @@ FApplication::FApplication (const int& _argc, char* _argv[])
|
|||
if ( ! (_argc && _argv) )
|
||||
{
|
||||
typedef char* CString;
|
||||
static CString empty[1]{CString("")};
|
||||
static std::array<CString, 1> empty{CString("")};
|
||||
app_argc = 0;
|
||||
app_argv = empty;
|
||||
app_argv = empty.data();
|
||||
}
|
||||
|
||||
init();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <strings.h> // need for strcasecmp
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fevent.h"
|
||||
|
@ -427,7 +428,7 @@ inline bool FFileDialog::patternMatch ( const char* const pattern
|
|||
std::strncat(search.data(), pattern, search.size() - std::strlen(search.data()) - 1);
|
||||
}
|
||||
else
|
||||
std::strncpy(search.data(), pattern, search.size());
|
||||
std::strncpy(search.data(), pattern, search.size() - 1);
|
||||
|
||||
search[search.size() - 1] = '\0';
|
||||
|
||||
|
@ -602,7 +603,7 @@ void FFileDialog::followSymLink (const char* const dir, FDirEntry& entry) const
|
|||
if ( ! fsystem )
|
||||
fsystem = FTerm::getFSystem();
|
||||
|
||||
std::strncpy (symLink.data(), dir, symLink.size());
|
||||
std::strncpy (symLink.data(), dir, symLink.size() - 1);
|
||||
symLink[symLink.size() - 1] = '\0';
|
||||
std::strncat ( symLink.data()
|
||||
, entry.name.c_str()
|
||||
|
|
|
@ -545,10 +545,9 @@ FPoint readCursorPos()
|
|||
constexpr auto& DECXCPR{ESC "[6n"};
|
||||
|
||||
// Report Cursor Position (DECXCPR)
|
||||
const ssize_t ret = write(stdout_no, DECXCPR, std::strlen(DECXCPR));
|
||||
if ( write(stdout_no, DECXCPR, std::strlen(DECXCPR)) < 1 )
|
||||
return FPoint{x, y};
|
||||
|
||||
if ( ret > 0 )
|
||||
{
|
||||
std::fflush(stdout);
|
||||
FD_ZERO(&ifds);
|
||||
FD_SET(stdin_no, &ifds);
|
||||
|
@ -556,8 +555,9 @@ FPoint readCursorPos()
|
|||
tv.tv_usec = 100000; // 100 ms
|
||||
|
||||
// Read the answer
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) == 1 )
|
||||
{
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) != 1 )
|
||||
return FPoint{x, y};
|
||||
|
||||
constexpr auto parse = "\033[%4d;%4dR";
|
||||
std::array<char, 20> temp{};
|
||||
std::size_t pos{0};
|
||||
|
@ -576,8 +576,6 @@ FPoint readCursorPos()
|
|||
|
||||
if ( pos > 4 )
|
||||
std::sscanf(temp.data(), parse, &x, &y);
|
||||
}
|
||||
}
|
||||
|
||||
return FPoint{x, y};
|
||||
}
|
||||
|
|
|
@ -580,8 +580,9 @@ FString FTermDetection::getXTermColorName (FColor color)
|
|||
tv.tv_usec = 150000; // 150 ms
|
||||
|
||||
// read the terminal answer
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
||||
{
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) < 1 )
|
||||
return color_str;
|
||||
|
||||
constexpr auto parse = "\033]4;%10hu;%509[^\n]s";
|
||||
std::array<char, 35> temp{};
|
||||
std::size_t pos{0};
|
||||
|
@ -598,8 +599,7 @@ FString FTermDetection::getXTermColorName (FColor color)
|
|||
}
|
||||
while ( pos < temp.size() );
|
||||
|
||||
if ( pos > 4
|
||||
&& std::sscanf(temp.data(), parse, &color, buf.data()) == 2 )
|
||||
if ( pos > 4 && std::sscanf(temp.data(), parse, &color, buf.data()) == 2 )
|
||||
{
|
||||
std::size_t n = std::strlen(buf.data());
|
||||
|
||||
|
@ -613,7 +613,6 @@ FString FTermDetection::getXTermColorName (FColor color)
|
|||
|
||||
color_str = buf.data();
|
||||
}
|
||||
}
|
||||
|
||||
return color_str;
|
||||
}
|
||||
|
@ -647,8 +646,8 @@ const char* FTermDetection::parseAnswerbackMsg (const char current_termtype[])
|
|||
new_termtype = "putty";
|
||||
}
|
||||
|
||||
// Some terminal like cygwin or the windows terminal
|
||||
// needs to delete the '♣' char
|
||||
// Some terminals like cygwin or the Windows terminal
|
||||
// have to delete the printed character '♣'
|
||||
std::fprintf (stdout, "\r " BS);
|
||||
std::fflush (stdout);
|
||||
|
||||
|
@ -681,8 +680,9 @@ FString FTermDetection::getAnswerbackMsg()
|
|||
tv.tv_usec = 150000; // 150 ms
|
||||
|
||||
// Read the answerback message
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
||||
{
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) < 1 )
|
||||
return answerback;
|
||||
|
||||
std::array<char, 10> temp{};
|
||||
std::size_t pos{0};
|
||||
|
||||
|
@ -700,7 +700,6 @@ FString FTermDetection::getAnswerbackMsg()
|
|||
|
||||
if ( pos > 0 )
|
||||
answerback = temp.data();
|
||||
}
|
||||
|
||||
return answerback;
|
||||
}
|
||||
|
@ -815,9 +814,7 @@ FString FTermDetection::getSecDA()
|
|||
constexpr auto& SECDA{ESC "[>c"};
|
||||
|
||||
// Get the secondary device attributes
|
||||
const ssize_t ret = write(stdout_no, SECDA, std::strlen(SECDA));
|
||||
|
||||
if ( ret == -1 )
|
||||
if ( write(stdout_no, SECDA, std::strlen(SECDA)) == -1 )
|
||||
return sec_da_str;
|
||||
|
||||
std::fflush(stdout);
|
||||
|
@ -827,8 +824,9 @@ FString FTermDetection::getSecDA()
|
|||
tv.tv_usec = 600000; // 600 ms
|
||||
|
||||
// Read the answer
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) == 1 )
|
||||
{
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) < 1 )
|
||||
return sec_da_str;
|
||||
|
||||
constexpr auto parse = "\033[>%10d;%10d;%10dc";
|
||||
std::array<char, 40> temp{};
|
||||
std::size_t pos{0};
|
||||
|
@ -845,10 +843,8 @@ FString FTermDetection::getSecDA()
|
|||
}
|
||||
while ( pos < temp.size() && std::strchr(temp.data(), 'c') == nullptr );
|
||||
|
||||
if ( pos > 3
|
||||
&& std::sscanf(temp.data(), parse, &a, &b, &c) == 3 )
|
||||
if ( pos > 3 && std::sscanf(temp.data(), parse, &a, &b, &c) == 3 )
|
||||
sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c);
|
||||
}
|
||||
|
||||
return sec_da_str;
|
||||
}
|
||||
|
|
|
@ -765,10 +765,13 @@ FString FTermXTerminal::captureXTermFont() const
|
|||
{
|
||||
initCheck(FString{});
|
||||
|
||||
if ( term_detection->isXTerminal()
|
||||
|| term_detection->isScreenTerm()
|
||||
|| FTermcap::osc_support )
|
||||
if ( ! term_detection->isXTerminal()
|
||||
&& ! term_detection->isScreenTerm()
|
||||
&& ! FTermcap::osc_support )
|
||||
{
|
||||
return FString{};
|
||||
}
|
||||
|
||||
fd_set ifds{};
|
||||
struct timeval tv{};
|
||||
const int stdin_no = FTermios::getStdIn();
|
||||
|
@ -784,8 +787,9 @@ FString FTermXTerminal::captureXTermFont() const
|
|||
tv.tv_usec = 150000; // 150 ms
|
||||
|
||||
// Read the terminal answer
|
||||
if ( select(stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
||||
{
|
||||
if ( select(stdin_no + 1, &ifds, nullptr, nullptr, &tv) < 1 )
|
||||
return FString{};
|
||||
|
||||
std::array<char, 150> temp{};
|
||||
std::size_t pos{0};
|
||||
|
||||
|
@ -801,8 +805,8 @@ FString FTermXTerminal::captureXTermFont() const
|
|||
}
|
||||
while ( pos < temp.size() && std::strchr(temp.data(), '\a') == nullptr );
|
||||
|
||||
if ( pos > 5 && temp[0] == ESC[0] && temp[1] == ']'
|
||||
&& temp[2] == '5' && temp[3] == '0' && temp[4] == ';' )
|
||||
if ( pos > 5 && temp[0] == ESC[0] && temp[1] == ']' && temp[2] == '5'
|
||||
&& temp[3] == '0' && temp[4] == ';' )
|
||||
{
|
||||
// Skip leading Esc ] 5 0 ;
|
||||
char* str = &temp[5];
|
||||
|
@ -814,8 +818,6 @@ FString FTermXTerminal::captureXTermFont() const
|
|||
|
||||
return FString{str};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FString{};
|
||||
}
|
||||
|
@ -841,8 +843,9 @@ FString FTermXTerminal::captureXTermTitle() const
|
|||
tv.tv_usec = 150000; // 150 ms
|
||||
|
||||
// read the terminal answer
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
|
||||
{
|
||||
if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) < 1 )
|
||||
return FString{};
|
||||
|
||||
std::array<char, 512> temp{};
|
||||
std::size_t pos{0};
|
||||
|
||||
|
@ -874,7 +877,6 @@ FString FTermXTerminal::captureXTermTitle() const
|
|||
return FString{str};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FString{};
|
||||
}
|
||||
|
|
|
@ -153,6 +153,8 @@ template <typename T>
|
|||
class FData : public FDataAccess
|
||||
{
|
||||
public:
|
||||
typedef typename std::remove_cv<T>::type T_nocv;
|
||||
|
||||
// Constructors
|
||||
explicit FData (T& v) // constructor
|
||||
: value_ref{v}
|
||||
|
@ -244,8 +246,9 @@ class FData : public FDataAccess
|
|||
// Inquiries
|
||||
bool isInitializedCopy() const
|
||||
{
|
||||
return bool( reinterpret_cast<void*>(&value)
|
||||
== reinterpret_cast<void*>(&value_ref.get()) );
|
||||
const auto& v = reinterpret_cast<void*>(const_cast<T_nocv*>(&value));
|
||||
const auto& r = reinterpret_cast<void*>(const_cast<T_nocv*>(&value_ref.get()));
|
||||
return bool( v == r );
|
||||
}
|
||||
|
||||
bool isInitializedReference() const
|
||||
|
|
Loading…
Reference in New Issue