Skip to content

Commit 7499f42

Browse files
committed
Compile fix for some architectures
1 parent 762b232 commit 7499f42

26 files changed

+235
-111
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2019-10-13 Markus Gans <guru.mail@muenster.de>
2+
* Compile fix for Cygwin and Linux on arm architectures
3+
* A small color palette optimization
4+
* Corrected east asian ambiguous character width for OpenBSD, NetBSD,
5+
FreeBSD and Solaris
6+
17
2019-10-05 Markus Gans <guru.mail@muenster.de>
28
* Internal redesign of the callback call
39
* Mapping of key functions in an associative container to simplify

examples/checklist.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,10 @@ void CheckList::populate()
126126
{ "Lemons", "Low" }
127127
};
128128

129-
constexpr int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
130-
131-
for (int i{0}; i <= lastItem; i++)
129+
for (const auto& line : list)
132130
{
133-
const finalcut::FStringList line (&list[i][0], &list[i][0] + 2);
134-
auto iter = listView.insert (line);
131+
const finalcut::FStringList string_line (&line[0], &line[0] + 2);
132+
auto iter = listView.insert (string_line);
135133
auto item = static_cast<finalcut::FListViewItem*>(*iter);
136134
item->setCheckable(true);
137135
}

examples/listview.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,9 @@ void Listview::populate()
173173
{ "Zurich", "Mostly Cloudy", "23°C", "44%", "1023.7 mb" }
174174
};
175175

176-
constexpr int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
177-
178-
for (int i{0}; i <= lastItem; i++)
176+
for (const auto& place : weather)
179177
{
180-
finalcut::FStringList line (&weather[i][0], &weather[i][0] + 5);
178+
finalcut::FStringList line (&place[0], &place[0] + 5);
181179
listView.insert (line);
182180
}
183181
}

examples/termcap.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ void string();
4444

4545
struct data
4646
{
47-
static int getNumberOfItems();
48-
4947
struct alignas(alignof(std::string)) termcap_string
5048
{
5149
const std::string name;
@@ -144,13 +142,6 @@ data::termcap_string data::strings[] =
144142
{ "t_key_mouse", fc::t_key_mouse }
145143
};
146144

147-
// data inline functions
148-
//----------------------------------------------------------------------
149-
inline int data::getNumberOfItems()
150-
{
151-
return int ( sizeof(strings) / sizeof(strings[0]) ) - 1;
152-
}
153-
154145

155146
//----------------------------------------------------------------------
156147
// Functions
@@ -290,10 +281,10 @@ void string()
290281
finalcut::FTermcap::tcap_map (&tcap_strings)[] \
291282
= finalcut::FTermcap::strings;
292283

293-
for (int n{0}; n <= data::getNumberOfItems(); n++ )
284+
for (const auto& entry : data::strings)
294285
{
295-
const std::string name = data::strings[n].name;
296-
const fc::termcaps cap = data::strings[n].cap;
286+
const std::string name = entry.name;
287+
const fc::termcaps cap = entry.cap;
297288
tcapString (name, tcap_strings[cap].string);
298289
}
299290
}

examples/treeview.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -322,25 +322,22 @@ Treeview::Treeview (finalcut::FWidget* parent)
322322
listView.setTreeView();
323323

324324
// Populate FListView with a list of items
325-
static TreeItem continent[] =
325+
static TreeItem continent_list[] =
326326
{
327327
{ "Africa", "944,000,000", "31.2", africa },
328328
{ "Asia", "4,010,000,000", "90.3", asia },
329329
{ "Europe", "733,000,000", "69.9", europe },
330330
{ "North America", "523,000,000", "21", north_america },
331331
{ "South America", "381,000,000", "21.4", south_america },
332332
{ "Antarctica", "1000", "0", 0 },
333-
{ "Australia/Oceania", "34,000,000", "4", oceania },
334-
{ 0, 0, 0, 0 }
333+
{ "Australia/Oceania", "34,000,000", "4", oceania }
335334
};
336335

337-
auto continent_list = continent;
338-
339-
while ( continent_list->name )
336+
for (const auto& continent : continent_list)
340337
{
341-
auto& country_list = continent_list->child_element;
342-
finalcut::FStringList continent_line ( continent_list->begin()
343-
, continent_list->end() );
338+
TreeItem* country_list = continent.child_element;
339+
finalcut::FStringList continent_line ( continent.begin()
340+
, continent.end() );
344341
const auto& iter = listView.insert (continent_line);
345342

346343
while ( country_list && country_list->name )
@@ -350,8 +347,6 @@ Treeview::Treeview (finalcut::FWidget* parent)
350347
listView.insert (country_line, iter);
351348
country_list++;
352349
}
353-
354-
continent_list++;
355350
}
356351

357352
// Quit button

src/fcharmap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ const std::size_t lastCP437Item = \
467467
std::size_t((sizeof(cp437_ucs) / sizeof(cp437_ucs[0])) - 1);
468468

