Package: sfftobmp
Version: 3.1.3-1+b1
Severity: normal
When convertig a multipage fax, sfftobmp does not append the expected numerical
page index to the output filename:
File /var/spool/capisuite/received/fax.sff seems to
have 2 page(s).
- Destination File /tmp/buschfaxtmp/fax.jpg :
Converting page 1 (1728x1140px / 203x98dpi), LowRes ...
- Destination File /tmp/buschfaxtmp/fax.jpg :
Converting page 2 (1728x1140px / 203x98dpi), LowRes ...
It ought to be (and was in prior versions):
- Destination File /tmp/buschfaxtmp/fax_001.jpg :
Converting page 1 (1728x1140px / 203x98dpi), LowRes ...
- Destination File /tmp/buschfaxtmp/fax_002.jpg :
Converting page 2 (1728x1140px / 203x98dpi), LowRes ...
The problem was identified to be associated with new behaviour introduced by boost::filesystem V3 (version 1.49 in
Wheezy and up).
The attached path fixes it.
Regards,
Peter Schaefer
(Author of sfftobmp)
-- System Information:
Debian Release: 7.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages sfftobmp depends on:
ii libboost-filesystem1.49.0 1.49.0-3.2
ii libboost-system1.49.0 1.49.0-3.2
ii libc6 2.13-38
ii libgcc1 1:4.7.2-5
ii libjpeg8 8d-1
ii libstdc++6 4.7.2-5
ii libtiff4 3.9.6-11
sfftobmp recommends no packages.
sfftobmp suggests no packages.
-- no debconf information
--- main.cpp.orig 2014-01-09 23:38:56.234110557 +0100
+++ main.cpp.new 2014-01-09 23:38:18.610108525 +0100
@@ -38,6 +38,8 @@
#include <cassert>
#include <vector>
#include <iostream>
+#include <sstream>
+#include <iomanip>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
@@ -71,6 +73,7 @@
fs::path pathInFileName;
fs::path pathOutFileName;
fs::path pathOutDirectory;
+ stringstream ssFilename;
CCmdLineProcessor proc(argv, argc);
@@ -116,7 +119,6 @@
{
COutputFilter *pOut = NULL;
CSffFile *pInfile = NULL;
- char acNumber[10];
try
{
@@ -172,32 +174,32 @@
if (pathOutFileName.string().length()) {
// A fixed name was given, so use it as a base name
outPath = pathOutFileName;
- std::string orgExt = fs::extension(outPath);
+ std::string orgExt = outPath.extension().generic_string();
if (nFileCountOut > 1) {
- sprintf(acNumber, "_%03d", nPage+1);
- outPath = fs::change_extension(outPath, acNumber);
- if (orgExt.length()) {
- std::string strTemp = outPath.string();
- strTemp += orgExt;
- outPath = fs::path(strTemp);
- }
+ outPath.replace_extension("");
+ ssFilename << outPath.generic_string();
+ ssFilename << "_" << setw(3) << setfill('0') << nPage+1;
+ ssFilename << orgExt;
+ outPath = fs::path(ssFilename.str());
}
} else {
// Otherwise construct output filename from input filename
- outPath = pathOutDirectory / pathInFileName.leaf();
+ outPath = pathOutDirectory / pathInFileName.filename();
if (nFileCountOut > 1) {
- sprintf(acNumber, "_%03d", nPage+1);
- outPath = fs::change_extension(outPath, acNumber);
- std::string strTemp = outPath.string();
- strTemp += pOut->GetExtension();
- outPath = fs::path(strTemp);
+ outPath.replace_extension("");
+ ssFilename << outPath.generic_string();
+ ssFilename << "_" << setw(3) << setfill('0') << nPage+1;
+ ssFilename << pOut->GetExtension();
+ outPath = fs::path(ssFilename.str());
} else {
- outPath = fs::change_extension(outPath, pOut->GetExtension());
+ outPath.replace_extension(pOut->GetExtension());
}
}
if (!proc.doOverwrite() && !((nPage > 0) && (nFileCountOut == 1))
&& fs::exists(outPath)) {
throw CSimpleException(CSimpleException::err_outfileexists);
}
+ ssFilename.str("");
+ ssFilename.clear();
}
bool bIsLowRes = pInfile->IsLowRes(nPage);