[flatc] Remove an always true condition for flexbuffers (#5604)
authorPaulo Pinheiro <paulovictor.pinheiro@gmail.com>
Mon, 4 Nov 2019 22:23:15 +0000 (23:23 +0100)
committerWouter van Oortmerssen <aardappel@gmail.com>
Mon, 4 Nov 2019 22:23:15 +0000 (14:23 -0800)
The condition was unnecessary and Detected by

PVS-Studio
V560 [CWE-571] A part of conditional expression is always true: !opts.use_flexbuffers. flatc.cpp 438

src/flatc.cpp

index e52dad4..ab2b1fa 100644 (file)
@@ -435,8 +435,7 @@ int FlatCompiler::Compile(int argc, const char **argv) {
         }
       } else {
         ParseFile(*parser.get(), filename, contents, include_directories);
-        if (!opts.use_flexbuffers && !is_schema &&
-            !parser->builder_.GetSize()) {
+        if (!is_schema && !parser->builder_.GetSize()) {
           // If a file doesn't end in .fbs, it must be json/binary. Ensure we
           // didn't just parse a schema with a different extension.
           Error("input file is neither json nor a .fbs (schema) file: " +