[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39958] branches/soc-2011-garlic: fix the setenv bug on windows

xiao xiangquan xiaoxiangquan at gmail.com
Tue Sep 6 07:18:03 CEST 2011


Revision: 39958
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39958
Author:   xiaoxiangquan
Date:     2011-09-06 05:18:02 +0000 (Tue, 06 Sep 2011)
Log Message:
-----------
fix the setenv bug on windows

Modified Paths:
--------------
    branches/soc-2011-garlic/CMakeLists.txt
    branches/soc-2011-garlic/source/blender/blenfont/intern/blf_lang.c
    branches/soc-2011-garlic/source/blender/blenlib/intern/path_util.c

Removed Paths:
-------------
    branches/soc-2011-garlic/source/blender/editors/space_outliner/outliner.c

Modified: branches/soc-2011-garlic/CMakeLists.txt
===================================================================
--- branches/soc-2011-garlic/CMakeLists.txt	2011-09-06 05:04:26 UTC (rev 39957)
+++ branches/soc-2011-garlic/CMakeLists.txt	2011-09-06 05:18:02 UTC (rev 39958)
@@ -565,8 +565,6 @@
 		set(ICONV_INCLUDE_DIRS ${ICONV}/include)
 		set(ICONV_LIBRARIES iconv)
 		set(ICONV_LIBPATH ${ICONV}/lib)
-		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MD")
-		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MD")
 	endif()
 
 	if(WITH_SAMPLERATE)

Modified: branches/soc-2011-garlic/source/blender/blenfont/intern/blf_lang.c
===================================================================
--- branches/soc-2011-garlic/source/blender/blenfont/intern/blf_lang.c	2011-09-06 05:04:26 UTC (rev 39957)
+++ branches/soc-2011-garlic/source/blender/blenfont/intern/blf_lang.c	2011-09-06 05:18:02 UTC (rev 39958)
@@ -67,89 +67,34 @@
 static char global_encoding_name[32];
 
 /* map from the rna_userdef.c:rna_def_userdef_system(BlenderRNA *brna):language_items */
