Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C] Remove the dimension member from the codec classes #681

Merged
merged 3 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,8 @@ private static void generateGroupStruct(
final List<Token> tokens,
final int index)
{
final String dimensionsStructName = formatScopedName(scope, tokens.get(index + 1).name());

sb.append(String.format("\n" +
"struct %1$s\n" +
"struct %s\n" +
"{\n" +
" char *buffer;\n" +
" uint64_t buffer_length;\n" +
Expand All @@ -230,9 +228,8 @@ private static void generateGroupStruct(
" uint64_t index;\n" +
" uint64_t offset;\n" +
" uint64_t acting_version;\n" +
" struct %2$s dimensions;\n" +
"};\n",
groupName, dimensionsStructName));
groupName));
}

private static void generateGroupHeaderFunctions(
Expand Down Expand Up @@ -265,12 +262,13 @@ private static void generateGroupHeaderFunctions(
"{\n" +
" codec->buffer = buffer;\n" +
" codec->buffer_length = buffer_length;\n" +
" if (!%2$s_wrap(&codec->dimensions, codec->buffer, *pos, acting_version, buffer_length))\n" +
" struct %2$s dimensions;\n" +
" if (!%2$s_wrap(&dimensions, codec->buffer, *pos, acting_version, buffer_length))\n" +
" {\n" +
" return NULL;\n" +
" }\n" +
" codec->block_length = %2$s_blockLength(&codec->dimensions);\n" +
" codec->count = %2$s_numInGroup(&codec->dimensions);\n" +
" codec->block_length = %2$s_blockLength(&dimensions);\n" +
" codec->count = %2$s_numInGroup(&dimensions);\n" +
" codec->index = -1;\n" +
" codec->acting_version = acting_version;\n" +
" codec->position_ptr = pos;\n" +
Expand Down Expand Up @@ -305,12 +303,13 @@ private static void generateGroupHeaderFunctions(
"#endif\n" +
" codec->buffer = buffer;\n" +
" codec->buffer_length = buffer_length;\n" +
" if (!%5$s_wrap(&codec->dimensions, codec->buffer, *pos, acting_version, buffer_length))\n" +
" struct %5$s dimensions;\n" +
" if (!%5$s_wrap(&dimensions, codec->buffer, *pos, acting_version, buffer_length))\n" +
" {\n" +
" return NULL;\n" +
" }\n" +
" %5$s_set_blockLength(&codec->dimensions, (%2$s)%3$d);\n" +
" %5$s_set_numInGroup(&codec->dimensions, (%4$s)count);\n" +
" %5$s_set_blockLength(&dimensions, (%2$s)%3$d);\n" +
" %5$s_set_numInGroup(&dimensions, (%4$s)count);\n" +
" codec->index = -1;\n" +
" codec->count = count;\n" +
" codec->block_length = %3$d;\n" +
Expand Down Expand Up @@ -1595,7 +1594,8 @@ private CharSequence generateArrayProperty(
" {\n" +
" errno = E105;\n" +
" return NULL;\n" +
" }\n" +
" }\n\n" +

"%5$s\n" +
" return codec;\n" +
"}\n",
Expand Down
2 changes: 1 addition & 1 deletion sbe-tool/src/test/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function(sbe_test name)
)
target_compile_options("C${name}" PRIVATE $<$<CXX_COMPILER_ID:AppleClang>:-Werror>)
target_compile_options("C${name}" PRIVATE $<$<CXX_COMPILER_ID:Clang>:-Werror>)
target_compile_options("C${name}" PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Werror>)
target_compile_options("C${name}" PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Werror -Wno-maybe-uninitialized>)
target_link_libraries("C${name}" ${GTEST_LIBS} ${CMAKE_THREAD_LIBS_INIT})
add_test(NAME C${name} COMMAND C${name} WORKING_DIRECTORY ${C_CODEC_TARGET_DIR})
add_dependencies(C${name} gtest)
Expand Down