Kaydet (Commit) 3ae98a0c authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: fdo#39376/fdo#34880 short fread isn't an error when its eof

üst ea1cb03e
...@@ -52,8 +52,6 @@ FTPInputStream::FTPInputStream(FILE* tmpfl) ...@@ -52,8 +52,6 @@ FTPInputStream::FTPInputStream(FILE* tmpfl)
: m_tmpfl(tmpfl ? tmpfl : tmpfile()) : m_tmpfl(tmpfl ? tmpfl : tmpfile())
{ {
fseek(m_tmpfl,0,SEEK_END); fseek(m_tmpfl,0,SEEK_END);
// fpos_t pos;
// fgetpos(m_tmpfl,&pos);
long pos = ftell(m_tmpfl); long pos = ftell(m_tmpfl);
rewind(m_tmpfl); rewind(m_tmpfl);
m_nLength = sal_Int64(pos); m_nLength = sal_Int64(pos);
...@@ -107,20 +105,12 @@ sal_Int32 SAL_CALL FTPInputStream::readBytes(Sequence< sal_Int8 >& aData, ...@@ -107,20 +105,12 @@ sal_Int32 SAL_CALL FTPInputStream::readBytes(Sequence< sal_Int8 >& aData,
if(0 <= nBytesToRead && aData.getLength() < nBytesToRead) if(0 <= nBytesToRead && aData.getLength() < nBytesToRead)
aData.realloc(nBytesToRead); aData.realloc(nBytesToRead);
// fpos_t bpos,epos; size_t nWanted = static_cast<size_t>(nBytesToRead);
size_t nRead = fread(aData.getArray(), 1, nWanted, m_tmpfl);
// fgetpos(m_tmpfl,&bpos); if (nRead != nWanted && ferror(m_tmpfl))
// fread(aData.getArray(),nBytesToRead,1,m_tmpfl);
// fgetpos(m_tmpfl,&epos);
long bpos,epos;
bpos = ftell(m_tmpfl);
if (fread(aData.getArray(),nBytesToRead,1,m_tmpfl) != 1)
throw IOException(); throw IOException();
epos = ftell(m_tmpfl); return static_cast<sal_Int32>(nRead);
return sal_Int32(epos-bpos);
} }
......
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