[trunk] Properly handle PGM file generation when fullpath is specified in the cmd line
This will break a very old behavior (since 2005), but avoid writing in un-expected places for users This also make the behavior similar with PGX file generation
This commit is contained in:
parent
76af73bc72
commit
9a52b30c3d
|
@ -2106,8 +2106,15 @@ if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
|
|
||||||
for (compno = 0; compno < ncomp; compno++)
|
for (compno = 0; compno < ncomp; compno++)
|
||||||
{
|
{
|
||||||
if (ncomp > 1)
|
if (ncomp > 1)
|
||||||
sprintf(destname, "%d.%s", compno, outfile);
|
{
|
||||||
|
/*sprintf(destname, "%d.%s", compno, outfile);*/
|
||||||
|
const size_t olen = strlen(outfile);
|
||||||
|
const size_t dotpos = olen - 4;
|
||||||
|
|
||||||
|
strncpy(destname, outfile, dotpos);
|
||||||
|
sprintf(destname+dotpos, "_%d.pgm", compno);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sprintf(destname, "%s", outfile);
|
sprintf(destname, "%s", outfile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue