Skip to content

Commit 32a5345

Browse files
committed
Small fixes
1 parent 4f9ebc7 commit 32a5345

File tree

8 files changed

+15
-22
lines changed

8 files changed

+15
-22
lines changed

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ cd "$SRCDIR" || exit
1616
print_systeminfo ()
1717
{
1818
test -z "$CXX" && eval "$(grep '^CXX = ' "Makefile" | cut -d' ' -f1-3 | sed -e 's/ //g')"
19-
local cxx_version="$($CXX -dumpfullversion -dumpversion || echo "unknown version")"
19+
cxx_version="$($CXX -dumpfullversion -dumpversion || echo "unknown version")"
20+
local cxx_version
2021
local build_mode="$1"
2122
echo "-------------------------"
2223
echo " Platform: $PLATFORM"

examples/ui.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,11 +1052,10 @@ void MyDialog::cb_view (const finalcut::FMenuItem* item)
10521052
view->setResizeable();
10531053
std::string line{};
10541054
std::ifstream infile;
1055-
infile.open(file.c_str());
1055+
infile.open(file.c_str(), std::ios::in);
10561056

1057-
while ( ! infile.eof() && infile.good() )
1057+
while ( std::getline(infile, line) )
10581058
{
1059-
getline(infile, line);
10601059
view->append(line);
10611060
}
10621061

examples/xpmimage.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,9 +1167,8 @@ auto XpmImage::xpmFileToVector (const std::string& filename) const -> std::vecto
11671167
std::regex regex(R"gx("(.*)")gx");
11681168
std::size_t num{0};
11691169

1170-
while ( ! infile.eof() && infile.good() )
1170+
while ( std::getline(infile, line) )
11711171
{
1172-
getline(infile, line);
11731172
std::smatch match;
11741173

11751174
if ( (num == 0 && line.find("/* XPM */") == std::string::npos)

final/eventloop/eventloop.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,11 @@ inline auto EventLoop::processNextEvents() -> bool
131131
//----------------------------------------------------------------------
132132
auto EventLoop::processPoll (int& num_of_events) -> PollResult
133133
{
134-
int poll_result{};
135-
136134
while (true)
137135
{
138-
poll_result = poll( cached_fds.data()
139-
, cached_fds.size()
140-
, WAIT_INDEFINITELY );
136+
int poll_result = poll( cached_fds.data()
137+
, cached_fds.size()
138+
, WAIT_INDEFINITELY );
141139

142140
if ( poll_result > 0 )
143141
{

final/util/fstring.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,7 @@ auto FString::toLong() const -> long
436436
throw std::invalid_argument ("no valid number");
437437

438438
long num{0};
439-
constexpr long pos_limit = LONG_MAX / 10;
440-
constexpr long neg_limit = -(LONG_MIN / 10);
441-
const long limit = neg ? neg_limit : pos_limit;
439+
constexpr long limit = LONG_MAX / 10;
442440
const long limit_digit = neg ? (-(LONG_MIN % 10) + 1) : (LONG_MAX % 10);
443441

444442
while ( s_ptr != end )

scripts/cpuprofile.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ EXECUTABLE_FILE="../examples/.libs/ui"
55
error_handling ()
66
{
77
echo "No ELF executable!"
8-
exit 1
8+
return 1
99
}
1010

1111
if [ $# -gt 0 ]
1212
then
1313
EXECUTABLE_FILE="$1"
14-
file --brief "$EXECUTABLE_FILE" | grep -q "ELF" || error_handling
14+
file --brief "$EXECUTABLE_FILE" | grep -q "ELF" || error_handling || exit 1
1515
LD_LIBRARY_PATH=../final/.libs/ LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libprofiler.so.0" CPUPROFILE=profile.prof "$@"
1616
else
1717
LD_LIBRARY_PATH=../final/.libs/ LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libprofiler.so.0" CPUPROFILE=profile.prof "$EXECUTABLE_FILE"

test/flogger-test.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,8 @@ void FLoggerTest::fileTest()
303303
std::ifstream file_stream{filename};
304304
std::size_t i{0};
305305

306-
while ( ! file_stream.eof() && file_stream.good() )
307-
{
308-
getline(file_stream, line);
306+
while ( std::getline(file_stream, line) )
307+
{
309308
CPPUNIT_ASSERT ( line == strings[i] );
310309
i++;
311310
}

test/fstringstream-test.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,10 @@ void FStringStreamTest::fileTest()
205205
}
206206

207207
std::ifstream file_stream{filename};
208+
std::string line{};
208209

209-
if ( ! file_stream.eof() && file_stream.good() )
210+
if ( std::getline(file_stream, line) )
210211
{
211-
std::string line{};
212-
getline(file_stream, line);
213212
CPPUNIT_ASSERT ( line == "FStringStream file test" );
214213
}
215214

0 commit comments

Comments
 (0)