[Hdrflow-svn] SF.net SVN: hdrflow: [296] trunk/lib/extras/src/raw
Status: Pre-Alpha
Brought to you by:
glslang
From: <gl...@us...> - 2007-09-05 22:20:18
|
Revision: 296 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=296&view=rev Author: glslang Date: 2007-09-05 15:20:13 -0700 (Wed, 05 Sep 2007) Log Message: ----------- + output to temp directory (untested) Modified Paths: -------------- trunk/lib/extras/src/raw/dcraw.c trunk/lib/extras/src/raw/raw.cpp Modified: trunk/lib/extras/src/raw/dcraw.c =================================================================== --- trunk/lib/extras/src/raw/dcraw.c 2007-09-02 22:35:27 UTC (rev 295) +++ trunk/lib/extras/src/raw/dcraw.c 2007-09-05 22:20:13 UTC (rev 296) @@ -7407,6 +7407,8 @@ #ifndef NO_LCMS char *cam_profile=0, *out_profile=0; #endif + char tempdir[ BUFSIZ ]; + DWORD dw; #ifndef LOCALTIME putenv ("TZ=UTC"); @@ -7694,12 +7696,20 @@ write_ext = ".tiff"; else write_ext = ".pgm\0.ppm\0.ppm\0.pam" + colors*5-5; - ofname = (char *) malloc (strlen(ifname) + 16); +#ifdef WIN32 + dw = GetTempPath(BUFSIZ, tempdir); + if( dw > BUFSIZ || dw == 0 ) + return 2; +#else + tempdir = "/var/tmp"; +#endif + ofname = (char *) malloc (strlen(ifname) + strlen(tempdir)+ 16); merror (ofname, "main()"); if (write_to_stdout) strcpy (ofname,_("standard output")); else { - strcpy (ofname, ifname); + strcpy (ofname, tempdir); + strcat (ofname, ifname); if ((cp = strrchr (ofname, '.'))) *cp = 0; if (thumbnail_only) strcat (ofname, ".thumb"); Modified: trunk/lib/extras/src/raw/raw.cpp =================================================================== --- trunk/lib/extras/src/raw/raw.cpp 2007-09-02 22:35:27 UTC (rev 295) +++ trunk/lib/extras/src/raw/raw.cpp 2007-09-05 22:20:13 UTC (rev 296) @@ -61,9 +61,20 @@ if( dcraw_( static_cast<int>( args.size( ) ), const_cast<char**>( &args[ 0 ] ) ) ) return il::image_type_ptr( ); - + + pl::string tempdir; +#ifdef WIN32 + TCHAR wtempdir[ BUFSIZ ]; + DWORD dw = GetTempPath(BUFSIZ, wtempdir); + if( dw > BUFSIZ || dw == 0 ) + return il::image_type_ptr( ); + tempdir = pl::to_string( wtempdir ); +#else + tempdir = "/var/tmp"; +#endif + pl::string pathname( path.begin( ), path.begin( ) + path.find_last_of( "." ) ); - pathname += ".tiff"; + pathname = pl::string( tempdir ) + pathname + ".tiff"; typedef pl::discovery<query_traits> discovery; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |