Commit ceaedb1e authored by Huff, Israel's avatar Huff, Israel
Browse files

changed some types to appease Windows

parent 72c724a8
......@@ -234,12 +234,12 @@ bool SFTPFile::isOpen() { return (p->file != nullptr); }
// returns number of bytes written on success
// on error, returns < 0 and ssh and sftp session errors are set
ssize_t SFTPFile::write(QString str)
int64_t SFTPFile::write(QString str)
{
std::string stdStr = str.toStdString();
const char* buf = stdStr.c_str();
size_t count = strlen(buf);
ssize_t nwritten = sftp_write(p->file, buf, count);
int64_t nwritten = sftp_write(p->file, buf, count);
return nwritten;
}
......@@ -250,9 +250,8 @@ QString SFTPFile::read(size_t nBytes)
if (nBytes == 0) return QString();
char* buf = new char[nBytes + 1];
// initialize buff
memset(&buf[0], 0, nBytes);
buf[nBytes] = '\0';
ssize_t nBytesRead = sftp_read(p->file, buf, nBytes);
memset(buf, 0, nBytes + 1);
int64_t nBytesRead = sftp_read(p->file, buf, nBytes);
if (nBytesRead < 0)
{
close();
......@@ -281,9 +280,9 @@ bool SFTPFile::seek(size_t offset)
return true;
}
size_t SFTPFile::tell()
int64_t SFTPFile::tell()
{
size_t result = static_cast<size_t>(sftp_tell64(p->file));
int64_t result = static_cast<int64_t>(sftp_tell64(p->file));
return result;
}
......
......@@ -350,11 +350,11 @@ class RSM_PUBLIC SFTPFile
SFTPFile(SFTPSession* sftpSession, QString filename, int accessType);
~SFTPFile();
bool isOpen();
ssize_t write(QString str);
int64_t write(QString str);
QString read(size_t nBytes);
bool close();
bool seek(size_t offset);
size_t tell();
int64_t tell();
}; // class SFTPFile
// ----------------------------------------------------------------------------
......
Markdown is supported
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