From: Stephen Morris Date: Wed, 15 Feb 2012 16:20:21 +0000 (+0000) Subject: [1593] Minor tidy up X-Git-Tag: trac2351_base~253 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e40cec7b4d5a0fc473bb5d4abfb6a93a712e0cb4;p=thirdparty%2Fkea.git [1593] Minor tidy up --- diff --git a/src/bin/sockcreator/sockcreator.cc b/src/bin/sockcreator/sockcreator.cc index 55b7786f59..639ae75979 100644 --- a/src/bin/sockcreator/sockcreator.cc +++ b/src/bin/sockcreator/sockcreator.cc @@ -98,8 +98,7 @@ handle_request(const int input_fd, const int output_fd, switch (type[1]) { // The address family // The casting to apparently incompatible types by reinterpret_cast - // is required by the C low-level interface. Unions are not used - // because of the possibility of alignment issues. + // is required by the C low-level interface. case '4': addr = reinterpret_cast(&addr_in); @@ -162,7 +161,7 @@ handle_request(const int input_fd, const int output_fd, // ...and append the reason code to the error message int error = errno; - write_message(output_fd, static_cast(&error), sizeof error); + write_message(output_fd, static_cast(&error), sizeof error); } } @@ -175,11 +174,11 @@ namespace socket_creator { int get_sock(const int type, struct sockaddr *bind_addr, const socklen_t addr_len) { - int sock(socket(bind_addr->sa_family, type, 0)); + int sock = socket(bind_addr->sa_family, type, 0); if (sock == -1) { return -1; } - const int on(1); + const int on = 1; if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) { return -2; // This is part of the binding process, so it's a bind error } diff --git a/src/bin/sockcreator/tests/sockcreator_tests.cc b/src/bin/sockcreator/tests/sockcreator_tests.cc index b792296327..5bafbb8510 100644 --- a/src/bin/sockcreator/tests/sockcreator_tests.cc +++ b/src/bin/sockcreator/tests/sockcreator_tests.cc @@ -267,12 +267,13 @@ closeIgnore(int) { // parses the commands correctly. void run_test(const char* input_data, const size_t input_size, const char* output_data, const size_t output_size, - bool should_succeed = true, const close_t test_close = closeIgnore, + bool should_succeed = true, + const close_t test_close = closeIgnore, const send_fd_t send_fd = send_fd_dummy) { // Prepare the input feeder and output checker processes. The feeder // process sends data from the client to run() and the checker process - // reads the response and checks the output. + // reads the response and checks it against the expected response. int input_fd = 0; pid_t input = provide_input(&input_fd, input_data, input_size); ASSERT_NE(-1, input) << "Couldn't start input feeder"; @@ -294,7 +295,6 @@ void run_test(const char* input_data, const size_t input_size, close(input_fd); close(output_fd); - // Did it run well? // Check the subprocesses say everything is OK too EXPECT_TRUE(process_ok(input)); EXPECT_TRUE(process_ok(output));