From f835533b11abcffb700285a78f61a26ff38c85a5 Mon Sep 17 00:00:00 2001 From: Thurman Gillespy Date: Tue, 30 Apr 2019 09:46:01 -0700 Subject: [PATCH] changed string const names to prevent namespace collisions on Windows --- example/chat_server_demo.cpp | 12 ++++++------ example/echo_binary_text_client_demo.cpp | 6 +++--- example/echo_binary_text_server_demo.cpp | 4 ++-- example/simple_chat_demo.cpp | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/example/chat_server_demo.cpp b/example/chat_server_demo.cpp index 3dbd2930..8852bf68 100644 --- a/example/chat_server_demo.cpp +++ b/example/chat_server_demo.cpp @@ -7,7 +7,7 @@ * @author Thurman Gillespy * * Copyright (c) 2019 Thurman Gillespy - * 4/17/19 + * 4/30/19 * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -55,20 +55,20 @@ bool process_args(int argc, char* const argv[], std::string& ip_addr, " default port = " + PORT + "\n" " server IP address (fixed) = " + LOCAL_LOOP + " (local loop)"; - const std::string HELP = "-h"; - const std::string ERR = "-e"; + const std::string HELP_PRM = "-h"; + const std::string ERR_PRM = "-e"; // set default values ip_addr = LOCAL_LOOP; port = PORT; - if (argc > 3 || (argc == 2 && argv[1] == HELP)) { + if (argc > 3 || (argc == 2 && argv[1] == HELP_PRM)) { std::cout << USAGE << std::endl; return EXIT_FAILURE; } if (argc == 2) { - if (argv[1] == ERR) { + if (argv[1] == ERR_PRM) { print_errors = true; } else { port = argv[1]; @@ -76,7 +76,7 @@ bool process_args(int argc, char* const argv[], std::string& ip_addr, } if (argc == 3) { - if (argv[1] == ERR) { + if (argv[1] == ERR_PRM) { print_errors = true; port = argv[2]; } else { diff --git a/example/echo_binary_text_client_demo.cpp b/example/echo_binary_text_client_demo.cpp index 59058600..0bb3644b 100644 --- a/example/echo_binary_text_client_demo.cpp +++ b/example/echo_binary_text_client_demo.cpp @@ -9,7 +9,7 @@ * @author Thurman Gillespy * * Copyright (c) Thurman Gillespy - * 4/26/19 + * 4/30/19 * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -45,7 +45,7 @@ using endpoint = asio::ip::tcp::endpoint; // process command line args (if any) bool process_args(int argc, char* argv[], bool& print_errors, std::string& ip_address, std::string& port) { - const std::string HELP = "-h"; + const std::string HELP_PRM = "-h"; const std::string PRINT_ERRS = "-e"; const std::string USEAGE = \ "useage: ./echo_client [-h | -e] [ip address/hostname] [port]\n" @@ -58,7 +58,7 @@ bool process_args(int argc, char* argv[], bool& print_errors, std::string& ip_ad int offset = 0; - if (argc > 4 || (argc > 1 && argv[1] == HELP)) { + if (argc > 4 || (argc > 1 && argv[1] == HELP_PRM)) { std::cout << USEAGE << std::endl; return EXIT_FAILURE; } diff --git a/example/echo_binary_text_server_demo.cpp b/example/echo_binary_text_server_demo.cpp index 195e8366..0d310065 100644 --- a/example/echo_binary_text_server_demo.cpp +++ b/example/echo_binary_text_server_demo.cpp @@ -44,7 +44,7 @@ using endpoint = asio::ip::tcp::endpoint; // process command line args (if any) bool processArgs(int argc, char* argv[], bool& print_errors, std::string& port) { - const std::string HELP = "-h"; + const std::string HELP_PRM = "-h"; const std::string PRINT_ERRS = "-e"; const std::string USEAGE = \ "useage: ./echo_server [-h | -e] [port]\n" @@ -53,7 +53,7 @@ bool processArgs(int argc, char* argv[], bool& print_errors, std::string& port) " port Default: 5002"; int offset = 0; - if (argc > 3 || (argc > 1 && argv[1] == HELP)) { + if (argc > 3 || (argc > 1 && argv[1] == HELP_PRM)) { std::cout << USEAGE << std::endl; return EXIT_FAILURE; } diff --git a/example/simple_chat_demo.cpp b/example/simple_chat_demo.cpp index 7c0c7464..3d688f73 100644 --- a/example/simple_chat_demo.cpp +++ b/example/simple_chat_demo.cpp @@ -7,7 +7,7 @@ * @author Thurman Gillespy * * Copyright (c) 2019 Thurman Gillespy - * 4/19/19 + * 4/30/19 * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -122,9 +122,9 @@ bool process_args(int argc, char* const argv[], std::string& ip_addr, " default ip address: " + LOCAL_LOOP + " (local loop)\n" " default port: " + PORT + "\n" " if connection type = accept, IP address becomes \"\""; - const std::string HELP = "-h"; - const std::string ERR = "-e"; - const std::string EMPTY = ""; + const std::string HELP_PRM = "-h"; + const std::string PRINT_ERRS = "-e"; + int offset = 0; // 1 when -e 1st parameter // set default values @@ -137,10 +137,10 @@ bool process_args(int argc, char* const argv[], std::string& ip_addr, return EXIT_FAILURE; }; - if (argv[1] == HELP) { + if (argv[1] == HELP_PRM) { std::cout << USAGE << std::endl; return EXIT_FAILURE; - } else if (argv[1] == ERR) { + } else if (argv[1] == PRINT_ERRS) { print_errors = true; offset = 1; }