diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-24 03:57:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-24 03:57:17 +0400 |
commit | c1c022342cd2fb526f1dfb79ab1d7f5324e90d4e (patch) | |
tree | 32a3d4ab62726cdaef86d826571847e3a1bc58f4 /source/blender/blenlib | |
parent | 03f451f2f18cccd80d0d56391c4836da34641a60 (diff) |
fix for invalid use of memset when loading tiff images
- memset(..., 1.0); // isnt valid
- memset(pointer, sizeof(pointer)) // was using the sizeof the pointer, not the size of the array, since this was to fill in alpha values it was obviously wrong.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 54c06616110..af3df9c9ed2 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -228,6 +228,7 @@ void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_ void sub_vn_vn(float *array_tar, const float *array_src, const int size); void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size); void fill_vn_i(int *array_tar, const int size, const int val); +void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val); void fill_vn_fl(float *array_tar, const int size, const float val); #ifdef __cplusplus diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 4b3ba7244d4..f734e01943f 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -561,6 +561,15 @@ void fill_vn_i(int *array_tar, const int size, const int val) } } +void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val) +{ + unsigned short *tar = array_tar + (size - 1); + int i = size; + while (i--) { + *(tar--) = val; + } +} + void fill_vn_fl(float *array_tar, const int size, const float val) { float *tar = array_tar + (size - 1); |