r39438 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39437‎ | r39438 | r39439 >
Date:20:30, 15 August 2008
Author:river
Status:old
Tags:
Comment:
fix warnings with Intel C++
Modified paths:
  • /trunk/tools/switchboard2/config.cc (modified) (history)
  • /trunk/tools/switchboard2/fcgi.cc (modified) (history)
  • /trunk/tools/switchboard2/fcgi.h (modified) (history)
  • /trunk/tools/switchboard2/main.cc (modified) (history)
  • /trunk/tools/switchboard2/process_factory.cc (modified) (history)
  • /trunk/tools/switchboard2/request_thread.cc (modified) (history)
  • /trunk/tools/switchboard2/swexec.c (modified) (history)
  • /trunk/tools/switchboard2/swkill.c (modified) (history)

Diff [purge]

Index: trunk/tools/switchboard2/swexec.c
@@ -168,7 +168,6 @@
169169 int
170170 main(int argc, char *argv[])
171171 {
172 - int userdir = 0; /* ~userdir flag */
173172 uid_t uid; /* user information */
174173 gid_t gid; /* target group placeholder */
175174 char *target_uname; /* target user name */
@@ -176,7 +175,6 @@
177176 char *target_homedir; /* target home directory */
178177 char *actual_uname; /* actual user name */
179178 char *actual_gname; /* actual group name */
180 - char *prog; /* name of this program */
181179 struct passwd *pw; /* password entry holder */
182180 struct group *gr; /* group entry holder */
183181 #ifdef USE_PROJECTS
@@ -189,7 +187,6 @@
190188 */
191189 clean_env();
192190
193 - prog = argv[0];
194191 /*
195192 * Check existence/validity of the UID of the user
196193 * running this program. Error out if invalid.
Index: trunk/tools/switchboard2/swkill.c
@@ -61,7 +61,6 @@
6262
6363 static void err_output(int is_error, const char *fmt, va_list ap)
6464 {
65 -#ifdef SB_LOG_EXEC
6665 time_t timevar;
6766 struct tm *lt;
6867
@@ -88,46 +87,29 @@
8988 vfprintf(log, fmt, ap);
9089
9190 fflush(log);
92 -#endif /* SB_LOG_EXEC */
9391 return;
9492 }
9593
9694 static void log_err(const char *fmt,...)
9795 {
98 -#ifdef SB_LOG_EXEC
9996 va_list ap;
10097
10198 va_start(ap, fmt);
10299 err_output(1, fmt, ap); /* 1 == is_error */
103100 va_end(ap);
104 -#endif /* SB_LOG_EXEC */
105101 return;
106102 }
107103
108 -static void log_no_err(const char *fmt,...)
109 -{
110 -#ifdef SB_LOG_EXEC
111 - va_list ap;
112 -
113 - va_start(ap, fmt);
114 - err_output(0, fmt, ap); /* 0 == !is_error */
115 - va_end(ap);
116 -#endif /* SB_LOG_EXEC */
117 - return;
118 -}
119 -
120104 int main(int argc, char *argv[])
121105 {
122 - char *prog;
123106 char *target_uname, *target_gname;
124 - char *actual_uname, *actual_gname;
 107+ char *actual_uname;
125108 uid_t uid; /* user information */
126109 gid_t gid; /* target group placeholder */
127110 pid_t target_pid;
128111 struct passwd *pw; /* password entry holder */
129112 struct group *gr; /* group entry holder */
130113
131 - prog = argv[0];
132114 /*
133115 * Check existence/validity of the UID of the user
134116 * running this program. Error out if invalid.
@@ -197,7 +179,6 @@
198180 }
199181 }
200182 gid = gr->gr_gid;
201 - actual_gname = strdup(gr->gr_name);
202183
203184 /*
204185 * Save these for later since initgroups will hose the struct
Index: trunk/tools/switchboard2/config.cc
@@ -222,7 +222,7 @@
223223 try {
224224 newconf.max_procs = boost::lexical_cast<int>(fields[1]);
225225 return true;
226 - } catch (boost::bad_lexical_cast &e) {
 226+ } catch (boost::bad_lexical_cast &) {
227227 LOG4CXX_ERROR(logger,
228228 format("\"%s\", line %d: usage: max-procs <number>\n")
229229 % file_ % lineno_);
@@ -245,7 +245,7 @@
246246 try {
247247 newconf.max_procs_per_user = boost::lexical_cast<int>(fields[1]);
248248 return true;
249 - } catch (boost::bad_lexical_cast &e) {
 249+ } catch (boost::bad_lexical_cast &) {
250250 LOG4CXX_ERROR(logger,
251251 format("\"%s\", line %d: usage: max-procs-per-user <number>\n")
252252 % file_ % lineno_);
@@ -268,7 +268,7 @@
269269 try {
270270 newconf.max_q_per_user = boost::lexical_cast<int>(fields[1]);
271271 return true;
272 - } catch (boost::bad_lexical_cast &e) {
 272+ } catch (boost::bad_lexical_cast &) {
273273 LOG4CXX_ERROR(logger,
274274 format("\"%s\", line %d: usage: max-q-per-user <number>\n")
275275 % file_ % lineno_);
@@ -317,7 +317,7 @@
318318 try {
319319 newconf.php_timeout = boost::lexical_cast<int>(fields[1]);
320320 return true;
321 - } catch (boost::bad_lexical_cast &e) {
 321+ } catch (boost::bad_lexical_cast &) {
322322 LOG4CXX_ERROR(logger,
323323 format("\"%s\", line %d: usage: php-timeout <number>\n")
324324 % file_ % lineno_);
@@ -340,7 +340,7 @@
341341 try {
342342 newconf.server_timeout = boost::lexical_cast<int>(fields[1]);
343343 return true;
344 - } catch (boost::bad_lexical_cast &e) {
 344+ } catch (boost::bad_lexical_cast &) {
345345 LOG4CXX_ERROR(logger,
346346 format("\"%s\", line %d: usage: server-timeout <number>\n")
347347 % file_ % lineno_);
@@ -363,7 +363,7 @@
364364 try {
365365 newconf.max_request_size = boost::lexical_cast<int>(fields[1]);
366366 return true;
367 - } catch (boost::bad_lexical_cast &e) {
 367+ } catch (boost::bad_lexical_cast &) {
368368 LOG4CXX_ERROR(logger,
369369 format("\"%s\", line %d: usage: max-request-size <number>\n")
370370 % file_ % lineno_);
Index: trunk/tools/switchboard2/process_factory.cc
@@ -101,7 +101,6 @@
102102
103103 std::string s = it->second;
104104 struct stat sb;
105 - bool err = false;
106105
107106 while (stat(s.c_str(), &sb) == -1
108107 && errno == ENOTDIR)
Index: trunk/tools/switchboard2/fcgi.cc
@@ -86,9 +86,7 @@
8787 * padding data variable
8888 */
8989
90 - ssize_t i;
91 -
92 - if ((i = timed_read(fd, static_cast<void *>(rec), 8, timeout)) < 8) {
 90+ if (timed_read(fd, static_cast<void *>(rec), 8, timeout) < 8) {
9391 return false;
9492 #if 0
9593 std::fprintf(stderr, "couldn't read entire record header\n");
Index: trunk/tools/switchboard2/fcgi.h
@@ -80,8 +80,8 @@
8181 }
8282
8383 void request_id(int n) {
84 - requestId1_ = n >> 8;
85 - requestId0_ = n & 0xFF;
 84+ requestId1_ = (unsigned char) (n >> 8);
 85+ requestId0_ = (unsigned char) (n & 0xFF);
8686 }
8787 };
8888
Index: trunk/tools/switchboard2/request_thread.cc
@@ -32,7 +32,7 @@
3333 request_thread *req = static_cast<request_thread *>(arg);
3434 try {
3535 req->start_request();
36 - } catch (std::exception &e) {
 36+ } catch (std::exception &) {
3737 }
3838
3939 delete req;
Index: trunk/tools/switchboard2/main.cc
@@ -149,7 +149,7 @@
150150 }
151151
152152 pthread_t tid;
153 - pthread_create(&tid, NULL, acceptor_thread, reinterpret_cast<void *>(lsnsock));
 153+ pthread_create(&tid, NULL, acceptor_thread, reinterpret_cast<void *>((intptr_t) lsnsock));
154154 } else {
155155 int r;
156156 struct addrinfo hints, *res, *iter;
@@ -202,7 +202,7 @@
203203 }
204204
205205 pthread_t tid;
206 - pthread_create(&tid, NULL, acceptor_thread, reinterpret_cast<void *>(lsnsock));
 206+ pthread_create(&tid, NULL, acceptor_thread, reinterpret_cast<void *>((intptr_t) lsnsock));
207207 }
208208
209209 freeaddrinfo(res);

Status & tagging log