Commit 1b1b76ee authored by ck's avatar ck
Browse files

Maemo: Get rid of MSVC compiler warning.

parent 58f8f7b7
......@@ -159,16 +159,25 @@ MaemoSftpConnection::~MaemoSftpConnection()
}
class FileManager
{
public:
FileManager(const QString &filePath)
: m_file(fopen(filePath.toLatin1().data(), "rb")) {}
~FileManager() { if (m_file) fclose(m_file); }
FILE *file() const { return m_file; }
private:
FILE * const m_file;
};
void MaemoSftpConnection::transferFiles(const QList<SshDeploySpec> &deploySpecs)
{
for (int i = 0; i < deploySpecs.count(); ++i) {
const SshDeploySpec &deploySpec = deploySpecs.at(i);
const QString &curSrcFile = deploySpec.srcFilePath();
QSharedPointer<FILE> filePtr(fopen(curSrcFile.toLatin1().data(), "rb"),
&std::fclose);
if (filePtr.isNull())
FileManager fileMgr(curSrcFile);
if (!fileMgr.file())
throw MaemoSshException(tr("Could not open file '%1'").arg(curSrcFile));
const QString &curTgtFile = deploySpec.tgtFilePath();
// TODO: Is the mkdir() method recursive? If not, we have to
......@@ -180,7 +189,7 @@ void MaemoSftpConnection::transferFiles(const QList<SshDeploySpec> &deploySpecs)
qDebug("Deploying file %s to %s.", qPrintable(curSrcFile), qPrintable(curTgtFile));
if (!sftp->put(filePtr.data(), curTgtFile.toLatin1().data())) {
if (!sftp->put(fileMgr.file(), curTgtFile.toLatin1().data())) {
const QString &error = tr("Could not copy local file '%1' "
"to remote file '%2': %3").arg(curSrcFile, curTgtFile)
.arg(lastError());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment