From 4bcfde41e7b854769f7db7412749d7f0f9ad977e Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sun, 8 Feb 2015 04:27:11 +0100 Subject: Werror: data lost during conversion from size_t to int Change-Id: Iee080b89cf0588c8076ef4c0334d36a7aefce44d Reviewed-on: https://gerrit.libreoffice.org/14374 Tested-by: Michael Stahl Reviewed-by: Michael Stahl --- rsc/source/rscpp/cpp.h | 4 ++-- rsc/source/rscpp/cpp4.c | 4 ++-- rsc/source/rscpp/cpp6.c | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) mode change 100644 => 100755 rsc/source/rscpp/cpp.h mode change 100644 => 100755 rsc/source/rscpp/cpp4.c mode change 100644 => 100755 rsc/source/rscpp/cpp6.c (limited to 'rsc/source/rscpp') diff --git a/rsc/source/rscpp/cpp.h b/rsc/source/rscpp/cpp.h old mode 100644 new mode 100755 index af579fe6303e..c9421412e57a --- a/rsc/source/rscpp/cpp.h +++ b/rsc/source/rscpp/cpp.h @@ -336,8 +336,8 @@ int scanstring( int c, void (*outfun)( int c ) ); void scannumber( int c, void (*outfun)( int c ) ); void save( int c ); char* savestring( char* text ); -FILEINFO* getfile( int bufsize, char* name ); -char *getmem( int size ); +FILEINFO* getfile( size_t bufsize, char* name ); +char *getmem( size_t size ); DEFBUF* lookid( int c ); DEFBUF* defendel( char* name, int delete ); void dunpdef( char* why ); diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c old mode 100644 new mode 100755 index 034c0123816e..03f35604a562 --- a/rsc/source/rscpp/cpp4.c +++ b/rsc/source/rscpp/cpp4.c @@ -320,7 +320,7 @@ void doundef() */ void textput(char* text) { - int size; + size_t size; size = strlen(text) + 1; if ((parmp + size) >= &parm[NPARMWORK]) @@ -531,7 +531,7 @@ FILE_LOCAL void expstuff(DEFBUF* tokenp) int c; /* Current character */ char* inp; /* -> repl string */ char* defp; /* -> macro output buff */ - int size; /* Actual parm. size */ + size_t size; /* Actual parm. size */ char* defend; /* -> output buff end */ int string_magic; /* String formal hack */ FILEINFO* file; /* Funny #include */ diff --git a/rsc/source/rscpp/cpp6.c b/rsc/source/rscpp/cpp6.c old mode 100644 new mode 100755 index 6905612dcf86..9444b720c80b --- a/rsc/source/rscpp/cpp6.c +++ b/rsc/source/rscpp/cpp6.c @@ -485,7 +485,8 @@ char* savestring(char* text) { char* result; - result = getmem(strlen(text) + 1); + size_t size = strlen(text) + 1; + result = getmem(size); strcpy(result, text); return (result); } @@ -493,10 +494,10 @@ char* savestring(char* text) /* * Common FILEINFO buffer initialization for a new file or macro. */ -FILEINFO* getfile(int bufsize, char* name) +FILEINFO* getfile(size_t bufsize, char* name) { FILEINFO* file; - int size; + size_t size; size = strlen(name); /* File/macro name */ file = (FILEINFO*) getmem(sizeof (FILEINFO) + bufsize + size); @@ -518,7 +519,7 @@ FILEINFO* getfile(int bufsize, char* name) /* * Get a block of free memory. */ -char* getmem(int size) +char* getmem(size_t size) { char* result; -- cgit