Switch to side-by-side view

--- a/HelperStructs/Helper.cpp
+++ b/HelperStructs/Helper.cpp
@@ -22,7 +22,6 @@
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <unistd.h>
 
 #include <ctime>
 #include <string>
@@ -48,34 +47,12 @@
 
 using namespace std;
 
-QByteArray Helper::readFileToByteArray(const char *fn)
-{
-    int fd = -1;
-    char *cp = 0;
+QByteArray Helper::readFileToByteArray(const QString& fn)
+{
+    QFile qf(fn);
     QByteArray ret;
-    struct stat st;
-
-    fd = open(fn, 0);
-    if (fd < 0 || fstat(fd, &st) < 0) {
-        qDebug() << "readfile: open/fstat [" << fn << "] errno " << errno;
-        goto out;
-    }
-    cp = (char *)malloc(st.st_size);
-    if (cp == 0) {
-        qDebug() << "readfile: no mem: can't allocate " << st.st_size;
-        goto out;
-    }
-    if (read(fd, cp, st.st_size) != st.st_size) {
-        qDebug() << "readfile: read [" << fn <<  "] errno " << errno;
-        goto out;
-    }
-    ret.append(cp, st.st_size);
-out:
-    if (fd >= 0) {
-        close(fd);
-    }
-    if (cp) {
-        free(cp);
+    if (qf.open(QIODevice::ReadOnly)) {
+        ret = qf.read(1000 * 1000);
     }
     return ret;
 }