469469
// Based on http://www.unicode.org/charts/PDF/UFF00.pdf
470-
wchar_t halfWidth_fullWidth[][2] =
470+
const wchar_t halfWidth_fullWidth[][2] =
471471
{
472472
// Fullwidth ASCII variants
473473
{0x0020, 0x3000}, // ' ' -> ' '

src/fcolorpalette.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ FColorPalette::~FColorPalette() // destructor
3737
void FColorPalette::set8ColorPalette (funcp setPalette)
3838
{
3939
setPalette (fc::Black, 0x00, 0x00, 0x00);
40-
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
40+
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
4141
setPalette (fc::Green, 0x18, 0x78, 0x18);
42-
setPalette (fc::Cyan, 0x66, 0x66, 0xff);
42+
setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2);
4343
setPalette (fc::Red, 0xb2, 0x18, 0x18);
4444
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
4545
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
4646
setPalette (fc::LightGray, 0xe0, 0xe0, 0xe0);
4747
// The same colors again...
4848
setPalette (fc::DarkGray, 0x00, 0x00, 0x00);
49-
setPalette (fc::LightBlue, 0x22, 0x22, 0xb2);
49+
setPalette (fc::LightBlue, 0x10, 0x3b, 0x9e);
5050
setPalette (fc::LightGreen, 0x18, 0x78, 0x18);
51-
setPalette (fc::LightCyan, 0x66, 0x66, 0xff);
51+
setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2);
5252
setPalette (fc::LightRed, 0xb2, 0x18, 0x18);
5353
setPalette (fc::LightMagenta, 0xb2, 0x18, 0xb2);
5454
setPalette (fc::Yellow, 0xe8, 0x87, 0x1f);
@@ -59,9 +59,9 @@ void FColorPalette::set8ColorPalette (funcp setPalette)
5959
void FColorPalette::set16ColorPalette (funcp setPalette)
6060
{
6161
setPalette (fc::Black, 0x00, 0x00, 0x00);
62-
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
62+
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
6363
setPalette (fc::Green, 0x18, 0x78, 0x18);
64-
setPalette (fc::Cyan, 0x4a, 0x4a, 0xe4);
64+
setPalette (fc::Cyan, 0x55, 0x6a, 0xcf);
6565
setPalette (fc::Red, 0xba, 0x1a, 0x1a);
6666
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
6767
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);

src/ffiledialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <strings.h> // need for strcasecmp
2626
#endif
2727

28-
#include <pwd.h>
2928
#include <vector>
3029

3130
#include "final/fevent.h"
@@ -92,6 +91,7 @@ const FString fileChooser ( FWidget* parent
9291
// static class attributes
9392
FSystem* FFileDialog::fsystem{nullptr};
9493

94+
9595
//----------------------------------------------------------------------
9696
// class FFileDialog
9797
//----------------------------------------------------------------------

src/flabel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ void FLabel::printLine (FString&& line)
474474
{
475475
if ( ! std::iswprint(std::wint_t(line[z])) )
476476
{
477-
if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2
478-
|| int(line[z]) > fc::NF_check_mark ) )
477+
if ( ! isNewFont() && ( line[z] < fc::NF_rev_left_arrow2
478+
|| line[z] > fc::NF_check_mark ) )
479479
{
480480
line[z] = L' ';
481481
}

src/fmenu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,8 +1334,8 @@ inline void FMenu::drawMenuText (menuText& data)
13341334
if ( ! std::iswprint(std::wint_t(data.text[z])) )
13351335
{
13361336
if ( ! isNewFont()
1337-
&& ( int(data.text[z]) < fc::NF_rev_left_arrow2
1338-
|| int(data.text[z]) > fc::NF_check_mark )
1337+
&& ( data.text[z] < fc::NF_rev_left_arrow2
1338+
|| data.text[z] > fc::NF_check_mark )
13391339
&& ! charEncodable(wchar_t(data.text[z])) )
13401340
{
13411341
data.text[z] = L' ';

src/fmenubar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ inline void FMenuBar::drawMenuText (menuText& data)
599599
if ( ! std::iswprint(std::wint_t(data.text[z])) )
600600
{
601601
if ( ! isNewFont()
602-
&& ( int(data.text[z]) < fc::NF_rev_left_arrow2
603-
|| int(data.text[z]) > fc::NF_check_mark ) )
602+
&& ( data.text[z] < fc::NF_rev_left_arrow2
603+
|| data.text[z] > fc::NF_check_mark ) )
604604
{
605605
data.text[z] = L' ';
606606
}

src/fsystemimpl.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
* <http://www.gnu.org/licenses/>. *
2121
***********************************************************************/
2222

23+
#if defined(__CYGWIN__)
24+
#include "final/fconfig.h" // need for getpwuid_r and realpath
25+
#endif
26+
2327
#include "final/fsystemimpl.h"
2428

2529
namespace finalcut
@@ -38,5 +42,19 @@ FSystemImpl::FSystemImpl()
3842
FSystemImpl::~FSystemImpl() // destructor
3943
{ }
4044

45+
//----------------------------------------------------------------------
46+
int FSystemImpl::getpwuid_r ( uid_t uid, struct passwd* pwd
47+
, char* buf, size_t buflen
48+
, struct passwd** result )
49+
{
50+
return ::getpwuid_r (uid, pwd, buf, buflen, result);
51+
}
52+
53+
//----------------------------------------------------------------------
54+
char* FSystemImpl::realpath (const char* path, char* resolved_path)
55+
{
56+
return ::realpath(path, resolved_path);
57+
}
58+
4159
} // namespace finalcut
4260

0 commit comments

Comments
 (0)