[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50484] branches/soc-2011-tomato: Merging r50478 through r50483 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Sun Sep 9 10:33:43 CEST 2012


Revision: 50484
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50484
Author:   nazgul
Date:     2012-09-09 08:33:42 +0000 (Sun, 09 Sep 2012)
Log Message:
-----------
Merging r50478 through r50483 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50478
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50483

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/intern/action.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/blender.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c
    branches/soc-2011-tomato/source/blender/editors/gpencil/drawgpencil.c
    branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/interface/interface_handlers.c
    branches/soc-2011-tomato/source/blender/editors/interface/interface_icons.c
    branches/soc-2011-tomato/source/blender/editors/interface/interface_intern.h
    branches/soc-2011-tomato/source/blender/editors/interface/interface_regions.c
    branches/soc-2011-tomato/source/blender/editors/interface/view2d.c
    branches/soc-2011-tomato/source/blender/editors/interface/view2d_ops.c
    branches/soc-2011-tomato/source/blender/editors/mesh/editface.c
    branches/soc-2011-tomato/source/blender/editors/object/object_constraint.c
    branches/soc-2011-tomato/source/blender/editors/object/object_relations.c
    branches/soc-2011-tomato/source/blender/editors/object/object_vgroup.c
    branches/soc-2011-tomato/source/blender/editors/screen/screen_edit.c
    branches/soc-2011-tomato/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2011-tomato/source/blender/editors/space_action/action_select.c
    branches/soc-2011-tomato/source/blender/editors/space_graph/graph_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_graph/graph_select.c
    branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c
    branches/soc-2011-tomato/source/blender/editors/space_logic/logic_window.c
    branches/soc-2011-tomato/source/blender/editors/space_nla/nla_select.c
    branches/soc-2011-tomato/source/blender/editors/space_node/node_edit.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/outliner_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/outliner_tree.c
    branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_edit.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/drawarmature.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_edit.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_header.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_select.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_view.c

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-50477
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-50483

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/action.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/action.c	2012-09-09 01:44:55 UTC (rev 50483)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/action.c	2012-09-09 08:33:42 UTC (rev 50484)
@@ -810,7 +810,7 @@
 	/* TODO: proxies may/may not be correctly handled here... (this needs checking) */
 	for (ob = G.main->object.first; ob; ob = ob->id.next) {
 		/* we only need to do this on objects with a pose */
-		if ( (pose = ob->pose) ) {
+		if ((pose = ob->pose)) {
 			for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
 				if (pchan->bone) 
 					pchan->bone->flag &= ~BONE_UNKEYED;

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/blender.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/blender.c	2012-09-09 01:44:55 UTC (rev 50483)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/blender.c	2012-09-09 08:33:42 UTC (rev 50484)
@@ -44,7 +44,8 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <string.h>
-#include <fcntl.h> // for open
+#include <fcntl.h>  /* for open */
+#include <errno.h>
 
 #include "MEM_guardedalloc.h"
 
@@ -518,8 +519,13 @@
 	int nr /*, success */ /* UNUSED */;
 	UndoElem *uel;
 	
-	if ( (U.uiflag & USER_GLOBALUNDO) == 0) return;
-	if (U.undosteps == 0) return;
+	if ((U.uiflag & USER_GLOBALUNDO) == 0) {
+		return;
+	}
+
+	if (U.undosteps == 0) {
+		return;
+	}
 	
 	/* remove all undos after (also when curundo == NULL) */
 	while (undobase.last != curundo) {
@@ -720,38 +726,60 @@
 {
 	UndoElem *uel;
 	MemFileChunk *chunk;
+	char str[FILE_MAX];
+	const int flag = O_BINARY + O_WRONLY + O_CREAT + O_TRUNC + O_EXCL;
 	int file;
-	char str[FILE_MAX];
-	
-	if ( (U.uiflag & USER_GLOBALUNDO) == 0) return;
-	
+
+	if ((U.uiflag & USER_GLOBALUNDO) == 0) {
+		return;
+	}
+
 	uel = curundo;
 	if (uel == NULL) {
-		printf("No undo buffer to save recovery file\n");
+		fprintf(stderr, "No undo buffer to save recovery file\n");
 		return;
 	}
-	
+
 	/* no undo state to save */
-	if (undobase.first == undobase.last) return;
-		
+	if (undobase.first == undobase.last) {
+		return;
+	}
+
+	/* save the undo state as quit.blend */
 	BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
 
-	file = BLI_open(str, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
+	/* first try create the file, if it exists call without 'O_CREAT',
+	 * to avoid writing to a symlink - use 'O_EXCL' (CVE-2008-1103) */
+	errno = 0;
+	file = BLI_open(str, flag, 0666);
 	if (file == -1) {
-		//XXX error("Unable to save %s, check you have permissions", str);
+		if (errno == EEXIST) {
+			errno = 0;
+			file = BLI_open(str, flag & ~O_CREAT, 0666);
+		}
+	}
+
+	if (file == -1) {
+		fprintf(stderr, "Unable to save '%s': %s\n",
+		        str, errno ? strerror(errno) : "Unknown error opening file");
 		return;
 	}
 
-	chunk = uel->memfile.chunks.first;
-	while (chunk) {
-		if (write(file, chunk->buf, chunk->size) != chunk->size) break;
-		chunk = chunk->next;
+	for (chunk = uel->memfile.chunks.first; chunk; chunk = chunk->next) {
+		if (write(file, chunk->buf, chunk->size) != chunk->size) {
+			break;
+		}
 	}
-	
+
 	close(file);
 	
-	if (chunk) ;  //XXX error("Unable to save %s, internal error", str);
-	else printf("Saved session recovery to %s\n", str);
+	if (chunk) {
+		fprintf(stderr, "Unable to save '%s': %s\n",
+		        str, errno ? strerror(errno) : "Unknown error writing file");
+	}
+	else {
+		printf("Saved session recovery to '%s'\n", str);
+	}
 }
 
 /* sets curscene */

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c	2012-09-09 01:44:55 UTC (rev 50483)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/constraint.c	2012-09-09 08:33:42 UTC (rev 50484)
@@ -4292,8 +4292,8 @@
 	}
 	
 	/* only return for valid types */
-	if ( (type >= CONSTRAINT_TYPE_NULL) && 
-	     (type < NUM_CONSTRAINT_TYPES) )
+	if ((type >= CONSTRAINT_TYPE_NULL) &&
+	    (type < NUM_CONSTRAINT_TYPES))
 	{
 		/* there shouldn't be any segfaults here... */
 		return constraintsTypeInfo[type];

Modified: branches/soc-2011-tomato/source/blender/editors/gpencil/drawgpencil.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/gpencil/drawgpencil.c	2012-09-09 01:44:55 UTC (rev 50483)
+++ branches/soc-2011-tomato/source/blender/editors/gpencil/drawgpencil.c	2012-09-09 08:33:42 UTC (rev 50484)
@@ -177,8 +177,8 @@
 		/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple dot looks ok
 		 *  - also mandatory in if Image Editor 'image-based' dot
 		 */
-		if ( (thickness < GP_DRAWTHICKNESS_SPECIAL) ||
-		     ((dflag & GP_DRAWDATA_IEDITHACK) && (sflag & GP_STROKE_2DSPACE)) )
+		if ((thickness < GP_DRAWTHICKNESS_SPECIAL) ||
+		    ((dflag & GP_DRAWDATA_IEDITHACK) && (sflag & GP_STROKE_2DSPACE)))
 		{
 			glBegin(GL_POINTS);
 			glVertex2fv(co);
@@ -253,8 +253,8 @@
 	/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, 'smooth' opengl lines look better
 	 *  - 'smooth' opengl lines are also required if Image Editor 'image-based' stroke
 	 */
-	if ( (thickness < GP_DRAWTHICKNESS_SPECIAL) || 
-	     ((dflag & GP_DRAWDATA_IEDITHACK) && (dflag & GP_DRAWDATA_ONLYV2D)) )
+	if ((thickness < GP_DRAWTHICKNESS_SPECIAL) ||
+	    ((dflag & GP_DRAWDATA_IEDITHACK) && (dflag & GP_DRAWDATA_ONLYV2D)))
 	{
 		bGPDspoint *pt;
 		int i;

Modified: branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c	2012-09-09 01:44:55 UTC (rev 50483)
+++ branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c	2012-09-09 08:33:42 UTC (rev 50484)
@@ -778,7 +778,8 @@
 }
 
 /* eraser tool - check if part of stroke occurs within last segment drawn by eraser */
-static short gp_stroke_eraser_strokeinside(int mval[], int UNUSED(mvalo[]), short rad, short x0, short y0, short x1, short y1)
+static short gp_stroke_eraser_strokeinside(const int mval[], const int UNUSED(mvalo[]),
+                                           int rad, int x0, int y0, int x1, int y1)
 {
 	/* simple within-radius check for now */
 	if (edge_inside_circle(mval[0], mval[1], rad, x0, y0, x1, y1))
@@ -790,7 +791,9 @@
 
 /* eraser tool - evaluation per stroke */
 // TODO: this could really do with some optimization (KD-Tree/BVH?)
-static void gp_stroke_eraser_dostroke(tGPsdata *p, int mval[], int mvalo[], short rad, rcti *rect, bGPDframe *gpf, bGPDstroke *gps)
+static void gp_stroke_eraser_dostroke(tGPsdata *p,
+                                      const int mval[], const int mvalo[],
+                                      short rad, const rcti *rect, bGPDframe *gpf, bGPDstroke *gps)
 {
 	bGPDspoint *pt1, *pt2;
 	int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
@@ -827,7 +830,7 @@
 		/* do boundbox check first */
 		if (BLI_rcti_isect_pt(rect, x0, y0)) {
 			/* only check if point is inside */
-			if ( ((x0 - mval[0]) * (x0 - mval[0]) + (y0 - mval[1]) * (y0 - mval[1])) <= rad * rad) {
+			if (((x0 - mval[0]) * (x0 - mval[0]) + (y0 - mval[1]) * (y0 - mval[1])) <= rad * rad) {
 				/* free stroke */
 				MEM_freeN(gps->points);
 				BLI_freelinkN(&gpf->strokes, gps);

Modified: branches/soc-2011-tomato/source/blender/editors/interface/interface.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/interface/interface.c	2012-09-09 01:44:55 UTC (rev 50483)
+++ branches/soc-2011-tomato/source/blender/editors/interface/interface.c	2012-09-09 08:33:42 UTC (rev 50484)
@@ -134,7 +134,7 @@
 	*y = (int)(fy + 0.5f);
 }
 
-void ui_block_to_window_rct(const ARegion *ar, uiBlock *block, rctf *graph, rcti *winr)
+void ui_block_to_window_rct(const ARegion *ar, uiBlock *block, const rctf *graph, rcti *winr)
 {
 	rctf tmpr;
 
@@ -1242,8 +1242,7 @@
 		else {
 			b = 0;
 			for (a = 0; a < (*(link->totlink)); a++) {
-				
-				if ( (*(link->ppoin))[a] != line->to->poin) {
+				if ((*(link->ppoin))[a] != line->to->poin) {
 					(*(link->ppoin))[b] = (*(link->ppoin))[a];
 					b++;
 				}
@@ -2468,7 +2467,7 @@
 					flag |= UI_BUT_ALIGN_TOP;
 				}
 				
-				if ( (flag & UI_BUT_ALIGN_TOP) == 0) {    /* stil top row */
+				if ((flag & UI_BUT_ALIGN_TOP) == 0) {  /* stil top row */
 					if (prev) {
 						if (next && buts_are_horiz(but, next))
 							flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT;


Property changes on: branches/soc-2011-tomato/source/blender/editors/interface/interface.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list