From 383414c1a4107eb1248b0ca87e8faba17242f1c2 Mon Sep 17 00:00:00 2001 From: mycae Date: Feb 05 2014 21:15:37 +0000 Subject: * Add upstream patches * rebuild for mathgl2 --- diff --git a/3Depict-0.0.15-upstream.patch b/3Depict-0.0.15-upstream.patch new file mode 100644 index 0000000..47611e7 --- /dev/null +++ b/3Depict-0.0.15-upstream.patch @@ -0,0 +1,192 @@ +diff -r 7fba7ef21117 -r f104ace19a51 src/backend/APT/APTRanges.cpp +--- src/backend/APT/APTRanges.cpp Sat Jan 18 17:45:15 2014 +0100 ++++ src/backend/APT/APTRanges.cpp Wed Feb 05 22:08:32 2014 +0100 +@@ -26,7 +26,6 @@ + + #include + #include +-#include + #include + #include + +@@ -484,15 +483,7 @@ + } + + +- //switch to "C" style decimal notation (English), +- //as needed +- char *oldLocale=setlocale(LC_NUMERIC,NULL); +- +- //setlocale reserves the right to trash the returned pointer +- //on subsequent calls (it totally makes sense, or something..). +- oldLocale=strdup(oldLocale); +- if(strcmp(oldLocale,"C")) +- setlocale(LC_NUMERIC,"C"); ++ pushLocale("C",LC_NUMERIC); + + size_t errCode; + switch(fileFormat) +@@ -521,31 +512,19 @@ + default: + ASSERT(false); + fclose(fpRange); +- if(strcmp(oldLocale,"C")) +- setlocale(LC_NUMERIC,oldLocale); +- free(oldLocale); ++ popLocale(); + return RANGE_ERR_FORMAT; + } + ++ popLocale(); + fclose(fpRange); + if(errCode) + { + errState=errCode; +- +- if(strcmp(oldLocale,"C")) +- setlocale(LC_NUMERIC,oldLocale); +- free(oldLocale); + + return errState; + } + +- //revert back to user's locale, as needed +- if(strcmp(oldLocale,"C")) +- setlocale(LC_NUMERIC,oldLocale); +- +- free(oldLocale); +- +- + //Run self consistency check on freshly loaded data + if(!isSelfConsistent()) + { +diff -r 7fba7ef21117 -r f104ace19a51 src/backend/filters/transform.cpp +--- src/backend/filters/transform.cpp Sat Jan 18 17:45:15 2014 +0100 ++++ src/backend/filters/transform.cpp Wed Feb 05 22:08:32 2014 +0100 +@@ -1110,7 +1110,15 @@ + return ERR_CALLBACK_FAIL; + } + //Shuffle the value data.TODO: callback functor ++ ++#ifndef HAVE_CPP1X ++ std::srand(time(0)); + std::random_shuffle(massData.begin(),massData.end()); ++#else ++ std::mt19937_64 r; ++ r.seed(time(0)); ++ std::shuffle(massData.begin(),massData.end(),r); ++#endif + if(!(*callback)(true)) + { + delete d; +diff -r 7fba7ef21117 -r f104ace19a51 src/common/basics.cpp +--- src/common/basics.cpp Sat Jan 18 17:45:15 2014 +0100 ++++ src/common/basics.cpp Wed Feb 05 22:08:32 2014 +0100 +@@ -41,6 +41,9 @@ + #include + #endif + ++#include ++#include ++ + using std::string; + using std::vector; + using std::list; +@@ -65,6 +68,9 @@ + //default font to use. + std::string defaultFontFile; + ++static char *oldLocaleStatic; ++static int localeStaticType; ++ + unsigned int getBitNum(unsigned int u) + { + ASSERT(u); +@@ -86,6 +92,45 @@ + return "0"; + } + ++void pushLocale(const char *newLocale, int type) ++{ ++ ASSERT(!oldLocaleStatic); ++ ASSERT(!localeStaticType); ++ ++ ASSERT(type == LC_NUMERIC || type == LC_MONETARY || type == LC_CTYPE ++ || type == LC_COLLATE || type == LC_ALL || type == LC_TIME ++ || type== LC_MESSAGES); ++ ++ oldLocaleStatic=setlocale(type,NULL); ++ ++ //setlocale reserves the right to trash the returned pointer ++ // on subsequent calls (i.e. use the returned pointer for later) ++ // thus we must duplicate the pointer to own it ++ oldLocaleStatic=strdup(oldLocaleStatic); ++ if(strcmp(oldLocaleStatic,newLocale)) ++ { ++ setlocale(type,newLocale); ++ localeStaticType=type; ++ } ++ else ++ { ++ //record that we did not set this ++ localeStaticType=-1; ++ } ++ ++} ++ ++void popLocale() ++{ ++ if(localeStaticType != -1) ++ setlocale(localeStaticType,oldLocaleStatic); ++ ++ localeStaticType=0; ++ ++ free(oldLocaleStatic); ++ oldLocaleStatic=0; ++} ++ + + bool dummyCallback(bool) + { +diff -r 7fba7ef21117 -r f104ace19a51 src/common/basics.h +--- src/common/basics.h Sat Jan 18 17:45:15 2014 +0100 ++++ src/common/basics.h Wed Feb 05 22:08:32 2014 +0100 +@@ -42,6 +42,13 @@ + extern const char *FONT_FILE; + + ++//Set new locale code. Must be followed by a popLocale call before completion ++// Only one locale type can be pushed at a time this way ++void pushLocale(const char *newLocale, int type); ++ ++//Restore old locale code ++void popLocale(); ++ + + + //C file peek function +diff -r 7fba7ef21117 -r f104ace19a51 src/gui/mathglPane.cpp +--- src/gui/mathglPane.cpp Sat Jan 18 17:45:15 2014 +0100 ++++ src/gui/mathglPane.cpp Wed Feb 05 22:08:32 2014 +0100 +@@ -27,7 +27,6 @@ + + #ifdef USE_MGL2 + #include +- #include + #else + #include + #endif +@@ -1091,7 +1090,13 @@ + grS->SetWarn(0); + grS->Message=mglWarnMsgBuf; + #endif ++ ++ //Mathgl does not set locale prior to writing SVG ++ // do this by hand ++ pushLocale("C",LC_NUMERIC); + grS->WriteSVG(filename.c_str()); ++ popLocale(); ++ + + bool doWarn; + #ifdef USE_MGL2 diff --git a/3Depict.spec b/3Depict.spec index 4c635b1..bd763b2 100644 --- a/3Depict.spec +++ b/3Depict.spec @@ -1,6 +1,6 @@ Name: 3Depict Version: 0.0.15 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Valued 3D point cloud visualization and analysis Group: Applications/Engineering @@ -36,6 +36,8 @@ BuildRequires: qhull-devel Patch0: %{name}-%{version}-manual-pdf-loc.patch #Fedora specific font dir Patch1: %{name}-%{version}-font-path.patch +#Upstream patches from 0.0.15 release tarball +Patch2: %{name}-0.0.15-upstream.patch %description This software is designed to help users visualize and analyze 3D point clouds @@ -49,6 +51,7 @@ useful for general scalar valued point data purposes. %patch0 %patch1 +%patch2 %build %configure --disable-debug-checks --enable-openmp-parallel --enable-mgl2 @@ -109,6 +112,10 @@ rm -rf %{buildroot} %changelog +* Wed Feb 05 2014 D Haley - 0.0.15-3 +- Rebuild for new mgl +- Add upstream patches + * Sun Jan 26 2014 D Haley - 0.0.15-2 - Rebuild for new mgl