r17686 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17685‎ | r17686 | r17687 >
Date:23:24, 14 November 2006
Author:river
Status:old
Tags:
Comment:
icc warning fixes
Modified paths:
  • /trunk/willow/src/wgetstats/wgetstats.cc (modified) (history)
  • /trunk/willow/src/willow/flowio.cc (modified) (history)
  • /trunk/willow/src/willow/lexer.l (modified) (history)
  • /trunk/willow/src/willow/whttp_header.cc (modified) (history)
  • /trunk/willow/src/wreadlog/wreadlog.cc (modified) (history)

Diff [purge]

Index: trunk/willow/src/wreadlog/wreadlog.cc
@@ -40,6 +40,10 @@
4141 using std::strchr;
4242 using std::auto_ptr;
4343
 44+#ifdef __INTEL_COMPILER
 45+# pragma warning (disable: 1418 383 981)
 46+#endif
 47+
4448 #include "acl.h"
4549
4650 static FILE *outfile = stdout;
@@ -143,7 +147,7 @@
144148 static void
145149 doprint_squid(logent &e)
146150 {
147 - fprintf(outfile, "%ul.0 0 %s TCP_%s/%d %lu %s %.*s - ", (unsigned long)*e.r_reqtime,
 151+ fprintf(outfile, "%lu.0 0 %s TCP_%s/%d %lu %s %.*s - ", (unsigned long)*e.r_reqtime,
148152 resolve(e.r_cliaddr, *e.r_clilen), *e.r_cached ? "HIT" : "MISS",
149153 (int)*e.r_status, (unsigned long)*e.r_docsize,
150154 reqtypes[*e.r_reqtype], (int)*e.r_pathlen, e.r_path);
@@ -156,13 +160,12 @@
157161 wait_event(vector<int> &socks, int maxfd, fd_set &rfds)
158162 {
159163 vector<int>::iterator it, end;
160 -int i;
161164 for (;;) {
162165 bzero(&rfds, sizeof(rfds));
163166 FD_ZERO(&rfds);
164167 for (it = socks.begin(), end = socks.end(); it != end; ++it)
165168 FD_SET(*it, &rfds);
166 - if (select(maxfd + 1, &rfds, NULL, NULL, NULL) <1) {
 169+ if (select(maxfd + 1, &rfds, NULL, NULL, NULL) < 1) {
167170 if (errno == EINTR)
168171 continue;
169172 fprintf(stderr, "select: %s\n", strerror(errno));
@@ -195,8 +198,8 @@
196199 {
197200 sockaddr_storage cliaddr;
198201 socklen_t clilen;
199 -int n, i, nlen;
200 -char buf[65535], *end = buf + sizeof(buf), *bufp = buf;
 202+int n;
 203+char buf[65535], *end, *bufp = buf;
201204 const aclnode *an;
202205 clilen = sizeof(cliaddr);
203206 bufp = buf;
@@ -205,6 +208,8 @@
206209 exit(8);
207210 }
208211
 212+ end = buf + n;
 213+
209214 if (((an = acl4.match((sockaddr *)&cliaddr)) && (an->action == ACL_BLOCK))
210215 || ((an = acl6.match((sockaddr *)&cliaddr)) && (an->action == ACL_BLOCK)))
211216 return;
@@ -265,7 +270,6 @@
266271 int i;
267272 const char *port = "4445", *host = NULL;
268273 char *progname = argv[0];
269 -struct sockaddr_in servaddr, cliaddr;
270274 struct addrinfo hints, *res;
271275 bool daemon = false;
272276 memset(&hints, 0, sizeof(hints));
@@ -320,7 +324,7 @@
321325 if (strchr(p, '.')) {
322326 if (!len)
323327 len = 32;
324 - if (acl4.add(p, len, ACL_PASS, ACLFL_NONE) == false) {
 328+ if (acl4.add(p, (uint8_t) len, ACL_PASS, ACLFL_NONE) == false) {
325329 fprintf(stderr, "%s: could not parse IP mask: %s\n", argv[0], optarg);
326330 return 1;
327331 }
@@ -329,7 +333,7 @@
330334 else {
331335 if (!len)
332336 len = 128;
333 - if (acl6.add(p, len, ACL_PASS, ACLFL_NONE) == false) {
 337+ if (acl6.add(p, (uint8_t) len, ACL_PASS, ACLFL_NONE) == false) {
334338 fprintf(stderr, "%s: could not parse IP mask: %s\n", argv[0], optarg);
335339 return 1;
336340 }
Index: trunk/willow/src/wgetstats/wgetstats.cc
@@ -25,15 +25,18 @@
2626 using std::strerror;
2727 using std::string;
2828
 29+#ifdef __INTEL_COMPILER
 30+# pragma warning (disable: 383 981 1418)
 31+#endif
 32+
2933 string
3034 fstraddr(string const &straddr, sockaddr const *addr, socklen_t len)
3135 {
3236 char host[NI_MAXHOST];
3337 char port[NI_MAXSERV];
3438 string res;
35 -int i;
36 - if ((i = getnameinfo(addr, len, host, sizeof(host), port, sizeof(port),
37 - NI_NUMERICHOST | NI_NUMERICSERV)) != 0)
 39+ if (getnameinfo(addr, len, host, sizeof(host), port, sizeof(port),
 40+ NI_NUMERICHOST | NI_NUMERICSERV) != 0)
3841 return "";
3942 return straddr + '[' + host + "]:" + port;
4043 }
@@ -155,12 +158,19 @@
156159 reqfails = (uint32_t *) bufp; GET_BYTES(4);
157160 respfails = (uint32_t *) bufp; GET_BYTES(3);
158161
 162+ if (*vers != 1) {
 163+ fprintf(stderr,
 164+ "cannot decode this statistics format version (%d, expected 1)\n",
 165+ (int) *vers);
 166+ exit(1);
 167+ }
 168+
159169 fprintf(stderr, "%s (Willow %.*s), report interval %d seconds:\n", host,
160170 (int)*wverslen, wvers, (int) *repint);
161171 fprintf(stderr, "\tTotal requests served: % 10lu (% 6d/sec) Errors: % 6lu (% 6d/sec)\n",
162 - (unsigned long) *treqok, (int) *reqoks, (unsigned long) *treqfail, *reqfails);
 172+ (unsigned long) *treqok, (int) *reqoks, (unsigned long) *treqfail, (int) *reqfails);
163173 fprintf(stderr, "\tBackend requests: % 10lu (% 6d/sec) Invalid: % 6lu (% 6d/sec)\n",
164 - (unsigned long) *trespok, (int) *respoks, (unsigned long) *trespfail, *respfails);
 174+ (unsigned long) *trespok, (int) *respoks, (unsigned long) *trespfail, (int) *respfails);
165175
166176 freeaddrinfo(res);
167177 }
Index: trunk/willow/src/willow/flowio.cc
@@ -107,8 +107,6 @@
108108 void
109109 socket_spigot::_socketcall(wsocket *s, int) {
110110 ssize_t read;
111 -sink_result res;
112 -int bufsz;
113111
114112 /*
115113 * _off is the offset of the start of _savebuf
Index: trunk/willow/src/willow/whttp_header.cc
@@ -42,7 +42,7 @@
4343 H_CONNECTION,
4444 H_LOCATION,
4545 H_X_WILLOW_BACKEND_GROUP,
46 - H_X_WILLOW_FOLLOW_REDIRECT,
 46+ H_X_WILLOW_FOLLOW_REDIRECT
4747 };
4848
4949 #if 0
@@ -132,26 +132,6 @@
133133 }
134134 #endif
135135
136 -/*
137 - * A list of headers we should remove from the request and the response
138 - * because we don't like them, or we want to insert our own.
139 - */
140 -static const struct rmhdr_t {
141 - char *name;
142 - size_t len;
143 -} removable_headers[] = {
144 - { "If-Modified-Since", sizeof("If-Modified-Since") - 1 },
145 - { "Last-Modified", sizeof("Last-Modified") - 1 },
146 - { "Keep-Alive", sizeof("Keep-Alive") - 1 },
147 - { "TE", sizeof("TE") - 1 },
148 - { "Trailers", sizeof("Trailers") - 1 },
149 - { "Upgrade", sizeof("Upgrade") - 1 },
150 - { "Proxy-Authenticate", sizeof("Proxy-Authenticate") - 1 },
151 - { "Proxy-Authorization", sizeof("Proxy-Authorization") - 1 },
152 - { "Proxy-Connection", sizeof("Proxy-Connection") - 1 },
153 - { NULL, 0 }
154 -};
155 -
156136 const char *request_string[] = {
157137 "GET ",
158138 "POST ",
@@ -169,18 +149,6 @@
170150 { NULL, 0, REQTYPE_INVALID }
171151 };
172152
173 -/*
174 - * Check if we should remove this header.
175 - */
176 -static bool
177 -is_removable(char const *header, size_t hlen)
178 -{
179 - for (rmhdr_t const *s = removable_headers; s->name; ++s)
180 - if (hlen == s->len && !strncasecmp(header, s->name, hlen))
181 - return true;
182 - return false;
183 -}
184 -
185153 static int
186154 find_reqtype(char const *str, int len)
187155 {
@@ -293,8 +261,6 @@
294262 void
295263 header_list::append_last(const char *append, size_t len)
296264 {
297 -char const *tmp;
298 -char *n;
299265 int curnlen, curvlen;
300266 curnlen = strlen(hl_last->hr_name);
301267 curvlen = strlen(hl_last->hr_value);
@@ -364,7 +330,7 @@
365331 char *
366332 header_list::build(void)
367333 {
368 -char *buf, *bufp;
 334+char *buf;
369335 size_t bufsz;
370336 size_t buflen = 0;
371337
@@ -510,7 +476,6 @@
511477 {
512478 char const *path, *vers;
513479 size_t plen, vlen;
514 -int httpmaj, httpmin;
515480 if ((path = (char const *)memchr(buf, ' ', endp - buf)) == NULL)
516481 return -1;
517482 path++;
@@ -602,8 +567,6 @@
603568 void
604569 header_parser::sp_uncork(void)
605570 {
606 -char *bptr;
607 -int left = _headers.hl_len;
608571 if (!_built) {
609572 char *s;
610573 if (!_is_response) {
Index: trunk/willow/src/willow/lexer.l
@@ -32,7 +32,6 @@
3333 int lineno;
3434 } statestack[MAXINCLUDE + 1];
3535 int inclevel;
36 -static int oldpos;
3736 static bool in_if;
3837
3938 #undef YY_INPUT
@@ -58,7 +57,7 @@
5958
6059 ^.* {
6160 conf::linebuf.assign(yytext, yyleng);
62 - oldpos = conf::curpos = 0;
 61+ conf::curpos = 0;
6362 yyless(0);
6463 }
6564 <IGNORING>{if} { conf::report_parse_error("%%if may not be nested"); }
@@ -133,27 +132,27 @@
134133 yyterminate();
135134 }
136135
137 -\t { oldpos = conf::curpos; conf::curpos += 8; }
138 -{ws} { oldpos = conf::curpos; conf::curpos += yyleng; }
139 -var { oldpos = conf::curpos; conf::curpos += yyleng; return VAR; }
140 -template { oldpos = conf::curpos; conf::curpos += yyleng; return TEMPLATE; }
141 -from { oldpos = conf::curpos; conf::curpos += yyleng; return FROM; }
142 -\.\. { oldpos = conf::curpos; conf::curpos += yyleng; return TWODOTS; }
 136+\t { conf::curpos += 8; }
 137+{ws} { conf::curpos += yyleng; }
 138+var { conf::curpos += yyleng; return VAR; }
 139+template { conf::curpos += yyleng; return TEMPLATE; }
 140+from { conf::curpos += yyleng; return FROM; }
 141+\.\. { conf::curpos += yyleng; return TWODOTS; }
143142
144143 {qstring} {
145144 yylval.string_ = new string(yytext + 1, yyleng - 2);
146 - oldpos = conf::curpos; conf::curpos += yyleng;
 145+ conf::curpos += yyleng;
147146 return QSTRING;
148147 }
149148 {string} {
150149 yylval.string_ = new string(yytext, yyleng);
151 - oldpos = conf::curpos; conf::curpos += yyleng;
 150+ conf::curpos += yyleng;
152151 return STRING;
153152 }
154153 {number} {
155154 yylval.number = atoi(yytext);
156 - oldpos = conf::curpos; conf::curpos += yyleng;
 155+ conf::curpos += yyleng;
157156 return NUMBER;
158157 }
159 -. { oldpos = conf::curpos; conf::curpos++; return yytext[0]; }
 158+. { conf::curpos++; return yytext[0]; }
160159 %%

Follow-up revisions

RevisionCommit summaryAuthorDate
r19801Add a mechanism to parserTests when run in --compare or --record mode, to giv...nickj06:59, 6 February 2007