diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-08 20:23:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-08 20:23:43 +0300 |
commit | db0b8017cb51d0fdf5908c1923a867594bf118de (patch) | |
tree | c8844baddb3bf1523ee003ed948169f41c958681 /source/blender/imbuf | |
parent | e02af840e1fbafd068d527ade70146141ab16946 (diff) |
DDS missed newline printing errors.
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/dds/Stream.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp index 57a251261a1..d8387b92530 100644 --- a/source/blender/imbuf/intern/dds/Stream.cpp +++ b/source/blender/imbuf/intern/dds/Stream.cpp @@ -30,10 +30,13 @@ #include <stdio.h> // printf #include <string.h> // memcpy +static const char *msg_error_seek = "DDS: trying to seek beyond end of stream (corrupt file?)"; +static const char *msg_error_read = "DDS: trying to read beyond end of stream (corrupt file?)"; + unsigned int Stream::seek(unsigned int p) { if (p > size) { - printf("DDS: trying to seek beyond end of stream (corrupt file?)"); + puts(msg_error_seek); } else { pos = p; @@ -45,7 +48,7 @@ unsigned int Stream::seek(unsigned int p) unsigned int mem_read(Stream & mem, unsigned long long & i) { if (mem.pos + 8 > mem.size) { - printf("DDS: trying to read beyond end of stream (corrupt file?)"); + puts(msg_error_seek); return(0); } memcpy(&i, mem.mem + mem.pos, 8); // @@ todo: make sure little endian @@ -56,7 +59,7 @@ unsigned int mem_read(Stream & mem, unsigned long long & i) unsigned int mem_read(Stream & mem, unsigned int & i) { if (mem.pos + 4 > mem.size) { - printf("DDS: trying to read beyond end of stream (corrupt file?)"); + puts(msg_error_read); return(0); } memcpy(&i, mem.mem + mem.pos, 4); // @@ todo: make sure little endian @@ -67,7 +70,7 @@ unsigned int mem_read(Stream & mem, unsigned int & i) unsigned int mem_read(Stream & mem, unsigned short & i) { if (mem.pos + 2 > mem.size) { - printf("DDS: trying to read beyond end of stream (corrupt file?)"); + puts(msg_error_read); return(0); } memcpy(&i, mem.mem + mem.pos, 2); // @@ todo: make sure little endian @@ -78,7 +81,7 @@ unsigned int mem_read(Stream & mem, unsigned short & i) unsigned int mem_read(Stream & mem, unsigned char & i) { if (mem.pos + 1 > mem.size) { - printf("DDS: trying to read beyond end of stream (corrupt file?)"); + puts(msg_error_read); return(0); } i = (mem.mem + mem.pos)[0]; @@ -89,7 +92,7 @@ unsigned int mem_read(Stream & mem, unsigned char & i) unsigned int mem_read(Stream & mem, unsigned char *i, unsigned int cnt) { if (mem.pos + cnt > mem.size) { - printf("DDS: trying to read beyond end of stream (corrupt file?)"); + puts(msg_error_read); return(0); } memcpy(i, mem.mem + mem.pos, cnt); |