Skip to content

Commit

Permalink
Remove "Conditional jump or move depends on uninitialised value(s)"
Browse files Browse the repository at this point in the history
If the file cannot be read, the character buffer won't be changed. As a
consequence, we could just let it be filled (unconditionally) with zeros. We
don't need to test whether `read()` has succeeded.
  • Loading branch information
LucHermitte committed Aug 5, 2016
1 parent f6723b4 commit 141e8a5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/projection/ossimSensorModelFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,10 @@ ossimProjection* ossimSensorModelFactory::createProjection(
}

ifstream input(geomFile.c_str());
char ecgTest[4];
input.read((char*)ecgTest, 3);
ecgTest[3] = '\0';
char ecgTest[4] = { 0 };
input.read(ecgTest, 3); // even if `read()` fails, it will be initialized thanks to `= { 0 };`
input.close();
if(ossimString(ecgTest) == "eCG")
if(std::string(ecgTest) == "eCG")
{
ossimKeywordlist kwlTemp;
kwlTemp.add("type",
Expand Down

0 comments on commit 141e8a5

Please sign in to comment.