diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2014-07-01 01:41:17 -0700 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2014-07-01 01:41:17 -0700 |
commit | 64ee0139bca3f0d594ba69068b25bc591cd1dfe3 (patch) | |
tree | 528873b998cb8c95f63b0cdd37315ba71dfa4212 | |
parent | 4a1c5a8a9954b9141de72054b2d1b0cd888fa767 (diff) |
SDK: avoid cppcheck warning
cppcheck 1.65 warned about uninitialized variables because it did not fully
understand the indirect "if no file, then error, if no error, then use file"
logic.
Simplifying the code to check the file directly avoids the false positives
and also is easier to read for humans.
-rw-r--r-- | src/sysync_SDK/Sources/dbitem.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sysync_SDK/Sources/dbitem.cpp b/src/sysync_SDK/Sources/dbitem.cpp index d9ea264..f1bbe46 100644 --- a/src/sysync_SDK/Sources/dbitem.cpp +++ b/src/sysync_SDK/Sources/dbitem.cpp @@ -829,7 +829,7 @@ TSyError TDBItem::LoadDB( bool withKey, cAppCharP aPrefix, void* aCB ) string rslt; DEBUG_Block( aCB, LDB, fFileName.c_str(), s.c_str() ); // hierarchical log - if (!err) { + if (f) { while (true) { // loop ... bool is0D= false; // last line ended with 0D ? @@ -966,7 +966,7 @@ TSyError TDBItem::SaveDB( bool withKey, void* aCB ) string rslt; DEBUG_Block( aCB, SDB, fFileName.c_str(), s.c_str() ); // hierarchical log - if (!err) { + if (f) { fputs( "\xEF\xBB\xBF", f ); // UTF-8 lead-in DEBUG_Exotic_DB( aCB, MyDB,"","UTF-8 lead-in written" ); |