develooper Front page | perl.perl5.porters | Postings from August 2001

[PATCH bleadperl] quiet down VC++ warnings in a2py.c and walk.c

From:
Nikola Knezevic
Date:
August 24, 2001 13:19
Subject:
[PATCH bleadperl] quiet down VC++ warnings in a2py.c and walk.c
Message ID:
1065978076.20010824221042@tesla.rcub.bg.ac.yu
Hi,
I've noticed that always during build I get warning like this:
..\x2p\a2py.c(203) : warning C4035: 'main' : no return value
..\x2p\walk.c(257) : warning C4305: '+=' : truncation from 'const int ' to 'char '
..\x2p\walk.c(852) : warning C4305: '=' : truncation from 'const int ' to 'char '
..\x2p\walk.c(854) : warning C4305: '=' : truncation from 'const int ' to 'char '
..\x2p\walk.c(934) : warning C4305: '=' : truncation from 'const int ' to 'char '
..\x2p\walk.c(1011) : warning C4305: '+=' : truncation from 'const int ' to 'char '
..\x2p\walk.c(1063) : warning C4305: '+=' : truncation from 'const int ' to 'char '
..\x2p\walk.c(1072) : warning C4305: '+=' : truncation from 'const int ' to 'char '

I'm not very good at C/C++, but this works. Also, it's by the book.
There are still some warnings in POSIX.xs and win32.c (or .h, can't
remember right now).


Differencess are here:
--- bleadperl\x2p\a2py.c        Sat Jun 16 22:49:30 2001
+++ workin_bleadperl\x2p\a2py.c Tue Aug 21 23:18:56 2001
@@ -200,6 +200,8 @@
          "The operation I've selected may be wrong for the operand types.\n");
     }
     exit(0);
+    /* by ANSI specs return is needed. This also shuts up VC++ and his warnings */
+    return(0);
 }
 
 #define RETURN(retval) return (bufptr = s,retval)


--- bleadperl\x2p\walk.c        Wed Jun  6 07:09:10 2001
+++ workin_bleadperl\x2p\walk.c Tue Aug 21 23:25:44 2001
@@ -254,7 +254,7 @@
        }
        *d = '\0';
        for (d=tokenbuf; *d; d++)
-           *d += 128;
+           *d += (char)128;
        str_cat(str,tokenbuf);
        str_free(tmpstr);
        str_cat(str,"/");
@@ -849,9 +849,9 @@
            tmp2str=walk(1,level,ops[ops[node+2].ival+1].ival,&numarg,P_MIN);
            for (t = tmp2str->str_ptr, d=tokenbuf; *t; d++,t++) {
                if (*t == '&')
-                   *d++ = '$' + 128;
+                   *d++ = '$' + (char)128;
                else if (*t == '$')
-                   *d++ = '\\' + 128;
+                   *d++ = '\\' + (char)128;
                *d = *t + 128;
            }
            *d = '\0';
@@ -931,7 +931,7 @@
                case '\\': case '"': case 'n': case 't': case '$':
                    break;
                default:        /* hide this from perl */
-                   *d++ = '\\' + 128;
+                   *d++ = '\\' + (char)128;
                }
            }
            *d = *t + 128;
@@ -1008,7 +1008,7 @@
                    strcpy(tokenbuf,"]");
                else
                    strcpy(tokenbuf,"}");
-               *tokenbuf += 128;
+               *tokenbuf += (char)128;
                str_cat(str,tokenbuf);
            }
        }
@@ -1060,7 +1060,7 @@
        str_set(str,";");
        tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
        for (s = tmpstr->str_ptr; *s && *s != '\n'; s++)
-           *s += 128;
+           *s += (char)128;
        str_scat(str,tmpstr);
        str_free(tmpstr);
        tab(str,level);
@@ -1069,7 +1069,7 @@
        str = str_new(0);
        tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
        for (s = tmpstr->str_ptr; *s && *s != '\n'; s++)
-           *s += 128;
+           *s += (char)128;
        str_scat(str,tmpstr);
        str_free(tmpstr);
        tab(str,level);


[END OF PATCH.]
-- 
 .            `\!,        
 .            <. .>    
 [=======oOo==( ^ )==oOo========[ indy@hemo.net ]=======]      
 |---      _    -            --- [    member of    ]--- |        
 [========( )======_==============[ .counter attack. ]==]           
 .         ()     ( )
 .                ()




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About