-
-static char *long_locales[] = {
-	"",
-	"english",
-	"japanese",
-	"dutch",
-	"italian",
-	"german",
-	"finnish",
-	"swedish",
-	"french",
-	"spanish",
-	"catalan",
-	"czech",
-	"ptb",
-	"chs",
-	"cht",
-	"russian",
-	"croatian",
-	"serbian",
-	"ukrainian",
-	"polish",
-	"romanian",
-	"arabic",
-	"bulgarian",
-	"greek",
-	"korean"
+static char *locales[] = {
+	"", "",
+	"english", "en_US",
+	"japanese", "ja_JP",
+	"dutch", "nl_NL",
+	"italian", "it_IT",
+	"german", "de_DE",
+	"finnish", "fi_FI",
+	"swedish", "sv_SE",
+	"french", "fr_FR",
+	"spanish", "es_ES",
+	"catalan", "ca_AD",
+	"czech", "cs_CZ",
+	"ptb", "pt_BR",
+	"chs", "zh_CN",
+	"cht", "zh_TW",
+	"russian", "ru_RU",
+	"croatian", "hr_HR",
+	"serbian", "sr_RS",
+	"ukrainian", "uk_UA",
+	"polish", "pl_PL",
+	"romanian", "ro_RO",
+	"arabic", "ar_EG",
+	"bulgarian", "bg_BG",
+	"greek", "el_GR",
+	"korean" "ko_KR",
 };
 
-static char short_locale_default[] = "";
-static char short_locale_english[] = "en_US";
-static char short_locale_japanese[] = "ja_JP";
-static char short_locale_dutch[] = "nl_NL";
-static char short_locale_italian[] = "it_IT";
-static char short_locale_german[] = "de_DE";
-static char short_locale_finnish[] = "fi_FI";
-static char short_locale_swedish[] = "sv_SE";
-static char short_locale_french[] = "fr_FR";
-static char short_locale_spanish[] = "es_ES";
-static char short_locale_catalan[] = "ca_AD";
-static char short_locale_czech[] = "cs_CZ";
-static char short_locale_bra_portuguese[] = "pt_BR";
-static char short_locale_sim_chinese[] = "zh_CN";
-static char short_locale_tra_chinese[] = "zh_TW";
-static char short_locale_russian[] = "ru_RU";
-static char short_locale_croatian[] = "hr_HR";
-static char short_locale_serbian[] = "sr_RS";
-static char short_locale_ukrainian[] = "uk_UA";
-static char short_locale_polish[] = "pl_PL";
-static char short_locale_romanian[] = "ro_RO";
-static char short_locale_arabic[] = "ar_EG";
-static char short_locale_bulgarian[] = "bg_BG";
-static char short_locale_greek[] = "el_GR";
-static char short_locale_korean[] = "ko_KR";
-
-static char *short_locales[] = {
-		short_locale_default,
-		short_locale_english, /* us english is the default language of blender */
-		short_locale_japanese,
-		short_locale_dutch,
-		short_locale_italian,
-		short_locale_german,
-		short_locale_finnish,
-		short_locale_swedish,
-		short_locale_french,
-		short_locale_spanish,
-		short_locale_catalan,
-		short_locale_czech,
-		short_locale_bra_portuguese,
-		short_locale_sim_chinese,
-		short_locale_tra_chinese,
-		short_locale_russian,
-		short_locale_croatian,
-		short_locale_serbian,
-		short_locale_ukrainian,
-		short_locale_polish,
-		short_locale_romanian,
-		short_locale_arabic,
-		short_locale_bulgarian,
-		short_locale_greek,
-		short_locale_korean,
-};
-
 void BLF_lang_init(void)
 {
 	char *messagepath= BLI_get_folder(BLENDER_DATAFILES, "locale");
@@ -169,26 +114,36 @@
 	char *locreturn;
 	char *short_locale;
 #if defined (_WIN32)
-	char *long_locale = long_locales[U.language];
+	char *long_locale = locales[ 2 * U.language];
 #endif
 
 	if(str)
 		short_locale = str;
 	else
-		short_locale = short_locales[U.language];
+		short_locale = locales[ 2 * U.language + 1];
 
+#if defined (_WIN32)
 	if(short_locale)
 	{
-		BLI_setenv("LANG", short_locale);
-		BLI_setenv("LANGUAGE", short_locale);
+		char *envStr;
+		if( U.language==0 )/* use system setting */
+			envStr = BLI_sprintfN( "LANG=%s", getenv("LANG") );
+		else
+			envStr = BLI_sprintfN( "LANG=%s", short_locale );
+		gettext_putenv(envStr);
+		MEM_freeN(envStr);
 	}
-
-#if defined (_WIN32)
 	locreturn= setlocale(LC_ALL, long_locale);
 	if (locreturn == NULL) {
 		printf("Could not change locale to %s\n", long_locale);
 	}
 #else
+	if(short_locale)
+	{
+		BLI_setenv("LANG", short_locale);
+		BLI_setenv("LANGUAGE", short_locale);
+	}
+
 	locreturn= setlocale(LC_ALL, short_locale);
 	if (locreturn == NULL) {
 		char *short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale);

Modified: branches/soc-2011-garlic/source/blender/blenlib/intern/path_util.c
===================================================================
--- branches/soc-2011-garlic/source/blender/blenlib/intern/path_util.c	2011-09-06 05:04:26 UTC (rev 39957)
+++ branches/soc-2011-garlic/source/blender/blenlib/intern/path_util.c	2011-09-06 05:18:02 UTC (rev 39958)
@@ -72,7 +72,6 @@
 #endif
 #define _WIN32_IE 0x0501
 #include <windows.h>
-#include <Winbase.h>
 #include <shlobj.h>
 
 #include "BLI_winstuff.h"
@@ -1158,13 +1157,14 @@
 {
 	/* SGI or free windows */
 #if (defined(__sgi) || ((defined(WIN32) || defined(WIN64)) && defined(FREE_WINDOWS)))
-	char *envstr= BLI_sprintfN("%s=%s", env, val);
+	char *envstr= MEM_mallocN(sizeof(char) * (strlen(env) + strlen(val) + 2), "envstr"); /* one for = another for \0 */
+
+	sprintf(envstr, "%s=%s", env, val);
 	putenv(envstr);
 	MEM_freeN(envstr);
 
 	/* non-free windows */
 #elif (defined(WIN32) || defined(WIN64)) /* not free windows */
-	SetEnvironmentVariableA(env, val);
 	_putenv_s(env, val);
 #else
 	/* linux/osx/bsd */

Deleted: branches/soc-2011-garlic/source/blender/editors/space_outliner/outliner.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/space_outliner/outliner.c	2011-09-06 05:04:26 UTC (rev 39957)
+++ branches/soc-2011-garlic/source/blender/editors/space_outliner/outliner.c	2011-09-06 05:18:02 UTC (rev 39958)
@@ -1,5794 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_outliner/outliner.c
- *  \ingroup spoutliner
- */
-
-
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_anim_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_group_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_world_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_object_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-#include "BLI_math_base.h"
-
-#include "BLF_api.h"
-
-#if defined WIN32 && !defined _LIBC
-# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
-#else
-#  ifndef _GNU_SOURCE
-#    define _GNU_SOURCE
-#  endif
-# include <fnmatch.h>
-#endif
-
-
-#include "BKE_animsys.h"
-#include "BKE_context.h"
-#include "BKE_deform.h"
-#include "BKE_depsgraph.h"
-#include "BKE_fcurve.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_modifier.h"
-#include "BKE_report.h"
-#include "BKE_scene.h"
-#include "BKE_sequencer.h"
-
-#include "ED_armature.h"
-#include "ED_object.h"
-#include "ED_screen.h"
-#include "ED_util.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "UI_interface.h"
-#include "UI_interface_icons.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "ED_keyframing.h"
-
-#include "outliner_intern.h"
-
-
-#define OL_Y_OFFSET	2
-
-#define OL_TOG_RESTRICT_VIEWX	(UI_UNIT_X*3)
-#define OL_TOG_RESTRICT_SELECTX	(UI_UNIT_X*2)
-#define OL_TOG_RESTRICT_RENDERX	UI_UNIT_X
-
-#define OL_TOGW OL_TOG_RESTRICT_VIEWX
-
-#define OL_RNA_COLX			(UI_UNIT_X*15)
-#define OL_RNA_COL_SIZEX	(UI_UNIT_X*7.5)
-#define OL_RNA_COL_SPACEX	(UI_UNIT_X*2.5)
-
-#define TS_CHUNK	128
-
-#define TREESTORE(a) ((a)?soops->treestore->data+(a)->store_index:NULL)
-
-/* ************* XXX **************** */
-
-static void error(const char *UNUSED(arg), ...) {}
-
-/* ********************************** */
-
-
-/* ******************** PROTOTYPES ***************** */
-static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty);
-static void outliner_do_object_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, 
-										 void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *));
-
-static int group_select_flag(Group *gr);
-
-/* ******************** PERSISTANT DATA ***************** */
-
-static void outliner_storage_cleanup(SpaceOops *soops)
-{
-	TreeStore *ts= soops->treestore;
-	
-	if(ts) {
-		TreeStoreElem *tselem;
-		int a, unused= 0;
-		

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list