[Libreoffice-commits] .: rsc/source

Tor Lillqvist tml at kemper.freedesktop.org
Sat Oct 8 06:44:41 PDT 2011


 rsc/source/rscpp/cpp3.c |    7 +++----
 rsc/source/rscpp/cpp4.c |   11 ++++++-----
 rsc/source/rscpp/cpp6.c |    3 ++-
 3 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 88b265f102939bbc5b51653eb656d6e16b5cff07
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Sat Oct 8 16:39:13 2011 +0300

    Revert "cppcheck reduce scope of var in rsc/...cpp3.c/cpp4.c/cpp6.c"
    
    As long as we want to be buildable with MSVC 2008, we can't use C99
    features in our C source files. (Yeah, horrible, M$ suxors, etc,
    complain to your mother.) Please relax the cppcheck enthusiasm, or at
    least, tune cppcheck to follow C89 for C files.
    
    This reverts commit 0921457488898b43152e33d1184929f7436aeeb4.

diff --git a/rsc/source/rscpp/cpp3.c b/rsc/source/rscpp/cpp3.c
index b9ed7a9..7f9c8ad 100644
--- a/rsc/source/rscpp/cpp3.c
+++ b/rsc/source/rscpp/cpp3.c
@@ -449,6 +449,7 @@ void initdefines()
         register char           **pp;
         register char           *tp;
         register DEFBUF         *dp;
+        int                     i;
         time_t                  tvec;
 
 #if !defined( WNT ) && !defined(G3)
@@ -475,10 +476,8 @@ void initdefines()
          * notices this and calls the appropriate routine.
          * DEF_NOARGS is one greater than the first "magic" definition.
          */
-        if (nflag < 2)
-        {
-            int i = DEF_NOARGS;
-            for (pp = magic; *pp != NULL; pp++) {
+        if (nflag < 2) {
+            for (pp = magic, i = DEF_NOARGS; *pp != NULL; pp++) {
                 dp = defendel(*pp, FALSE);
                 dp->nargs = --i;
             }
diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c
index af8995b..3f5e03a 100644
--- a/rsc/source/rscpp/cpp4.c
+++ b/rsc/source/rscpp/cpp4.c
@@ -554,9 +554,12 @@ void expstuff(DEFBUF* tokenp)
  * Stuff the macro body, replacing formal parameters by actual parameters.
  */
 {
+        register int    c;                      /* Current character    */
         register char   *inp;                   /* -> repl string       */
         register char   *defp;                  /* -> macro output buff */
+        int             size;                   /* Actual parm. size    */
         char            *defend;                /* -> output buff end   */
+        int             string_magic;           /* String formal hack   */
         FILEINFO        *file;                  /* Funny #include       */
     extern FILEINFO *getfile();
 
@@ -565,7 +568,6 @@ void expstuff(DEFBUF* tokenp)
         defp = file->buffer;                    /* -> output buffer     */
         defend = defp + (NBUFF - 1);            /* Note its end         */
         if (inp != NULL) {
-            register int c;                      /* Current character    */
             while ((c = (*inp++ & 0xFF)) != EOS) {
 #ifdef SOLAR
                 if (c == DEL) {
@@ -573,15 +575,14 @@ void expstuff(DEFBUF* tokenp)
 #else
                 if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) {
 #endif
-                    int string_magic = (c == (MAC_PARM + PAR_MAC));
+                    string_magic = (c == (MAC_PARM + PAR_MAC));
                     if (string_magic)
                         c = (*inp++ & 0xFF);
                     /*
                      * Replace formal parameter by actual parameter string.
                      */
-                    if ((c -= MAC_PARM) < nargs)
-                    {
-                        int size = strlen(parlist[c]);
+                    if ((c -= MAC_PARM) < nargs) {
+                        size = strlen(parlist[c]);
                         if ((defp + size) >= defend)
                             goto nospace;
                         /*
diff --git a/rsc/source/rscpp/cpp6.c b/rsc/source/rscpp/cpp6.c
index 6c021fb..cb628ba 100644
--- a/rsc/source/rscpp/cpp6.c
+++ b/rsc/source/rscpp/cpp6.c
@@ -278,6 +278,7 @@ catenate()
  * and return FALSE.
  */
 {
+        register int            c;
         register char           *token1;
 
 #if OK_CONCAT
@@ -287,7 +288,7 @@ catenate()
         }
         else {
             token1 = savestring(token);         /* Save first token     */
-            register int c = macroid(get());                 /* Scan next token      */
+            c = macroid(get());                 /* Scan next token      */
             switch(type[c]) {                   /* What was it?         */
             case LET:                           /* An identifier, ...   */
                 if (strlen(token1) + strlen(token) >= NWORK)


More information about the Libreoffice-commits mailing list