Skip to content

Commit

Permalink
Fix Compile Warnings (#3356)
Browse files Browse the repository at this point in the history
* fix warning:maybe-uninitialized in CStringToEnum

* fix out of buffer write warning in unit tests

* Apply suggestions from code review
  • Loading branch information
iCollin authored May 11, 2020
1 parent 902144c commit bfacfcb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ class EnumConversionHelper {
typename CStringToEnumMap::const_iterator it =
cstring_to_enum_map().find(str);
if (it == cstring_to_enum_map().end()) {
if (value) {
*value = EnumType::INVALID_ENUM;
}
return false;
}
if (value) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/smart_objects/test/SmartObjectUnit_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using namespace ns_smart_device_link::ns_smart_objects;
class TestHelper : public ::testing::Test {
protected:
void makeMapObject(SmartObject& obj, const int size) const {
char i_key[8], j_key[8], k_key[8], value[8];
char i_key[32], j_key[32], k_key[32], value[32];

for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
Expand All @@ -57,7 +57,7 @@ class TestHelper : public ::testing::Test {
}

void checkMapObject(SmartObject& obj, const int size) const {
char i_key[8], j_key[8], k_key[8], value[8];
char i_key[32], j_key[32], k_key[32], value[32];

for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
Expand Down

0 comments on commit bfacfcb

Please sign in to comment.