Commit f1e44f2bc433565df6d5b9f3af0190deda4230ea
1 parent
e4a350c9
Use append to set string value.
We use append to set the string value instead of the assignment operator to make Cppcheck happy. Cppcheck claimed that we return an auto variable, which a priori was not the case.
Showing
1 changed file
with
20 additions
and
14 deletions
src/app/GPar.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GPar.cpp - Application parameter * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2011 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2010-2012 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | /** |
| 22 | 22 | * @file GPar.cpp |
| 23 | 23 | * @brief Application parameter class implementation |
| 24 | - * @author Jurgen Knodlseder | |
| 24 | + * @author Juergen Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | /* __ Includes ___________________________________________________________ */ |
| ... | ... | @@ -1018,19 +1018,25 @@ std::string gpar_type_string(const std::string& type) |
| 1018 | 1018 | std::string type_string; |
| 1019 | 1019 | |
| 1020 | 1020 | // Set type dependent string |
| 1021 | - if (type == "b") | |
| 1022 | - type_string = "boolean"; | |
| 1023 | - else if (type == "i") | |
| 1024 | - type_string = "integer"; | |
| 1025 | - else if (type == "r") | |
| 1026 | - type_string = "real"; | |
| 1027 | - else if (type == "s") | |
| 1028 | - type_string = "string"; | |
| 1021 | + if (type == "b") { | |
| 1022 | + type_string.append("boolean"); | |
| 1023 | + } | |
| 1024 | + else if (type == "i") { | |
| 1025 | + type_string.append("integer"); | |
| 1026 | + } | |
| 1027 | + else if (type == "r") { | |
| 1028 | + type_string.append("real"); | |
| 1029 | + } | |
| 1030 | + else if (type == "s") { | |
| 1031 | + type_string.append("string"); | |
| 1032 | + } | |
| 1029 | 1033 | else if (type == "f" || type == "fr" || type == "fw" || |
| 1030 | - type == "fe" || type == "fn") | |
| 1031 | - type_string = "filename"; | |
| 1032 | - else | |
| 1033 | - type_string = "unknown"; | |
| 1034 | + type == "fe" || type == "fn") { | |
| 1035 | + type_string.append("filename"); | |
| 1036 | + } | |
| 1037 | + else { | |
| 1038 | + type_string.append("unknown"); | |
| 1039 | + } | |
| 1034 | 1040 | |
| 1035 | 1041 | // Return type string |
| 1036 | 1042 | return type_string; | ... | ... |