summaryrefslogtreecommitdiff
path: root/src/imageutils.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-01-31 04:22:52 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-01-31 04:22:52 (GMT)
commit3ee7e9de2c7e4dfbc18ed682089ee0aac0893a87 (patch)
tree6cb315fb74c021210d2c8fc3f421f4162662694c /src/imageutils.cc
parent8f59e43915e404640f895eed8c431a18aba5031e (diff)
throw some assert() in to guard against bugs
Diffstat (limited to 'src/imageutils.cc')
-rw-r--r--src/imageutils.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/imageutils.cc b/src/imageutils.cc
index 133eaf1..08b0492 100644
--- a/src/imageutils.cc
+++ b/src/imageutils.cc
@@ -1,9 +1,11 @@
#include "imageutils.h"
#include <string.h>
#include <fstream>
+#include <assert>
void flip_image(const unsigned char *src, unsigned char *dst, size_t pixelsize, size_t width, size_t height)
{
+ assert( src && dst );
size_t rowBytes = pixelsize * width;
for (size_t i = 0 ; i < height ; i++) {
memmove(dst + (height - i - 1) * rowBytes, src + i * rowBytes, rowBytes);
@@ -11,6 +13,7 @@ void flip_image(const unsigned char *src, unsigned char *dst, size_t pixelsize,
}
bool write_png(const char *filename, unsigned char *pixels, int width, int height) {
+ assert( filename && pixels );
std::ofstream fstream( filename, std::ios::binary );
if (fstream.is_open()) {
write_png( fstream, pixels, width, height );
contact: Jan Huwald // Impressum