mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 21:20:03 +00:00
VS2010 fixes
This commit is contained in:
@@ -81,7 +81,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../../include;../../grpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../../include;../../grpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../../include;../../grpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
<ExceptionHandling>Sync</ExceptionHandling>
|
<ExceptionHandling>Sync</ExceptionHandling>
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
@@ -219,7 +219,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../../include;../../grpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
<ExceptionHandling>Sync</ExceptionHandling>
|
<ExceptionHandling>Sync</ExceptionHandling>
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
@@ -263,6 +263,8 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\grpc\src\compiler\cpp_generator.cc" />
|
||||||
|
<ClCompile Include="..\..\src\idl_gen_grpc.cpp" />
|
||||||
<ClCompile Include="..\..\src\util.cpp" />
|
<ClCompile Include="..\..\src\util.cpp" />
|
||||||
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
|
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
|
||||||
<ClInclude Include="..\..\include\flatbuffers\idl.h" />
|
<ClInclude Include="..\..\include\flatbuffers\idl.h" />
|
||||||
|
|||||||
@@ -1351,7 +1351,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
|
|||||||
size_t GetComputedSize() const {
|
size_t GetComputedSize() const {
|
||||||
uintptr_t size = upper_bound_ - buf_;
|
uintptr_t size = upper_bound_ - buf_;
|
||||||
// Align the size to uoffset_t
|
// Align the size to uoffset_t
|
||||||
size = (size - 1 + sizeof(uoffset_t)) & -uintptr_t(sizeof(uoffset_t));
|
size = (size - 1 + sizeof(uoffset_t)) & ~(sizeof(uoffset_t) - 1);
|
||||||
return (buf_ + size > end_) ? 0 : size;
|
return (buf_ + size > end_) ? 0 : size;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ class GeneralGenerator : public BaseGenerator {
|
|||||||
lang_(language_parameters[parser_.opts.lang]) {
|
lang_(language_parameters[parser_.opts.lang]) {
|
||||||
assert(parser_.opts.lang <= IDLOptions::kMAX);
|
assert(parser_.opts.lang <= IDLOptions::kMAX);
|
||||||
};
|
};
|
||||||
|
GeneralGenerator &operator=(const GeneralGenerator &);
|
||||||
bool generate() {
|
bool generate() {
|
||||||
std::string one_file_code;
|
std::string one_file_code;
|
||||||
|
|
||||||
@@ -235,7 +236,7 @@ class GeneralGenerator : public BaseGenerator {
|
|||||||
|
|
||||||
// Save out the generated code for a single class while adding
|
// Save out the generated code for a single class while adding
|
||||||
// declaration boilerplate.
|
// declaration boilerplate.
|
||||||
bool SaveType(const std::string &defname, const Namespace &ns,
|
bool SaveType(const std::string &defname, const Namespace &ns,
|
||||||
const std::string &classcode, bool needs_includes) {
|
const std::string &classcode, bool needs_includes) {
|
||||||
if (!classcode.length()) return true;
|
if (!classcode.length()) return true;
|
||||||
|
|
||||||
@@ -1133,7 +1134,7 @@ void GenStruct(StructDef &struct_def, std::string *code_ptr) {
|
|||||||
// Java does not need the closing semi-colon on class definitions.
|
// Java does not need the closing semi-colon on class definitions.
|
||||||
code += (lang_.language != IDLOptions::kJava) ? ";" : "";
|
code += (lang_.language != IDLOptions::kJava) ? ";" : "";
|
||||||
code += "\n\n";
|
code += "\n\n";
|
||||||
}
|
}
|
||||||
const LanguageParameters & lang_;
|
const LanguageParameters & lang_;
|
||||||
};
|
};
|
||||||
} // namespace general
|
} // namespace general
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ class FlatBufFile : public grpc_cpp_generator::File {
|
|||||||
public:
|
public:
|
||||||
FlatBufFile(const Parser &parser, const std::string &file_name)
|
FlatBufFile(const Parser &parser, const std::string &file_name)
|
||||||
: parser_(parser), file_name_(file_name) {}
|
: parser_(parser), file_name_(file_name) {}
|
||||||
|
FlatBufFile &operator=(const FlatBufFile &);
|
||||||
|
|
||||||
std::string filename() const { return file_name_; }
|
std::string filename() const { return file_name_; }
|
||||||
std::string filename_without_ext() const {
|
std::string filename_without_ext() const {
|
||||||
|
|||||||
@@ -124,7 +124,9 @@ flatbuffers::unique_ptr_t CreateFlatBufferTest(std::string &buffer) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Creating vectors of strings in one convenient call.
|
// Creating vectors of strings in one convenient call.
|
||||||
std::vector<std::string> names2 = { "jane", "mary" };
|
std::vector<std::string> names2;
|
||||||
|
names2.push_back("jane");
|
||||||
|
names2.push_back("mary");
|
||||||
auto vecofstrings2 = builder.CreateVectorOfStrings(names2);
|
auto vecofstrings2 = builder.CreateVectorOfStrings(names2);
|
||||||
|
|
||||||
// Create an array of sorted tables, can be used with binary search when read:
|
// Create an array of sorted tables, can be used with binary search when read:
|
||||||
@@ -855,7 +857,7 @@ void ValueTest() {
|
|||||||
|
|
||||||
// Test conversion functions.
|
// Test conversion functions.
|
||||||
TEST_EQ(FloatCompare(TestValue<float>("{ Y:cos(rad(180)) }","float"), -1), true);
|
TEST_EQ(FloatCompare(TestValue<float>("{ Y:cos(rad(180)) }","float"), -1), true);
|
||||||
|
|
||||||
// Test negative hex constant.
|
// Test negative hex constant.
|
||||||
TEST_EQ(TestValue<int>("{ Y:-0x80 }","int") == -128, true);
|
TEST_EQ(TestValue<int>("{ Y:-0x80 }","int") == -128, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user