From 4007b28fb3de00fb5022f6dddffab58c0d022ec9 Mon Sep 17 00:00:00 2001 From: Disa Mhembere Date: Tue, 8 Jan 2019 20:30:58 +0000 Subject: [PATCH] bug: abs bug and return of char vs array of chars --- matrix/bulk_operate.cpp | 2 +- matrix/data_io.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix/bulk_operate.cpp b/matrix/bulk_operate.cpp index 744d57f6..4a3a6bb2 100644 --- a/matrix/bulk_operate.cpp +++ b/matrix/bulk_operate.cpp @@ -84,7 +84,7 @@ class basic_uops_impl: public basic_uops return "abs"; } OutType operator()(const InType &e) const { - return (OutType) std::abs(e); + return e < 0 ? ((OutType) -e) : ((OutType) e); } }; diff --git a/matrix/data_io.cpp b/matrix/data_io.cpp index 4deb389e..09919171 100644 --- a/matrix/data_io.cpp +++ b/matrix/data_io.cpp @@ -275,7 +275,7 @@ std::shared_ptr gz_file_io::read_bytes( if (ret <= 0) { if (ret < 0 || !gzeof(f)) { BOOST_LOG_TRIVIAL(fatal) << gzerror(f, &ret); - return std::unique_ptr(); + return std::unique_ptr(); } } read_bytes += ret; @@ -402,7 +402,7 @@ static size_t parse_lines(std::shared_ptr line_buf, size_t size, } if (line - buf_start < (ssize_t) size) lines.push_back(std::string(line)); - + return parser.parse(lines, df); }