-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Mutable byte arrays use aws_byte_buf 2. clang-tidy and clang-format integration
- Loading branch information
1 parent
939148f
commit d994043
Showing
19 changed files
with
250 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
Language: Cpp | ||
# BasedOnStyle: Mozilla | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Right | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakBeforeTernaryOperators: true | ||
BreakStringLiterals: true | ||
ColumnLimit: 120 | ||
ContinuationIndentWidth: 4 | ||
DerivePointerAlignment: false | ||
IncludeBlocks: Preserve | ||
IndentCaseLabels: true | ||
IndentPPDirectives: AfterHash | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: true | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 100000 | ||
PointerAlignment: Right | ||
ReflowComments: true | ||
SortIncludes: true | ||
SpaceAfterCStyleCast: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 4 | ||
UseTab: Never | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
include(FetchContent) | ||
|
||
set(AWS_C_COMMON aws-c-common) | ||
|
||
FetchContent_Declare( | ||
AWS_C_COMMON | ||
GIT_REPOSITORY https://github.com/awslabs/aws-c-common.git | ||
GIT_TAG v0.7.4 | ||
GIT_SHALLOW 1 | ||
) | ||
|
||
FetchContent_MakeAvailable(AWS_C_COMMON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ -z $CLANG_FORMAT ]] ; then | ||
CLANG_FORMAT=clang-format | ||
fi | ||
|
||
if NOT type $CLANG_FORMAT 2> /dev/null ; then | ||
echo "No appropriate clang-format found." | ||
exit 1 | ||
fi | ||
|
||
FAIL=0 | ||
SOURCE_FILES=`find src include -type f \( -name '*.h' -o -name '*.c' \)` | ||
for i in $SOURCE_FILES | ||
do | ||
$CLANG_FORMAT -output-replacements-xml $i | grep -c "<replacement " > /dev/null | ||
if [ $? -ne 1 ] | ||
then | ||
echo "$i failed clang-format check." | ||
FAIL=1 | ||
fi | ||
done | ||
|
||
exit $FAIL |
29 changes: 16 additions & 13 deletions
29
native-schema-registry/c/include/glue_schema_registry_deserializer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
#ifndef GLUE_SCHEMA_REGISTRY_DESERIALIZER_H | ||
#define GLUE_SCHEMA_REGISTRY_DESERIALIZER_H | ||
|
||
#include "glue_schema_registry_schema.h" | ||
#include "glue_schema_registry_error.h" | ||
#include "glue_schema_registry_schema.h" | ||
#include "mutable_byte_array.h" | ||
#include "read_only_byte_array.h" | ||
#include <stdbool.h> | ||
|
||
typedef struct glue_schema_registry_deserializer { | ||
//This is used for storing the instance context. Currently, being used for managing GraalVM instance. | ||
/* This is used for storing the instance context. Currently, being used for | ||
* managing GraalVM instance. */ | ||
void *instance_context; | ||
} glue_schema_registry_deserializer; | ||
|
||
glue_schema_registry_deserializer *new_glue_schema_registry_deserializer(glue_schema_registry_error **p_err); | ||
|
||
void delete_glue_schema_registry_deserializer(glue_schema_registry_deserializer *deserializer); | ||
|
||
mutable_byte_array *glue_schema_registry_deserializer_decode(glue_schema_registry_deserializer *deserializer, | ||
read_only_byte_array *array, | ||
glue_schema_registry_error **p_err); | ||
mutable_byte_array *glue_schema_registry_deserializer_decode( | ||
const glue_schema_registry_deserializer *deserializer, | ||
const read_only_byte_array *array, | ||
glue_schema_registry_error **p_err); | ||
|
||
glue_schema_registry_schema * | ||
glue_schema_registry_deserializer_decode_schema(glue_schema_registry_deserializer *deserializer, | ||
read_only_byte_array *array, | ||
glue_schema_registry_error **p_err); | ||
glue_schema_registry_schema *glue_schema_registry_deserializer_decode_schema( | ||
const glue_schema_registry_deserializer *deserializer, | ||
const read_only_byte_array *array, | ||
glue_schema_registry_error **p_err); | ||
|
||
bool glue_schema_registry_deserializer_can_decode(glue_schema_registry_deserializer *deserializer, | ||
read_only_byte_array *array, | ||
glue_schema_registry_error **p_err); | ||
bool glue_schema_registry_deserializer_can_decode( | ||
const glue_schema_registry_deserializer *deserializer, | ||
const read_only_byte_array *array, | ||
glue_schema_registry_error **p_err); | ||
|
||
#endif //GLUE_SCHEMA_REGISTRY_DESERIALIZER_H | ||
#endif /* GLUE_SCHEMA_REGISTRY_DESERIALIZER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 11 additions & 9 deletions
20
native-schema-registry/c/include/glue_schema_registry_serializer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
#ifndef GLUE_SCHEMA_REGISTRY_SERIALIZER_H | ||
#define GLUE_SCHEMA_REGISTRY_SERIALIZER_H | ||
|
||
#include "glue_schema_registry_schema.h" | ||
#include "glue_schema_registry_error.h" | ||
#include "glue_schema_registry_schema.h" | ||
#include "mutable_byte_array.h" | ||
#include "read_only_byte_array.h" | ||
|
||
typedef struct glue_schema_registry_serializer { | ||
//This is used for storing the instance context. Currently being used for managing GraalVM instance. | ||
/* This is used for storing the instance context. Currently being used for | ||
* managing GraalVM instance. */ | ||
void *instance_context; | ||
} glue_schema_registry_serializer; | ||
|
||
glue_schema_registry_serializer *new_glue_schema_registry_serializer(glue_schema_registry_error **p_err); | ||
|
||
void delete_glue_schema_registry_serializer(glue_schema_registry_serializer *serializer); | ||
|
||
//Encodes the GSR Schema with a byte array. | ||
mutable_byte_array *glue_schema_registry_serializer_encode(glue_schema_registry_serializer *serializer, | ||
read_only_byte_array * array, | ||
const char * transport_name, | ||
glue_schema_registry_schema *gsr_schema, | ||
glue_schema_registry_error **p_err); | ||
// Encodes the GSR Schema with a byte array. | ||
mutable_byte_array *glue_schema_registry_serializer_encode( | ||
const glue_schema_registry_serializer *serializer, | ||
const read_only_byte_array *array, | ||
const char *transport_name, | ||
const glue_schema_registry_schema *gsr_schema, | ||
glue_schema_registry_error **p_err); | ||
|
||
#endif //GLUE_SCHEMA_REGISTRY_SERIALIZER_H | ||
#endif /* GLUE_SCHEMA_REGISTRY_SERIALIZER_H */ |
Oops, something went wrong.