diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-31 04:22:52 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-31 04:22:52 (GMT) |
commit | 3ee7e9de2c7e4dfbc18ed682089ee0aac0893a87 (patch) | |
tree | 6cb315fb74c021210d2c8fc3f421f4162662694c | |
parent | 8f59e43915e404640f895eed8c431a18aba5031e (diff) |
throw some assert() in to guard against bugs
-rw-r--r-- | src/imageutils.cc | 3 |
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 ); |