summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorDavid Ostrovsky <David.Ostrovsky@gmx.de>2012-04-21 14:29:14 +0200
committerCaolán McNamara <caolanm@redhat.com>2012-04-21 21:46:35 +0100
commit6ef852f160b88b2052c150374fb9aeab43a29804 (patch)
treef6d737e8fea569c8a16c8c00b8e206e6b118fa3d /extensions
parent461b786be77a2116673915d56e1bf875cac792b5 (diff)
WaE: extensions warnings fixed
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/nsplugin/source/npshell.cxx6
-rw-r--r--extensions/source/scanner/sane.cxx27
2 files changed, 29 insertions, 4 deletions
diff --git a/extensions/source/nsplugin/source/npshell.cxx b/extensions/source/nsplugin/source/npshell.cxx
index 81ce8fb098de..f6b4ea4b1bfa 100644
--- a/extensions/source/nsplugin/source/npshell.cxx
+++ b/extensions/source/nsplugin/source/npshell.cxx
@@ -772,7 +772,11 @@ NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname)
break;
}
- write(fdDst, buffer, ret);
+ ssize_t written_bytes = write(fdDst, buffer, ret);
+ if (written_bytes == -1)
+ {
+ return;
+ }
}
close(fdSrc);
close(fdDst);
diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index aaefbf4837b8..ca2cec186758 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -524,11 +524,24 @@ static inline sal_uInt8 _ReadValue( FILE* fp, int depth )
// e.g. UMAX Astra 1200S delivers 16 bit but in BIGENDIAN
// against SANE documentation (xscanimage gets the same result
// as we do
- fread( &nWord, 1, 2, fp );
+ size_t items_read = fread( &nWord, 1, 2, fp );
+
+ // fread() does not distinguish between end-of-file and error, and callers
+ // must use feof(3) and ferror(3) to determine which occurred.
+ if (items_read == 0)
+ {
+ // nothing todo?
+ // WaE is happy!
+ }
return (sal_uInt8)( nWord / 256 );
}
sal_uInt8 nByte;
- fread( &nByte, 1, 1, fp );
+ size_t items_read = fread( &nByte, 1, 1, fp );
+ if (items_read == 0)
+ {
+ // nothing todo?
+ // WaE is happy!
+ }
return nByte;
}
@@ -814,7 +827,15 @@ sal_Bool Sane::Start( BitmapTransporter& rBitmap )
( eType == FrameStyle_Gray && aParams.depth == 8 )
)
{
- fread( pBuffer, 1, aParams.bytes_per_line, pFrame );
+ size_t items_read = fread( pBuffer, 1, aParams.bytes_per_line, pFrame );
+
+ // fread() does not distinguish between end-of-file and error, and callers
+ // must use feof(3) and ferror(3) to determine which occurred.
+ if (items_read == 0)
+ {
+ // nothing todo?
+ // WaE is happy!
+ }
aConverter.Write( pBuffer, aParams.bytes_per_line );
}
else if( eType == FrameStyle_Gray )