[Bf-committers] PATCH/Question from newbie

robwilkens at gmail.com robwilkens at gmail.com
Mon Dec 27 04:17:19 CET 2010


oops sorry

I submitted this to the patch tracker online when I realized that was the right spot for it.

Rob

From: robwilkens at gmail.com 
Sent: Sunday, December 26, 2010 8:38 PM
To: bf-committers at blender.org 
Subject: PATCH/Question from newbie

Hi there...

I’m new to graphics altogether.. Or non experienced at all.  However, I’ve got a little c experience like a lot of people with a cs background (from 10+ years ago).  I haven’t been doing a lot of programming at all in recent time, but I have a lot of free time.

I want to submit this patch for review and opinion if needed..  I accompany it with brief commentary:

1. It’s clear that the attached 2 lines changed will always return an int because of the nature of the MAX and MIN functions inside of them, however the Visual C++ 2010 compiler flags it as a warning because you’re assigning a DOUBLE to an INT because the knobs array is of doubles.  

2. For someone new to this who is just looking to compile and get past the warnings and errors, the attached patch should remove the compiler warning without changing the code functionality at all (if it does, I did it wrong).

3. If this type of patch (silencing a compiler warning) is welcome, please let me know and I’ll feel more confident about submitting more of them.  If not, I’ll probably either shy away from patching and/or unsubscribe from this list and forget about trying to learn from the blender source code like I wanted to.  It’s also possible that won’t happen and I’ll just get past the warnings and grasp the code for what it is and build on it in the distant future.

See attached out2.txt file for patch I’ll include plain text below
-Rob
----------------------------------------------------------------------------------------------------
Index: intern/opennl/superlu/colamd.c
===================================================================
--- intern/opennl/superlu/colamd.c (revision 33894)
+++ intern/opennl/superlu/colamd.c (working copy)
@@ -1111,8 +1111,8 @@
 
     /* === Extract knobs ==================================================== */
 
-    dense_row_count = MAX (0, MIN (knobs [COLAMD_DENSE_ROW] * n_col, n_col)) ;
-    dense_col_count = MAX (0, MIN (knobs [COLAMD_DENSE_COL] * n_row, n_row)) ;
+    dense_row_count = (int)(MAX (0, MIN (knobs [COLAMD_DENSE_ROW] * n_col, n_col))) ;
+    dense_col_count = (int)(MAX (0, MIN (knobs [COLAMD_DENSE_COL] * n_row, n_row))) ;
     DEBUG0 (("densecount: %d %d\n", dense_row_count, dense_col_count)) ;
     max_deg = 0 ;
     n_col2 = n_col ;


More information about the Bf-committers mailing list