From bd1df0119c26d14e298d11abdd07ae77e8fb124f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 5 Oct 2005 16:58:50 +0000 Subject: Renamed g10.c to gpg.c Filelength fixes for W32. --- g10/encode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'g10/encode.c') diff --git a/g10/encode.c b/g10/encode.c index a4906d62d..5bbe7cf53 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -299,8 +299,10 @@ encode_simple( const char *filename, int mode, int use_seskey ) if ( !iobuf_is_pipe_filename (filename) && *filename && !opt.textmode ) { off_t tmpsize; + int overflow; - if ( !(tmpsize = iobuf_get_filelength(inp)) ) + if ( !(tmpsize = iobuf_get_filelength(inp, &overflow)) + && !overflow ) log_info(_("WARNING: `%s' is an empty file\n"), filename ); /* We can't encode the length of very large files because OpenPGP uses only 32 bit for file sizes. So if the the @@ -589,14 +591,16 @@ encode_crypt( const char *filename, STRLIST remusr, int use_symkey ) if (!iobuf_is_pipe_filename (filename) && *filename && !opt.textmode ) { off_t tmpsize; + int overflow; - if ( !(tmpsize = iobuf_get_filelength(inp)) ) + if ( !(tmpsize = iobuf_get_filelength(inp, &overflow)) + && !overflow ) log_info(_("WARNING: `%s' is an empty file\n"), filename ); /* We can't encode the length of very large files because OpenPGP uses only 32 bit for file sizes. So if the the size of a file is larger than 2^32 minus some bytes for packet headers, we switch to partial length encoding. */ - if ( tmpsize < (IOBUF_FILELENGTH_LIMIT - 65536) ) + if (tmpsize < (IOBUF_FILELENGTH_LIMIT - 65536) ) filesize = tmpsize; else filesize = 0; -- cgit