Suppress warnings from Dlog.cpp 60/168160/17
authorPawel Kurowski <p.kurowski2@samsung.com>
Wed, 24 Jan 2018 14:41:40 +0000 (15:41 +0100)
committerRadoslaw Cybulski <r.cybulski@partner.samsung.com>
Thu, 25 Jan 2018 16:36:06 +0000 (17:36 +0100)
Change-Id: I6c744605e5bdb00dc9b929fa639a9df0fae96e1d

src/UniversalSwitch.hpp
src/batch/BatchRunner.cpp
src/batch/Dlog.cpp

index fb51e07..da75202 100644 (file)
@@ -70,7 +70,7 @@ public:
 
        std::list<ecore::Timer>::iterator getBatchModeTimer();
        void eraseBatchModeTimer(std::list<ecore::Timer>::iterator it);
-       
+
        void terminate();
 private:
        void changeMode(Mode mode);
index 53b66cd..55142dd 100644 (file)
@@ -929,7 +929,8 @@ Optional<std::thread> runBatch(const std::array<Optional<std::string>, (size_t)u
                                } catch (...) {
                                        exec->outputStream() << "unhandled exception\nevaluation failed\n";
                                }
-                       } else {
+                       } else
+                       {
                                exec->outputStream() << "timeouted\n";
                                DEBUG("timeouted, when waiting for context change");
                        }
index 2c459bb..80bb4d8 100644 (file)
@@ -31,7 +31,8 @@ void Dlog::terminate()
 {
        if (fdForClosing) {
                char c = 0;
-               (void)write(*fdForClosing, &c, 1);
+               auto written = write(*fdForClosing, &c, 1);
+               DEBUG("write function returned %d", written);
                ASSERT(thr.joinable());
                DEBUG("waiting for thread...");
                thr.join();
@@ -91,21 +92,20 @@ bool Dlog::start()
                                        }
                                        {
                                                auto h = state->lock();
-                                               Optional<size_t> lastEndOfLine = {};
                                                auto finalPos = pos + static_cast<size_t>(count);
+                                               auto first = 0;
                                                for (; pos < finalPos; ++pos) {
                                                        if (tmp[pos] == '\n') {
-                                                               auto first = lastEndOfLine ? (*lastEndOfLine + 1) : 0;
                                                                line.replace(0, line.size(), tmp.data() + first, pos - first);
                                                                ASSERT(line.size() == pos - first);
                                                                for (auto &f : h->listeners)
                                                                        f(line);
-                                                               lastEndOfLine = pos;
+                                                               first = (pos + 1);
                                                        }
                                                }
-                                               if (lastEndOfLine) {
-                                                       auto remainingSize = pos - (*lastEndOfLine + 1);
-                                                       memmove(tmp.data(), tmp.data() + *lastEndOfLine + 1, remainingSize);
+                                               if (first) {
+                                                       auto remainingSize = pos - first;
+                                                       memmove(tmp.data(), tmp.data() + first, remainingSize);
                                                        pos = remainingSize;
                                                }
                                        }