From: arif Date: Mon, 2 Mar 2009 15:44:54 +0000 (+0000) Subject: windows directory renewd with visual studio 2055 files X-Git-Tag: LAST_LIBGRAPH~32^2~2346 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=714871543d522f344dc00cedbffa14fda441933f;p=graphviz windows directory renewd with visual studio 2055 files --- diff --git a/cmd/smyrna/smyrna.vcproj b/cmd/smyrna/smyrna.vcproj index d22e337b2..1dba92e6b 100644 --- a/cmd/smyrna/smyrna.vcproj +++ b/cmd/smyrna/smyrna.vcproj @@ -120,7 +120,7 @@ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;" RuntimeLibrary="2" UsePrecompiledHeader="0" - WarningLevel="3" + WarningLevel="0" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 12e25e506..31fb15561 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -222,15 +222,6 @@ set_viewport_settings_from_template(ViewInfo * view, Agraph_t * g) -/* - -but here i am, on the road again -here i am, up on the stage -here i go, playing the star again -there i go, turn the page - -*/ - /*default line width */ view->LineWidth = (float) atof(get_attribute_value("defaultlinewidth", view, g)); @@ -584,16 +575,47 @@ static void clear_graph(Agraph_t * graph) } /* create_xdot_for_graph: - * Returns (malloced) temp filename for output data + * Returns temp filename for output data * or NULL on error. - * Calling program needs to remove file and free storage: + * Calling program needs to remove file : * fname = create_xdot_for_graph (...) * ... use fname ... * unlink (fname); - * free (fname); + * Uses the mkTemp function to get temp names. + * N.B. The returned file name is a static buffer. + * */ #define FMT "%s%s -Txdot%s %s -o%s" +#ifdef WIN32 +#define DOTTEMP "c:\\tmp\\_dotXXXXXX" +#define XDOTTEMP "c:\\tmp\\_xdotXXXXXX" + +#define mkTemp(b,s) (_mktemp_s(b,s)) + +#else +#define DOTTEMP "/tmp/_dotXXXXXX" +#define XDOTTEMP "/tmp/_xdotXXXXXX" + +/* mkTemp: + * Given a template string buf of the form abcdXXXXX, + * and its size bufsz, replace the X's by characters creating + * a unique file name. + * Return 0 on success, non-zero on failure. + */ +static int +mkTemp (char* buf, size_t bufsz) +{ + int rv = mkstemp (buf); + if (rv < 0) return -1; + else { + close (rv); + return 0; + } +} + +#endif + static char* create_xdot_for_graph(Agraph_t * graph, int keeppos) { static char buf[BUFSIZ]; @@ -602,11 +624,12 @@ static char* create_xdot_for_graph(Agraph_t * graph, int keeppos) int len; int r = 0; FILE *output_file; - char* dotfile; - char* xdotfile; char* fix; char* alg; char* path; + static char xdotfile[sizeof(XDOTTEMP)]; + char dotfile[sizeof(DOTTEMP)]; + /* The accesses below and in update_graph_params are only valid if * custom_graph_data has been attached to the graph. */ @@ -615,14 +638,11 @@ static char* create_xdot_for_graph(Agraph_t * graph, int keeppos) if (haveData) update_graph_params(graph); - if (!(dotfile = tempnam(0,"_dot"))) return 0; - if (!(xdotfile = tempnam(0,"_xdot"))) { - free (dotfile); - return 0; - } + strcpy (dotfile, DOTTEMP); + if (mkTemp(dotfile, sizeof(dotfile))) return 0; + strcpy (xdotfile, XDOTTEMP); + if (mkTemp(xdotfile, sizeof(xdotfile))) return 0; if (!(output_file = fopen(dotfile, "w"))) { - free (xdotfile); - free (dotfile); return 0; } @@ -660,7 +680,7 @@ static char* create_xdot_for_graph(Agraph_t * graph, int keeppos) alg = " -Kcirco"; break; case GVK_FDP : - alg = " -Kfdp"; + alg = " -Ksfdp"; break; case GVK_SFDP : alg = " -Ksfdp"; @@ -685,20 +705,15 @@ static char* create_xdot_for_graph(Agraph_t * graph, int keeppos) else cmd = RALLOC (buflen, cmd, char); } sprintf (cmd, FMT, path, fix, alg, dotfile, xdotfile); - r = system (cmd); + r = system (cmd); unlink (dotfile); - free (dotfile); if (r) { // something went wrong unlink (xdotfile); - free (xdotfile); return 0; } else - { - return xdotfile; - - } + return xdotfile; } /* @@ -722,7 +737,6 @@ layoutGraph (Agraph_t *oldg, int keeppos, int closeold) g_print ("xdot is being loaded\n"); fclose (input_file); unlink (infile); // Remove temp file - free (infile); // Free storage for temp file name return newg; } diff --git a/graphviz.sln b/graphviz.sln index 136cfa1a1..4979602ba 100644 --- a/graphviz.sln +++ b/graphviz.sln @@ -170,8 +170,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prune", "contrib\prune\prun EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "diffimg", "contrib\diffimg\diffimg.vcproj", "{89ED80CE-5DEF-46B1-9A12-1D991236EE3E}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fc-fix", "windows\cmd\fc-fix\fc-fix.vcproj", "{0DEA6915-263C-4570-B25C-E0A449894D45}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glcomp", "lib\glcomp\glcomp.vcproj", "{CCEF85C9-BC40-4C26-8755-581276C8B7DA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xdot", "lib\xdot\xdot.vcproj", "{C99C1195-2032-408B-9822-F09F49006A3C}" @@ -379,10 +377,6 @@ Global {89ED80CE-5DEF-46B1-9A12-1D991236EE3E}.Debug|Win32.Build.0 = Debug|Win32 {89ED80CE-5DEF-46B1-9A12-1D991236EE3E}.Release|Win32.ActiveCfg = Release|Win32 {89ED80CE-5DEF-46B1-9A12-1D991236EE3E}.Release|Win32.Build.0 = Release|Win32 - {0DEA6915-263C-4570-B25C-E0A449894D45}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DEA6915-263C-4570-B25C-E0A449894D45}.Debug|Win32.Build.0 = Debug|Win32 - {0DEA6915-263C-4570-B25C-E0A449894D45}.Release|Win32.ActiveCfg = Release|Win32 - {0DEA6915-263C-4570-B25C-E0A449894D45}.Release|Win32.Build.0 = Release|Win32 {CCEF85C9-BC40-4C26-8755-581276C8B7DA}.Debug|Win32.ActiveCfg = Debug|Win32 {CCEF85C9-BC40-4C26-8755-581276C8B7DA}.Debug|Win32.Build.0 = Debug|Win32 {CCEF85C9-BC40-4C26-8755-581276C8B7DA}.Release|Win32.ActiveCfg = Release|Win32