[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35363] trunk/blender/source/blender/ editors/sculpt_paint: sculpt undo struct was using an array of char pointers rather then a char array .

Campbell Barton ideasman42 at gmail.com
Sat Mar 5 11:37:59 CET 2011


Revision: 35363
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35363
Author:   campbellbarton
Date:     2011-03-05 10:37:59 +0000 (Sat, 05 Mar 2011)
Log Message:
-----------
sculpt undo struct was using an array of char pointers rather then a char array.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h
    trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h	2011-03-05 10:29:10 UTC (rev 35362)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h	2011-03-05 10:37:59 UTC (rev 35363)
@@ -104,7 +104,7 @@
 	float *layer_disp;
 
 	/* shape keys */
-	char *shapeName[32]; /* keep size in sync with keyblock dna */
+	char shapeName[sizeof(((KeyBlock *)0))->name];
 } SculptUndoNode;
 
 SculptUndoNode *sculpt_undo_push_node(SculptSession *ss, PBVHNode *node);

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c	2011-03-05 10:29:10 UTC (rev 35362)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c	2011-03-05 10:37:59 UTC (rev 35363)
@@ -100,17 +100,15 @@
 			continue;
 
 		if(unode->maxvert) {
-			char *shapeName= (char*)unode->shapeName;
-
 			/* regular mesh restore */
 			if(ss->totvert != unode->maxvert)
 				continue;
 
-			if (ss->kb && strcmp(ss->kb->name, shapeName)) {
+			if (ss->kb && strcmp(ss->kb->name, unode->shapeName)) {
 				/* shape key has been changed before calling undo operator */
 
 				Key *key= ob_get_key(ob);
-				KeyBlock *kb= key_get_named_keyblock(key, shapeName);
+				KeyBlock *kb= key_get_named_keyblock(key, unode->shapeName);
 
 				if (kb) {
 					ob->shapenr= BLI_findindex(&key->block, kb) + 1;
@@ -316,7 +314,7 @@
 		memcpy(unode->grids, grids, sizeof(int)*totgrid);
 
 	/* store active shape key */
-	if(ss->kb) BLI_strncpy((char*)unode->shapeName, ss->kb->name, sizeof(ss->kb->name));
+	if(ss->kb) BLI_strncpy(unode->shapeName, ss->kb->name, sizeof(ss->kb->name));
 	else unode->shapeName[0]= '\0';
 
 	return unode;




More information about the Bf-blender-cvs mailing list