Revision: 15375
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15375
Author:   bdiego
Date:     2008-06-28 03:14:26 +0200 (Sat, 28 Jun 2008)

Log Message:
-----------
branches/blender-2.47

Merge from trunk:
        Revision: 15133
        Revision: 15135
        Revision: 15146
        Revision: 15220
        Revision: 15362

Modified Paths:
--------------
    branches/blender-2.47/source/blender/blenkernel/intern/text.c
    branches/blender-2.47/source/blender/blenlib/intern/bpath.c
    branches/blender-2.47/source/blender/blenlib/intern/util.c
    branches/blender-2.47/source/blender/nodes/intern/CMP_nodes/CMP_math.c
    branches/blender-2.47/source/blender/python/api2_2x/Blender.c
    branches/blender-2.47/source/blender/python/api2_2x/Sys.c
    branches/blender-2.47/source/blender/render/intern/source/shadbuf.c
    branches/blender-2.47/source/blender/src/editfont.c

Modified: branches/blender-2.47/source/blender/blenkernel/intern/text.c
===================================================================
--- branches/blender-2.47/source/blender/blenkernel/intern/text.c       
2008-06-28 00:07:22 UTC (rev 15374)
+++ branches/blender-2.47/source/blender/blenkernel/intern/text.c       
2008-06-28 01:14:26 UTC (rev 15375)
@@ -942,7 +942,8 @@
        if (!text) return NULL;
        if (!text->curl) return NULL;
        if (!text->sell) return NULL;
-               
+       if (!text->lines.first) return NULL;
+
        linef= text->lines.first;
        charf= 0;
                

Modified: branches/blender-2.47/source/blender/blenlib/intern/bpath.c
===================================================================
--- branches/blender-2.47/source/blender/blenlib/intern/bpath.c 2008-06-28 
00:07:22 UTC (rev 15374)
+++ branches/blender-2.47/source/blender/blenlib/intern/bpath.c 2008-06-28 
01:14:26 UTC (rev 15375)
@@ -456,13 +456,10 @@
        
        /* be sure there is low chance of the path being too short */
        char filepath_expanded[FILE_MAXDIR*2]; 
-       char *libpath;
        int files_missing = 0;
        
        BLI_bpathIterator_init(&bpi);
        while (!BLI_bpathIterator_isDone(&bpi)) {
-               libpath = BLI_bpathIterator_getLib(&bpi);
-               
                BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
                
                if (!BLI_exists(filepath_expanded)) {

Modified: branches/blender-2.47/source/blender/blenlib/intern/util.c
===================================================================
--- branches/blender-2.47/source/blender/blenlib/intern/util.c  2008-06-28 
00:07:22 UTC (rev 15374)
+++ branches/blender-2.47/source/blender/blenlib/intern/util.c  2008-06-28 
01:14:26 UTC (rev 15375)
@@ -865,11 +865,8 @@
 void BLI_cleanup_dir(const char *relabase, char *dir)
 {
        BLI_cleanup_file(relabase, dir);
-#ifdef WIN32
-       strcat(dir, "\\");
-#else
-       strcat(dir, "/");
-#endif
+       BLI_add_slash(dir);
+
 }
 
 void BLI_cleanup_file(const char *relabase, char *dir)
@@ -878,6 +875,13 @@
        char *start, *eind;
        if (relabase) {
                BLI_convertstringcode(dir, relabase);
+       } else {
+               if (dir[0]=='/' && dir[1]=='/') {
+                       if (dir[2]== '\0') {
+                               return; /* path is "//" - cant clean it */
+                       }
+                       dir = dir+2; /* skip the first // */
+               }
        }
        
        /* Note
@@ -901,8 +905,11 @@
                        if (dir[a] == '\\') break;
                        a--;
                }
-               memmove( dir+a, eind, strlen(eind)+1 );
-               
+               if (a<0) {
+                       break;
+               } else {
+                       memmove( dir+a, eind, strlen(eind)+1 );
+               }
        }
 
        while ( (start = strstr(dir,"\\.\\")) ){
@@ -935,7 +942,11 @@
                        if (dir[a] == '/') break;
                        a--;
                }
-               memmove( dir+a, eind, strlen(eind)+1 );
+               if (a<0) {
+                       break;
+               } else {
+                       memmove( dir+a, eind, strlen(eind)+1 );
+               }
        }
 
        while ( (start = strstr(dir,"/./")) ){
@@ -1124,8 +1135,8 @@
        char vol[3] = {'\0', '\0', '\0'};
 
        BLI_strncpy(vol, path, 3);
-       wasrelative= (strncmp(vol, "//", 2)==0);
-
+       wasrelative= (vol[0]=='/' && vol[1]=='/');
+       
 #ifdef WIN32
        /* we are checking here if we have an absolute path that is not in the 
current
           blend file as a lib main - we are basically checking for the case 
that a 
@@ -1160,24 +1171,32 @@
        BLI_char_switch(tmp, '\\', '/');
        BLI_char_switch(base, '\\', '/');       
 
-       if (tmp[0] == '/' && tmp[1] == '/') {
-               char *filepart= BLI_strdup(tmp+2); /* skip code */
+       /* Paths starting with // will get the blend file as their base,
+        * this isnt standard in any os but is uesed in blender all over the 
place */
+       if (wasrelative) {
                char *lslash= BLI_last_slash(base);
-
                if (lslash) {
                        int baselen= (int) (lslash-base) + 1;
-
+                       /* use path for for temp storage here, we copy back 
over it right away */
+                       BLI_strncpy(path, tmp+2, FILE_MAX);
+                       
                        memcpy(tmp, base, baselen);
-                       strcpy(tmp+baselen, filepart);
+                       strcpy(tmp+baselen, path);
+                       strcpy(path, tmp);
                } else {
-                       strcpy(tmp, filepart);
+                       strcpy(path, tmp+2);
                }
-               
-               MEM_freeN(filepart);
+       } else {
+               strcpy(path, tmp);
        }
        
-       BLI_cleanup_file(NULL, tmp);
-       strcpy(path, tmp);
+       if (path[0]!='\0') {
+               if ( path[strlen(path)-1]=='/') {
+                       BLI_cleanup_dir(NULL, path);
+               } else {
+                       BLI_cleanup_file(NULL, path);
+               }
+       }
        
 #ifdef WIN32
        /* skip first two chars, which in case of

Modified: branches/blender-2.47/source/blender/nodes/intern/CMP_nodes/CMP_math.c
===================================================================
--- branches/blender-2.47/source/blender/nodes/intern/CMP_nodes/CMP_math.c      
2008-06-28 00:07:22 UTC (rev 15374)
+++ branches/blender-2.47/source/blender/nodes/intern/CMP_nodes/CMP_math.c      
2008-06-28 01:14:26 UTC (rev 15375)
@@ -57,7 +57,7 @@
                break; 
        case 3: /* Divide */
                {
-                       if(in[1]==0)    /* We don't want to divide by zero. */
+                       if(in2[0]==0)   /* We don't want to divide by zero. */
                                out[0]= 0.0;
                        else
                                out[0]= in[0] / in2[0];

Modified: branches/blender-2.47/source/blender/python/api2_2x/Blender.c
===================================================================
--- branches/blender-2.47/source/blender/python/api2_2x/Blender.c       
2008-06-28 00:07:22 UTC (rev 15374)
+++ branches/blender-2.47/source/blender/python/api2_2x/Blender.c       
2008-06-28 01:14:26 UTC (rev 15375)
@@ -936,6 +936,7 @@
        PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe 
*/
        /* be sure there is low chance of the path being too short */
        char filepath_expanded[FILE_MAXDIR*2]; 
+       char *lib;
        
        int absolute = 0;
        static char *kwlist[] = {"absolute", NULL};
@@ -952,7 +953,12 @@
                if (absolute) {
                        BLI_bpathIterator_getPathExpanded( &bpi, 
filepath_expanded );
                } else {
-                       BLI_bpathIterator_getPathExpanded( &bpi, 
filepath_expanded );
+                       lib = BLI_bpathIterator_getLib( &bpi );
+                       if ( lib && ( strcmp(lib, G.sce) ) ) { /* relative path 
to the library is NOT the same as our blendfile path, return an absolute path */
+                               BLI_bpathIterator_getPathExpanded( &bpi, 
filepath_expanded );
+                       } else {
+                               BLI_bpathIterator_getPath( &bpi, 
filepath_expanded );
+                       }
                }
                st = PyString_FromString(filepath_expanded);
                

Modified: branches/blender-2.47/source/blender/python/api2_2x/Sys.c
===================================================================
--- branches/blender-2.47/source/blender/python/api2_2x/Sys.c   2008-06-28 
00:07:22 UTC (rev 15374)
+++ branches/blender-2.47/source/blender/python/api2_2x/Sys.c   2008-06-28 
01:14:26 UTC (rev 15375)
@@ -406,11 +406,12 @@
 {
        char *path = PyString_AsString(value);
        char cleaned[FILE_MAXDIR + FILE_MAXFILE];
-       int trailing_slash = 0;
+       int trailing_slash = 0, last;
        if (!path)
                return EXPP_ReturnPyObjError( PyExc_TypeError,
                        "expected string argument" );
-       if (strstr(path, "/") || strstr(path, "\\")) {
+       last = strlen(path)-1;
+       if ((last >= 0) && ((path[last]=='/') || (path[last]=='\\'))) {
                trailing_slash = 1;
        }
        BLI_strncpy(cleaned, path, FILE_MAXDIR + FILE_MAXFILE);

Modified: branches/blender-2.47/source/blender/render/intern/source/shadbuf.c
===================================================================
--- branches/blender-2.47/source/blender/render/intern/source/shadbuf.c 
2008-06-28 00:07:22 UTC (rev 15374)
+++ branches/blender-2.47/source/blender/render/intern/source/shadbuf.c 
2008-06-28 01:14:26 UTC (rev 15375)
@@ -636,7 +636,7 @@
        else {
                /* got warning on this for 64 bits.... */
                /* but it's working code! in this case rz is not a pointer but 
zvalue (ton) */
-               zsamp= (int) rz;
+               zsamp= GET_INT_FROM_POINTER(rz);
        }
 
        /* tricky stuff here; we use ints which can overflow easily with bias 
values */
@@ -816,7 +816,7 @@
        else {
                /* same as before */
                /* still working code! (ton) */
-               zsamp= (int) rz;
+               zsamp= GET_INT_FROM_POINTER(rz);
        }
 
        /* NO schadow when sampled at 'eternal' distance */

Modified: branches/blender-2.47/source/blender/src/editfont.c
===================================================================
--- branches/blender-2.47/source/blender/src/editfont.c 2008-06-28 00:07:22 UTC 
(rev 15374)
+++ branches/blender-2.47/source/blender/src/editfont.c 2008-06-28 01:14:26 UTC 
(rev 15375)
@@ -354,7 +354,7 @@
 //     char sdir[FILE_MAXDIR];
 //     char sfile[FILE_MAXFILE];
 
-       if(!text) return;
+       if(!text || !text->lines.first) return;
 
        id = (ID *)text;
 
@@ -429,7 +429,7 @@
        int linenum = 0;
        float offset[3] = {0.0,0.0,0.0};
 
-       if(!text) return;
+       if(!text || !text->lines.first) return;
 
        id = (ID *)text;
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to