[arrayfire] 73/84: Fixes for exceptions in minimal builds

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Jan 4 23:22:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository arrayfire.

commit 862b5232e74a79dc090b66fdaed1d1957700fc1e
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Tue Dec 29 20:22:06 2015 -0500

    Fixes for exceptions in minimal builds
---
 src/api/c/err_common.hpp | 13 +++++++------
 src/api/c/imageio.cpp    |  2 ++
 src/api/c/imageio2.cpp   |  2 ++
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/api/c/err_common.hpp b/src/api/c/err_common.hpp
index a4ca57f..c8eb90a 100644
--- a/src/api/c/err_common.hpp
+++ b/src/api/c/err_common.hpp
@@ -11,6 +11,7 @@
 
 #include <stdexcept>
 #include <string>
+#include <sstream>
 #include <cassert>
 #include <af/defines.h>
 #include <defines.hpp>
@@ -171,12 +172,12 @@ void print_error(const std::string &msg);
         AfError err(__PRETTY_FUNCTION__,                    \
                     __AF_FILENAME__, __LINE__,              \
                     MSG, ERR_TYPE);                         \
-        std::string s = "Error in " + err.getFunctionName() \
-                        + "(" + err.getFileName()           \
-                        + ":" + err.getLine() + "):\n"      \
-                        + err.getError().what() + "\n"      \
-                        ;                                   \
-        print_error(str);                                   \
+        std::stringstream s;                                \
+        s << "Error in " << err.getFunctionName() << "\n"   \
+          << "In file " << err.getFileName()                \
+          << ":" << err.getLine()  << "\n"                  \
+          << err.what() << "\n";                            \
+        print_error(s.str());                               \
         return ERR_TYPE;                                    \
     } while(0)
 
diff --git a/src/api/c/imageio.cpp b/src/api/c/imageio.cpp
index d4855ad..746ee69 100644
--- a/src/api/c/imageio.cpp
+++ b/src/api/c/imageio.cpp
@@ -23,6 +23,7 @@
 #include <ArrayInfo.hpp>
 #include <traits.hpp>
 #include <memory.hpp>
+#include <err_common.hpp>
 
 #include <string>
 #include <cstring>
@@ -713,6 +714,7 @@ af_err af_delete_image_memory(void *ptr)
 #else   // WITH_FREEIMAGE
 #include <af/image.h>
 #include <stdio.h>
+#include <err_common.hpp>
 af_err af_load_image(af_array *out, const char* filename, const bool isColor)
 {
     AF_RETURN_ERROR("ArrayFire compiled without Image IO (FreeImage) support", AF_ERR_NOT_CONFIGURED);
diff --git a/src/api/c/imageio2.cpp b/src/api/c/imageio2.cpp
index a51bacb..d50afef 100644
--- a/src/api/c/imageio2.cpp
+++ b/src/api/c/imageio2.cpp
@@ -23,6 +23,7 @@
 #include <ArrayInfo.hpp>
 #include <traits.hpp>
 #include <memory.hpp>
+#include <err_common.hpp>
 
 #include <string>
 #include <cstring>
@@ -375,6 +376,7 @@ af_err af_save_image_native(const char* filename, const af_array in)
 #else   // WITH_FREEIMAGE
 #include <af/image.h>
 #include <stdio.h>
+#include <err_common.hpp>
 af_err af_load_image_native(af_array *out, const char* filename)
 {
     AF_RETURN_ERROR("ArrayFire compiled without Image IO (FreeImage) support", AF_ERR_NOT_CONFIGURED);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list