[Libreoffice-commits] .: 6 commits - configure.in soltools/cpp soltools/giparser soltools/inc soltools/javadep soltools/mkdepend soltools/support

Tor Lillqvist tml at kemper.freedesktop.org
Wed Feb 2 14:45:26 PST 2011


 configure.in                  |    2 +-
 soltools/cpp/_cpp.c           |    2 +-
 soltools/cpp/_eval.c          |    3 ++-
 soltools/cpp/_lex.c           |    2 +-
 soltools/cpp/_macro.c         |    8 ++++----
 soltools/cpp/_tokens.c        |   22 +++++++++++-----------
 soltools/cpp/_unix.c          |    4 ++--
 soltools/cpp/cpp.h            |   10 +++++-----
 soltools/giparser/gi_list.cxx |    6 +++---
 soltools/inc/st_list.hxx      |    4 ++--
 soltools/javadep/javadep.c    |   21 +++++++++++----------
 soltools/mkdepend/ifparser.c  |    7 +++++--
 soltools/mkdepend/include.c   |    2 +-
 soltools/mkdepend/main.c      |    4 ++++
 soltools/mkdepend/makefile.mk |    8 ++++++++
 soltools/mkdepend/pr.c        |    4 ++--
 soltools/support/simstr.cxx   |    4 ++--
 17 files changed, 65 insertions(+), 48 deletions(-)

New commits:
commit 86ee8d17a84a2c6290a5833c01e09aca995c677d
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Thu Feb 3 00:43:44 2011 +0200

    Silence compiler warnings

diff --git a/soltools/mkdepend/ifparser.c b/soltools/mkdepend/ifparser.c
index e0ad748..c9da34b 100644
--- a/soltools/mkdepend/ifparser.c
+++ b/soltools/mkdepend/ifparser.c
@@ -103,7 +103,10 @@ parse_number (g, cp, valp)
     return CALLFUNC(g, handle_error) (g, cp, "number");
 
 #ifdef WIN32
-    *valp = strtol(cp, &cp, 0);
+    {
+        char *cp2;
+        *valp = strtol(cp, &cp2, 0);
+    }
 #else
     *valp = atoi (cp);
     /* EMPTY */
@@ -172,7 +175,7 @@ parse_value (g, cp, valp)
         cp++;
         }
         DO (cp = parse_variable (g, cp, &var));
-        len = cp - var;
+        len = (int)(cp - var);
         SKIPSPACE (cp);
         if (paren && *cp != ')')
         return CALLFUNC(g, handle_error) (g, cp, ")");
