X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2FETL%2F_stringf.h;h=f91cfca48936881caa504771d354914675a6866d;hb=5fcd703aaea3794acfcaee35f91265d7ad2247ac;hp=dfc4bcf043228698aa3c6ada17a7df9728ec2a35;hpb=9698bd80061a79c7f9e6940d2cfba7d34cd4c120;p=synfig.git diff --git a/ETL/trunk/ETL/_stringf.h b/ETL/trunk/ETL/_stringf.h index dfc4bcf..f91cfca 100644 --- a/ETL/trunk/ETL/_stringf.h +++ b/ETL/trunk/ETL/_stringf.h @@ -91,9 +91,12 @@ vstrprintf(const char *format, va_list args) #ifdef HAVE_VASPRINTF // This is the preferred method (and safest) char *buffer; std::string ret; - vasprintf(&buffer,format,args); - ret=buffer; - free(buffer); + int i=vasprintf(&buffer,format,args); + if (i>-1) + { + ret=buffer; + free(buffer); + } return ret; #else #ifdef HAVE_VSNPRINTF // This is the secondary method (Safe, but bulky) @@ -198,10 +201,12 @@ dirname(const std::string &str) break; if(iter==str.begin()) + { if (*iter==ETL_DIRECTORY_SEPARATOR) return "/"; else return "."; + } return std::string(str.begin(),iter); }