strip quites off buildinfo at startup (was doing this for splash screen and python...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 14 Mar 2010 17:18:36 +0000 (17:18 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 14 Mar 2010 17:18:36 +0000 (17:18 +0000)
source/blender/python/intern/bpy_app.c
source/blender/python/intern/bpy_interface.c
source/blender/windowmanager/intern/wm_operators.c
source/creator/buildinfo.c
source/creator/creator.c

index be0406ce7c755bc6170a0850615781fdd10bbe87..ce5eea728a8e2989c3167e56b9df8691a1dca3f2 100644 (file)
 
 #include "bpy_app.h"
 
+#include "BLI_path_util.h"
+
 #include "BKE_blender.h"
 #include "BKE_global.h"
 #include "structseq.h"
 
 #ifdef BUILD_DATE
-extern const char * build_date;
-extern const char * build_time;
-extern const char * build_rev;
-extern const char * build_platform;
-extern const char * build_type;
+extern char build_date[];
+extern char build_time[];
+extern char build_rev[];
+extern char build_platform[];
+extern char build_type[];
 #endif
 
 static PyTypeObject BlenderAppType;
@@ -61,24 +63,9 @@ static PyStructSequence_Desc app_info_desc = {
        10
 };
 
-static char *strip_quotes(char *buf, const char *input)
-{
-       int i;
-       strcpy(buf, input);
-       if(buf[0]=='\0') return buf;
-       while(buf[1] && (buf[0]=='"' || buf[0]=='\'')) buf++;
-       if(buf[0]=='\0') return buf;
-       i= strlen(buf) - 1;
-       while(i>=0 && (buf[i]=='"' || buf[i]=='\'')) i--;
-       buf[i+1]= '\0';
-
-       return buf;
-}
-
 static PyObject *make_app_info(void)
 {
        extern char bprogname[]; /* argv[0] from creator.c */
-       char buf[256];
 
        PyObject *app_info;
        int pos = 0;
@@ -103,11 +90,11 @@ static PyObject *make_app_info(void)
 
        /* build info */
 #ifdef BUILD_DATE
-       SetStrItem(strip_quotes(buf, build_date));
-       SetStrItem(strip_quotes(buf, build_time));
-       SetStrItem(strip_quotes(buf, build_rev));
-       SetStrItem(strip_quotes(buf, build_platform));
-       SetStrItem(strip_quotes(buf, build_type));
+       SetStrItem(build_date);
+       SetStrItem(build_time);
+       SetStrItem(build_rev);
+       SetStrItem(build_platform);
+       SetStrItem(build_type);
 #else
        SetStrItem(strip_quotes(buf, "Unknown"));
        SetStrItem(strip_quotes(buf, "Unknown"));
index a4acaba86118e6f4984d296ca944ea42657e59af..8e93751a49033834f20e92c300c05a0554b9801f 100644 (file)
@@ -526,12 +526,6 @@ int BPY_run_python_script_space(const char *modulename, const char *func)
 }
 #endif
 
-// #define TIME_REGISTRATION
-
-#ifdef TIME_REGISTRATION
-//(INCLUDE_LINT)#include "PIL_time.h"
-#endif
-
 
 int BPY_button_eval(bContext *C, char *expr, double *value)
 {
index 4d8e48f1e8ef30659b5a6bb060dfc338dc1c3e53..7d16fba404ce36f643691cc4a8b1abfcfa02b4a6 100644 (file)
@@ -1060,7 +1060,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
        char *revision_str = NULL;
        char version_buf[128];
        char revision_buf[128];
-       extern char * build_rev;
+       extern char build_rev[];
        char *cp;
        
        version_str = &version_buf[0];
@@ -1069,16 +1069,6 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
        sprintf(version_str, "%d.%02d.%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
        sprintf(revision_str, "r%s", build_rev);
        
-       /* here on my system I get ugly double quotes around the revision number.
-        * if so, clip it off: */
-       cp = strchr(revision_str, '"');
-       if (cp) {
-               memmove(cp, cp+1, strlen(cp+1));
-               cp = strchr(revision_str, '"');
-               if (cp)
-                       *cp = 0;
-       }
-       
        BLF_size(style->widgetlabel.points, U.dpi);
        ver_width = BLF_width(version_str)+5;
        rev_width = BLF_width(revision_str)+5;
index d50a99e8850aac67e5b4c4bd630feae1aba17305..8b02dde1a5fcc55bbc7605d7ea46d9a2bf10809e 100644 (file)
@@ -35,9 +35,9 @@
 #define XSTRINGIFY(x) #x
 
 #ifdef BUILD_DATE
-const char * build_date=STRINGIFY(BUILD_DATE);
-const char * build_time=STRINGIFY(BUILD_TIME);
-const char * build_rev=STRINGIFY(BUILD_REV);
-const char * build_platform=STRINGIFY(BUILD_PLATFORM);
-const char * build_type=STRINGIFY(BUILD_TYPE);
+char build_date[]= STRINGIFY(BUILD_DATE);
+char build_time[]= STRINGIFY(BUILD_TIME);
+char build_rev[]= STRINGIFY(BUILD_REV);
+char build_platform[]= STRINGIFY(BUILD_PLATFORM);
+char build_type[]= STRINGIFY(BUILD_TYPE);
 #endif
index 9e910b7cad2eb1492b93147aa7aaad32c63054e2..91b4ed09b402cc6de4f9518b72d266f306599302 100644 (file)
 
 // from buildinfo.c
 #ifdef BUILD_DATE
-extern const char * build_date;
-extern const char * build_time;
-extern const char * build_rev;
-extern const char * build_platform;
-extern const char * build_type;
+extern char build_date[];
+extern char build_time[];
+extern char build_rev[];
+extern char build_platform[];
+extern char build_type[];
 #endif
 
 /*     Local Function prototypes */
@@ -161,6 +161,18 @@ static void blender_esc(int sig)
        }
 }
 
+/* buildinfo can have quotes */
+static void strip_quotes(char *str)
+{
+    if(str[0] == '"') {
+        int len= strlen(str) - 1;
+        memmove(str, str+1, len);
+        if(str[len-1] == '"') {
+            str[len-1]= '\0';
+        }
+    }
+}
+
 static int print_version(int argc, char **argv, void *data)
 {
 #ifdef BUILD_DATE
@@ -936,7 +948,15 @@ int main(int argc, char **argv)
                if(blender_path_env)
                        BLI_strncpy(blender_path, blender_path_env, sizeof(blender_path));
        }
-       
+
+#ifdef BUILD_DATE      
+    strip_quotes(build_date);
+    strip_quotes(build_time);
+    strip_quotes(build_rev);
+    strip_quotes(build_platform);
+    strip_quotes(build_type);
+#endif
+
        RNA_init();
        RE_engines_init();