diff --git a/soltools/mkdepend/include.c b/soltools/mkdepend/include.c
index b692999..09056e2 100644
--- a/soltools/mkdepend/include.c
+++ b/soltools/mkdepend/include.c
@@ -291,7 +291,7 @@ void included_by(ip, newfile)
     else {
         for (i=0; i<ip->i_listlen; i++)
             if (ip->i_list[ i ] == newfile) {
-                i = strlen(newfile->i_file);
+                i = (int)strlen(newfile->i_file);
                 if (!ip->i_included_sym &&
                 !(i > 2 &&
                   newfile->i_file[i-1] == 'c' &&
diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c
index 0e79637..7989eb9 100644
--- a/soltools/mkdepend/main.c
+++ b/soltools/mkdepend/main.c
@@ -33,6 +33,10 @@ in this Software without prior written authorization from the X Consortium.
 #include <sys/stat.h>
 #endif
 
+#ifdef _WIN32
+#include <io.h>
+#endif
+
 #ifdef _MSC_VER	    /* Define ssize_t */
 
 #if !defined(_W64)
diff --git a/soltools/mkdepend/makefile.mk b/soltools/mkdepend/makefile.mk
index 630c688..460b9f8 100644
--- a/soltools/mkdepend/makefile.mk
+++ b/soltools/mkdepend/makefile.mk
@@ -48,6 +48,14 @@ UWINAPILIB=
 
 CDEFS+=-DNO_X11 -DXP_PC -DHW_THREADS  
 
+.IF "$(COM)" == "MSC"
+# C4100: unreferenced formal parameter
+# C4131: uses old-style declarator
+# C4242: conversion from 'int' to 'char', possible loss of data
+# C4706: assignment within conditional expression
+CDEFS+=-wd4100 -wd4131 -wd4242 -wd4706
+.ENDIF
+
 OBJFILES=  \
         $(OBJ)$/cppsetup.obj \
         $(OBJ)$/ifparser.obj \
diff --git a/soltools/mkdepend/pr.c b/soltools/mkdepend/pr.c
index 67e227a..e0d5ff5 100644
--- a/soltools/mkdepend/pr.c
+++ b/soltools/mkdepend/pr.c
@@ -111,12 +111,12 @@ void pr(ip, file, base)
     char	buf[ BUFSIZ ];
 
     printed = TRUE;
-    len = strlen(ip->i_file)+1;
+    len = (int)strlen(ip->i_file)+1;
     if (current_len + len > width || file != lastfile) {
         lastfile = file;
         sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix,
             ip->i_file);
-        len = current_len = strlen(buf);
+        len = current_len = (int)strlen(buf);
     }
     else {
         buf[0] = ' ';
commit fb9e4e3df7295955c9ef4d9d318bf5b17c029169
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Thu Feb 3 00:42:20 2011 +0200

    Silence compiler warnings

diff --git a/soltools/giparser/gi_list.cxx b/soltools/giparser/gi_list.cxx
index edf3a3e..1f6f70d 100644
--- a/soltools/giparser/gi_list.cxx
+++ b/soltools/giparser/gi_list.cxx
@@ -143,9 +143,9 @@ List_GenericInfo::InsertInfoByPath( GenericInfo *       let_dpInfo,
     {
         Simstr aKey( i_sKeyPath,
                      0,
-                     sNextPathSegment -
+                     (int)(sNextPathSegment -
                         ( *sNextPathSegment == 0 ? 0 : 1)
-                        - i_sKeyPath );
+                           - i_sKeyPath ));
 
         GenericInfo * pNew = new GenericInfo(aKey);
         InsertInfo(pNew,false);
@@ -209,7 +209,7 @@ List_GenericInfo::lower_bound( bool &              o_bExists,
                                KeyPath             i_sKeyPath )
 {
     o_sNextPathSegment = strchr(i_sKeyPath, '/');
-    Simstr sKey( i_sKeyPath, (o_sNextPathSegment == 0 ? strlen(i_sKeyPath) : o_sNextPathSegment++ - i_sKeyPath) );
+    Simstr sKey( i_sKeyPath, (int)(o_sNextPathSegment == 0 ? strlen(i_sKeyPath) : o_sNextPathSegment++ - i_sKeyPath) );
     GenericInfo aSearch(sKey);
 
     unsigned low = 0;
diff --git a/soltools/inc/st_list.hxx b/soltools/inc/st_list.hxx
index f77f4a3..660bed6 100644
--- a/soltools/inc/st_list.hxx
+++ b/soltools/inc/st_list.hxx
@@ -63,7 +63,7 @@ class ST_List            /// Soltools-List.
     void  	 	        insert(
                             iterator            i_aPos,
                             const XX &          elem_ )
-                                                { Insert(i_aPos-begin(), elem_); }
+                                                { Insert((unsigned)(i_aPos-begin()), elem_); }
     virtual	void  	 	Insert(
                             unsigned 			pos,
                             const XX &          elem );
@@ -72,7 +72,7 @@ class ST_List            /// Soltools-List.
                                                 { Insert(size(),elem_); }
     void  	 	        remove(
                             iterator            i_aPos )
-                                                { Remove(i_aPos-begin()); }
+                                                { Remove((int)(i_aPos-begin())); }
     virtual	void  	 	Remove(
                             unsigned 			pos );
     void              	pop_back()				{ Remove(size()-1); }
commit a132da3c23d3d9b44d9d3dd21844c55be00dacda
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed Feb 2 23:49:51 2011 +0200

    Silence compiler warnings

diff --git a/soltools/cpp/_cpp.c b/soltools/cpp/_cpp.c
index 3b031d8..64229f5 100644
--- a/soltools/cpp/_cpp.c
+++ b/soltools/cpp/_cpp.c
@@ -299,7 +299,7 @@ void
 }
 
 void *
-    domalloc(int size)
+    domalloc(size_t size)
 {
     void *p = malloc(size);
 
diff --git a/soltools/cpp/_eval.c b/soltools/cpp/_eval.c
index 4afcf37..5b4944e 100644
--- a/soltools/cpp/_eval.c
+++ b/soltools/cpp/_eval.c
@@ -234,7 +234,8 @@ long
 {
     Token *tp;
     Nlist *np;
-    int ntok, rnd;
+    size_t  ntok;
+    int rnd;
 
     trp->tp++;
     if (kw == KIFDEF || kw == KIFNDEF)
diff --git a/soltools/cpp/_lex.c b/soltools/cpp/_lex.c
index 912530a..e867f9d 100644
--- a/soltools/cpp/_lex.c
+++ b/soltools/cpp/_lex.c
@@ -635,7 +635,7 @@ Source *
     setsource(char *name, int path, int fd, char *str, int wrap)
 {
     Source *s = new(Source);
-    int len;
+    size_t len;
 
     s->line = 1;
     s->lineinc = 0;
diff --git a/soltools/cpp/_macro.c b/soltools/cpp/_macro.c
index 600cc1a..472e09b 100644
--- a/soltools/cpp/_macro.c
+++ b/soltools/cpp/_macro.c
@@ -516,7 +516,7 @@ void
                 error(ERROR, "# not followed by macro parameter");
                 continue;
             }
-            ntok = 1 + (rtr->tp - tp);
+            ntok = 1 + (int)(rtr->tp - tp);
             rtr->tp = tp;
             insertrow(rtr, ntok, stringify(atr[argno]));
             continue;
@@ -554,7 +554,7 @@ void
 {
     Token *ltp, *ntp;
     Tokenrow ntr;
-    int len;
+    size_t len;
 
     for (trp->tp = trp->bp; trp->tp < trp->lp; trp->tp++)
     {
@@ -617,7 +617,7 @@ void
                 doconcat(&ntr);
                 trp->tp = ltp;
                 makespace(&ntr, ltp);
-                insertrow(trp, ntp - ltp, &ntr);
+                insertrow(trp, (int)(ntp - ltp), &ntr);
                 dofree(ntr.bp);
                 trp->tp--;
             }
@@ -639,7 +639,7 @@ int
     for (ap = mac->ap->bp; ap < mac->ap->lp; ap++)
     {
         if (ap->len == tp->len && strncmp((char *) ap->t, (char *) tp->t, ap->len) == 0)
-            return ap - mac->ap->bp;
+            return (int)(ap - mac->ap->bp);
     }
     return -1;
 }
diff --git a/soltools/cpp/_tokens.c b/soltools/cpp/_tokens.c
index 688b93c..020a23d 100644
--- a/soltools/cpp/_tokens.c
+++ b/soltools/cpp/_tokens.c
@@ -194,8 +194,8 @@ void
 Token *
     growtokenrow(Tokenrow * trp)
 {
-    int ncur = trp->tp - trp->bp;
-    int nlast = trp->lp - trp->bp;
+    size_t ncur = trp->tp - trp->bp;
+    size_t nlast = trp->lp - trp->bp;
 
     trp->max = 3 * trp->max / 2 + 1;
     trp->bp = (Token *) realloc(trp->bp, trp->max * sizeof(Token));
@@ -235,7 +235,7 @@ int
 void
     insertrow(Tokenrow * dtr, int ntok, Tokenrow * str)
 {
-    int nrtok = rowlen(str);
+    int nrtok = (int)rowlen(str);
 
     dtr->tp += ntok;
     adjustrow(dtr, nrtok - ntok);
@@ -274,7 +274,7 @@ void
 void
     movetokenrow(Tokenrow * dtr, Tokenrow * str)
 {
-    int nby;
+    size_t nby;
 
     /* nby = sizeof(Token) * (str->lp - str->bp); */
     nby = (char *) str->lp - (char *) str->bp;
@@ -290,7 +290,7 @@ void
 void
     adjustrow(Tokenrow * trp, int nt)
 {
-    int nby, size;
+    size_t nby, size;
 
     if (nt == 0)
         return;
@@ -311,7 +311,7 @@ void
 Tokenrow *
     copytokenrow(Tokenrow * dtr, Tokenrow * str)
 {
-    int len = rowlen(str);
+    int len = (int)rowlen(str);
 
     maketokenrow(len, dtr);
     movetokenrow(dtr, str);
@@ -331,7 +331,7 @@ Tokenrow *
     Tokenrow *ntrp = new(Tokenrow);
     int len;
 
-    len = trp->lp - trp->tp;
+    len = (int)(trp->lp - trp->tp);
     if (len <= 0)
         len = 1;
     maketokenrow(len, ntrp);
@@ -396,7 +396,7 @@ void
     {
         if (tp->type != NL)
         {
-            len = tp->len + tp->wslen;
+            len = (int)(tp->len + tp->wslen);
             p = tp->t - tp->wslen;
 
             /* add parameter check to delete operator? */
@@ -410,7 +410,7 @@ void
                     if( ntp->type == NAME )
                     {
                         uchar* np = ntp->t - ntp->wslen;
-                        int nlen = ntp->len + ntp->wslen;
+                        int nlen = (int)(ntp->len + ntp->wslen);
                         
                         memcpy(wbp, "if(", 3 );
                          wbp += 4;
@@ -492,7 +492,7 @@ void
 {
     if (wbp > wbuf)
     {
-        if ( write(1, wbuf, wbp - wbuf) != -1)
+        if ( write(1, wbuf, (int)(wbp - wbuf)) != -1)
             wbp = wbuf;
     else 
         exit(1);
@@ -527,7 +527,7 @@ char *
  * Null terminated.
  */
 uchar *
-    newstring(uchar * s, int l, int o)
+    newstring(uchar * s, size_t l, size_t o)
 {
     uchar *ns = (uchar *) domalloc(l + o + 1);
 
diff --git a/soltools/cpp/_unix.c b/soltools/cpp/_unix.c
index 1e5ef5e..11c90e8 100644
--- a/soltools/cpp/_unix.c
+++ b/soltools/cpp/_unix.c
@@ -135,7 +135,7 @@ void
 
                         case 'w':
                             dp = &optarg[n + 1];
-                            n += strlen(dp);
+                            n += (int)strlen(dp);
                             while (isspace(*dp)) dp++;
 
                             for (i = NINCLUDE - 1; i >= 0; i--)
@@ -173,7 +173,7 @@ void
     {
         if ((fp = strrchr(argv[optind], '/')) != NULL)
         {
-            int len = fp - argv[optind];
+            int len = (int)(fp - argv[optind]);
 
             dp = (char *) newstring((uchar *) argv[optind], len + 1, 0);
             dp[len] = '\0';
diff --git a/soltools/cpp/cpp.h b/soltools/cpp/cpp.h
index bb305e4..96473e1 100644
--- a/soltools/cpp/cpp.h
+++ b/soltools/cpp/cpp.h
@@ -54,8 +54,8 @@ typedef struct token
 {
     unsigned char type;
     unsigned char flag;
-    unsigned int wslen;
-    unsigned int len;
+    size_t wslen;
+    size_t len;
     uchar *t;
     unsigned int identifier;			/* used from macro processor to identify where a macro becomes valid again. */
 }   Token;
@@ -87,7 +87,7 @@ typedef struct nlist
 {
     struct nlist *next;
     uchar *name;
-    int len;
+    size_t len;
     Tokenrow *vp;                       /* value as macro */
     Tokenrow *ap;                       /* list of argument names, if any */
     char val;                           /* value as preprocessor name */
@@ -174,7 +174,7 @@ Source *setsource(char *, int, int, char *, int);
 void unsetsource(void);
 void puttokens(Tokenrow *);
 void process(Tokenrow *);
-void *domalloc(int);
+void *domalloc(size_t);
 void dofree(void *);
 void error(enum errtype, char *,...);
 void flushout(void);
@@ -211,7 +211,7 @@ void setempty(Tokenrow *);
 void makespace(Tokenrow *, Token *);
 char *outnum(char *, int);
 int digit(int);
-uchar *newstring(uchar *, int, int);
+uchar *newstring(uchar *, size_t, size_t);
 
 #define	rowlen(tokrow)	((tokrow)->lp - (tokrow)->bp)
 
commit edf9dd94e41146fc2d96bfcdc1b0c6dc633e9467
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed Feb 2 23:48:16 2011 +0200

    Silence a couple of compiler warnings

diff --git a/soltools/javadep/javadep.c b/soltools/javadep/javadep.c
index 9c1de2a..c94ab0d 100644
--- a/soltools/javadep/javadep.c
+++ b/soltools/javadep/javadep.c
@@ -119,7 +119,7 @@ static char     *pout_file  = NULL;
 uint8   read_uint8(const file_t *pfile);
 uint16  read_uint16(const file_t *pfile);
 uint32  read_uint32(const file_t *pfile);
-void    skip_bytes(const file_t *pfile, const size_t nnum);
+void    skip_bytes(const file_t *pfile, const long nnum);
 char    *escape_slash(const char *pstr);
 int     is_inner(const char *pstr);
 void    print_dependencies(const struct growable *pdep,
@@ -152,7 +152,7 @@ uint8
 read_uint8(const file_t *pfile)
 {
     /* read a byte from classfile */
-    int nread;
+    size_t nread;
     uint8 ndata;
     nread = fread(&ndata, sizeof(uint8), 1, pfile->pfs);
     if ( !nread ) {
@@ -166,7 +166,7 @@ uint16
 read_uint16(const file_t *pfile)
 {
     /* read a short from classfile and convert it to host format */
-    int nread;
+    size_t nread;
     uint16 ndata;
     nread = fread(&ndata, sizeof(uint16), 1, pfile->pfs);
     if ( !nread ) {
@@ -181,7 +181,7 @@ uint32
 read_uint32(const file_t *pfile)
 {
     /* read an int from classfile and convert it to host format */
-    int nread;
+    size_t nread;
     uint32 ndata;
     nread = fread(&ndata, sizeof(uint32), 1, pfile->pfs);
     if ( !nread ) {
@@ -203,7 +203,7 @@ read_utf8(const file_t *pfile)
      */
 
     utf8_t  a_utf8;
-    int     nread;
+    size_t  nread;
 
     a_utf8.pdata = NULL;
 
@@ -255,7 +255,7 @@ char *utf8tolatin1(const utf8_t a_utf8)
 
     
 void
-skip_bytes(const file_t *pfile, const size_t nnumber)
+skip_bytes(const file_t *pfile, const long nnumber)
 {
     /* skip a nnumber of bytes in classfile */
     if ( fseek(pfile->pfs, nnumber, SEEK_CUR) == -1 )
@@ -270,7 +270,7 @@ add_to_dependencies(struct growable *pdep,
 {
     /* create dependencies */
     int i;
-    int nlen_filt, nlen_str, nlen_pdepstr;
+    size_t nlen_filt, nlen_str, nlen_pdepstr;
     char *pstr, *ptrunc;
     char path[PATH_MAX+1];
     char cnp_class_file[PATH_MAX+1];
@@ -345,7 +345,7 @@ escape_slash(const char *pstr)
     const char *pp = pstr;
     char *p, *pnp;
     char *pnew_str;
-    int nlen_pnp, nlen_pp;
+    size_t nlen_pnp, nlen_pp;
     int i = 0;
     
     while ( (p=strchr(pp, cpathsep)) != NULL ) {
@@ -454,7 +454,7 @@ process_class_file(const char *pfilename, const struct growable *pfilt)
     ncnt = read_uint16(&file);
 
 #ifdef DEBUG    
-    printf("Magic: %p\n", (void*)nmagic);
+    printf("Magic: %x\n", nmagic);
     printf("Major %d, Minor %d\n", nmajor, nminor);
     printf("Const_pool_count %d\n", ncnt);
 #else
@@ -709,7 +709,8 @@ void
 create_filters(struct growable *pfilt, const struct growable *pinc)
 {
     char *p, *pp, *pstr;
-    int i, nlen, nlen_pstr;
+    int i;
+    size_t nlen, nlen_pstr;
     /* break up includes into filter list */
     for ( i = 0; i < pinc->ncur; i++ ) {
         pp = pinc->parray[i];
commit ba9b6b1a6270243174e2f02f8202d7d5d9d2942a
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed Feb 2 23:41:22 2011 +0200

    Silence a couple of compiler warnings

diff --git a/soltools/support/simstr.cxx b/soltools/support/simstr.cxx
index 596c943..81212f6 100644
--- a/soltools/support/simstr.cxx
+++ b/soltools/support/simstr.cxx
@@ -50,7 +50,7 @@ Simstr::Simstr(const char * s_)
       }
    else
       {
-         len = strlen(s_);
+         len = (int)strlen(s_);
          sz = new char[len+1];
          memcpy(sz,s_,len+1);
       }
@@ -97,7 +97,7 @@ Simstr::Simstr( const char *   anybytes,
                 int            firstBytesPos,
                 int            nrOfBytes)
 {
-   unsigned slen = strlen(anybytes);
+   unsigned slen = (unsigned)strlen(anybytes);
    if (anybytes == 0 || slen <= unsigned(firstBytesPos))
       {
          len = 0;
commit 2a7922dff9edf8794dd7f743db829e04f894f574
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed Feb 2 23:40:24 2011 +0200

    Do check for hash_map in __gnu_cxx namespace also with MinGW

diff --git a/configure.in b/configure.in
index a3c5fd2..6fb42ca 100755
--- a/configure.in
+++ b/configure.in
@@ -3040,7 +3040,7 @@ dnl ===================================================================
 dnl system stl sanity tests
 dnl ===================================================================
 HAVE_GCC_VISIBILITY_BROKEN=
-if test "$_os" != "WINNT" -a "$USE_SYSTEM_STL" = "YES"; then
+if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \) -a "$USE_SYSTEM_STL" = "YES"; then
    AC_MSG_CHECKING([if hash_map will be in __gnu_cxx namespace])
    AC_LANG_PUSH([C++])
 


More information about the Libreoffice-commits mailing list