[Bf-committers] patches for bugs #458 and #424
Nathan Letwory
bf-committers@blender.org
Mon, 01 Dec 2003 15:48:25 +0200
This is a multi-part message in MIME format.
--------------020205030504050902050202
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Attached two patches.
* const_error_msvc7.patch resolves bug #458, but people should test it.
I tested it myself on Windows XP Professional and Redhat Linux 9. This
patch allows for gameengine (Ode) compilation with MSVC7
* util_fileselect_bug.patch resolves bug #424. I've tested it quite
extensive, but didn't find any issues with it. Comments are included in
the patched code (three lines comments, two lines code).
Test and see if they are fit for 2.31a. Patches are made agains CVS
(HEAD) of today checked out about an hour or two ago (using TortoiseCVS
-> make patch).
/Nathan Letwory (jesterKing)
--------------020205030504050902050202
Content-Type: text/plain;
name="const_error_msvc7.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="const_error_msvc7.patch"
Index: source/gameengine/Expressions/Value.cpp
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/gameengine/Expressions/Value.cpp,v
retrieving revision 1.2
diff -u -r1.2 Value.cpp
--- source/gameengine/Expressions/Value.cpp 25 Nov 2002 15:29:41 -0000 1.2
+++ source/gameengine/Expressions/Value.cpp 1 Dec 2003 13:46:39 -0000
@@ -284,7 +284,7 @@
// Make sure we have a property array
if (m_pNamedPropertyArray == NULL)
- m_pNamedPropertyArray = new std::map<const STR_String,CValue *>;
+ m_pNamedPropertyArray = new std::map<STR_String,CValue *>;
// Try to replace property (if so -> exit as soon as we replaced it)
CValue* oldval = (*m_pNamedPropertyArray)[name];
@@ -308,7 +308,7 @@
CValue* result = NULL;
if (m_pNamedPropertyArray)
{
- std::map<const STR_String,CValue*>::iterator it = (*m_pNamedPropertyArray).find(inName);
+ std::map<STR_String,CValue*>::iterator it = (*m_pNamedPropertyArray).find(inName);
if (!( it==m_pNamedPropertyArray->end()))
{
result = (*it).second;
@@ -376,7 +376,7 @@
return;
// Remove all properties
- for ( std::map<const STR_String,CValue*>::iterator it = m_pNamedPropertyArray->begin();
+ for ( std::map<STR_String,CValue*>::iterator it = m_pNamedPropertyArray->begin();
!(it == m_pNamedPropertyArray->end());it++)
{
CValue* tmpval = (*it).second;
@@ -430,7 +430,7 @@
if (m_pNamedPropertyArray)
{
- for ( std::map<const STR_String,CValue*>::iterator it = m_pNamedPropertyArray->begin();
+ for ( std::map<STR_String,CValue*>::iterator it = m_pNamedPropertyArray->begin();
!(it == m_pNamedPropertyArray->end());it++)
{
if (count++==inIndex)
@@ -467,7 +467,7 @@
if (m_pNamedPropertyArray)
{
replica->m_pNamedPropertyArray=NULL;
- for ( std::map<const STR_String,CValue*>::iterator it = m_pNamedPropertyArray->begin();
+ for ( std::map<STR_String,CValue*>::iterator it = m_pNamedPropertyArray->begin();
!(it == m_pNamedPropertyArray->end());it++)
{
Index: source/gameengine/Expressions/Value.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/gameengine/Expressions/Value.h,v
retrieving revision 1.4
diff -u -r1.4 Value.h
--- source/gameengine/Expressions/Value.h 27 Dec 2002 13:10:39 -0000 1.4
+++ source/gameengine/Expressions/Value.h 1 Dec 2003 13:46:39 -0000
@@ -357,7 +357,7 @@
virtual ~CValue();
private:
// Member variables
- std::map<const STR_String,CValue*>* m_pNamedPropertyArray; // Properties for user/game etc
+ std::map<STR_String,CValue*>* m_pNamedPropertyArray; // Properties for user/game etc
ValueFlags m_ValFlags; // Frequently used flags in a bitfield (low memoryusage)
int m_refcount; // Reference Counter
static double m_sZeroVec[3];
--------------020205030504050902050202
Content-Type: text/plain;
name="util_fileselect_bug.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="util_fileselect_bug.patch"
Index: source/blender/blenlib/intern/util.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenlib/intern/util.c,v
retrieving revision 1.9
diff -u -r1.9 util.c
--- source/blender/blenlib/intern/util.c 25 Oct 2003 14:09:17 -0000 1.9
+++ source/blender/blenlib/intern/util.c 1 Dec 2003 13:44:31 -0000
@@ -676,24 +676,30 @@
if (string[0] == '/' || string[0] == '\\') {
strcpy(dir, string);
} else if (string[1] == ':' && string[2] == '\\') {
- strcpy(dir, string);
- } else {
- BLI_getwdN(dir);
- strcat(dir,"/");
- strcat(dir,string);
- strcpy(string,dir);
- }
-
- BLI_make_exist(dir);
-
- if (S_ISDIR(BLI_exist(dir))) {
- strcpy(file,string + strlen(dir));
+ strcpy(dir, string);
+ } else {
+ BLI_getwdN(dir);
+ strcat(dir,"/");
+ strcat(dir,string);
+ strcpy(string,dir);
+ }
- if (strrchr(file,'\\')) strcpy(file,strrchr(file,'\\')+1);
-
- if (a = strlen(dir)) {
- if (dir[a-1] != '\\') strcat(dir,"\\");
- }
+ BLI_make_exist(dir);
+
+ // BLI_exist doesn't recognize a slashed dirname as a dir
+ // check if a trailing slash exists, and remove it. Do not do this
+ // when we are already at root. -jesterKing
+ a = strlen(dir);
+ if(a>=4 && dir[a-1]=='\\') dir[a-1] = 0;
+
+ if (S_ISDIR(BLI_exist(dir))) {
+ strcpy(file,string + strlen(dir));
+
+ if (strrchr(file,'\\')) strcpy(file,strrchr(file,'\\')+1);
+
+ if (a = strlen(dir)) {
+ if (dir[a-1] != '\\') strcat(dir,"\\");
+ }
}
else {
a = strlen(dir) - 1;
--------------020205030504050902050202--