[Bf-blender-cvs] [23f1b20] master: fix comparison of identicals

Mike Erwin noreply at git.blender.org
Fri Jul 22 00:16:36 CEST 2016


Commit: 23f1b2073f4a98256dc368fccb9603295d04fa6a
Author: Mike Erwin
Date:   Thu Jul 21 18:14:58 2016 -0400
Branches: master
https://developer.blender.org/rB23f1b2073f4a98256dc368fccb9603295d04fa6a

fix comparison of identicals

Some of these check that dimensions match before running code that
assumes they do match.

For imb_stereo3d_write_anaglyph I *assume* this change reflects the
intended behavior. Before it was always grabbing alpha from buffer 0.

Found with PVS-Studio T48917

===================================================================

M	intern/libmv/libmv/numeric/numeric.cc
M	source/blender/imbuf/intern/filter.c
M	source/blender/imbuf/intern/stereoimbuf.c

===================================================================

diff --git a/intern/libmv/libmv/numeric/numeric.cc b/intern/libmv/libmv/numeric/numeric.cc
index 9007663..3fc1e3b 100644
--- a/intern/libmv/libmv/numeric/numeric.cc
+++ b/intern/libmv/libmv/numeric/numeric.cc
@@ -109,7 +109,7 @@ void MeanAndVarianceAlongRows(const Mat &A,
 }
 
 void HorizontalStack(const Mat &left, const Mat &right, Mat *stacked) {
-  assert(left.rows() == left.rows());
+  assert(left.rows() == right.rows());
   int n = left.rows();
   int m1 = left.cols();
   int m2 = right.cols();
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 26ced49..1987c6d 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -206,7 +206,7 @@ void imb_filterx(struct ImBuf *ibuf)
 static void imb_filterN(ImBuf *out, ImBuf *in)
 {
 	BLI_assert(out->channels == in->channels);
-	BLI_assert(out->x == in->x && out->y == out->y);
+	BLI_assert(out->x == in->x && out->y == in->y);
 
 	const int channels = in->channels;
 	const int rowlen = in->x;
diff --git a/source/blender/imbuf/intern/stereoimbuf.c b/source/blender/imbuf/intern/stereoimbuf.c
index a55cef6..a441844 100644
--- a/source/blender/imbuf/intern/stereoimbuf.c
+++ b/source/blender/imbuf/intern/stereoimbuf.c
@@ -117,7 +117,7 @@ static void imb_stereo3d_write_anaglyph(Stereo3DData *s3d, enum eStereo3dAnaglyp
 					to[0] = from[r][0];
 					to[1] = from[g][1];
 					to[2] = from[b][2];
-					to[3] = MAX2(from[0][3], from[0][3]);
+					to[3] = MAX2(from[0][3], from[1][3]);
 				}
 			}
 		}
@@ -154,7 +154,7 @@ static void imb_stereo3d_write_anaglyph(Stereo3DData *s3d, enum eStereo3dAnaglyp
 					to[0] = from[r][0];
 					to[1] = from[g][1];
 					to[2] = from[b][2];
-					to[3] = MAX2(from[0][3], from[0][3]);
+					to[3] = MAX2(from[0][3], from[1][3]);
 				}
 			}
 		}




More information about the Bf-blender-cvs mailing list