[Libreoffice-commits] core.git: soltools/mkdepend
Tor Lillqvist
tml at iki.fi
Fri Aug 30 00:30:49 PDT 2013
soltools/mkdepend/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 803b669ec4c1a1052c0ea129fc7e689005e0dddf
Author: Tor Lillqvist <tml at iki.fi>
Date: Fri Aug 30 10:29:16 2013 +0300
WaE: size_t/unsigned int: possible loss of data
With MSVC, the third parameter to read() is unsigned int.
Change-Id: I607089fb2a9e6bf794293187be48e910ac40158f
diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c
index 149bae1..b636498 100644
--- a/soltools/mkdepend/main.c
+++ b/soltools/mkdepend/main.c
@@ -482,7 +482,7 @@ struct filepointer *getfile(file)
struct stat st;
off_t size_backup;
ssize_t bytes_read;
- size_t malloc_size;
+ unsigned malloc_size;
content = (struct filepointer *)malloc(sizeof(struct filepointer));
if ((fd = open(file, O_RDONLY)) < 0) {
@@ -495,13 +495,13 @@ struct filepointer *getfile(file)
size_backup = st.st_size;
malloc_size = size_backup;
- /* Since off_t is larger than size_t, need to test for
+ /* Since off_t usually is larger than unsigned, need to test for
* truncation.
*/
if ( (off_t)malloc_size != size_backup )
{
close( fd );
- warning("makedepend: File \"%s\" size larger than can fit in size_t. Cannot allocate memory for contents.\n", file);
+ warning("makedepend: File \"%s\" is too large.\n", file);
content->f_p = content->f_base = content->f_end = (char *)malloc(1);
*content->f_p = '\0';
return(content);
More information about the Libreoffice-commits
mailing list