Skip to content

Commit b51efa8

Browse files
committed
format file and refurbish types
1 parent 0eb62bf commit b51efa8

9 files changed

Lines changed: 543 additions & 367 deletions

File tree

app/src/borsh.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,45 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
********************************************************************************/
16-
#include "crypto_helper.h"
17-
1816
#include "bech32.h"
19-
#include "zxformat.h"
17+
#include "crypto_helper.h"
2018
#include "parser_impl.h"
19+
#include "zxformat.h"
2120

2221
#define OFFSET_U32 4
2322

24-
parser_error_t read_u8(parser_context_t* ctx, uint8_t* val) {
23+
parser_error_t read_u8(parser_context_t *ctx, uint8_t *val) {
2524
CHECK_INPUT(ctx);
2625
CHECK_INPUT(val);
2726

28-
*val = *(uint8_t*)(ctx->buffer + ctx->offset);
27+
*val = *(uint8_t *)(ctx->buffer + ctx->offset);
2928
CTX_CHECK_AND_ADVANCE(ctx, 1);
3029
return parser_ok;
3130
}
3231

33-
parser_error_t read_u16(parser_context_t* ctx, uint16_t* val) {
32+
parser_error_t read_u16(parser_context_t *ctx, uint16_t *val) {
3433
CHECK_INPUT(ctx);
3534
CHECK_INPUT(val);
3635

37-
*val = *(uint16_t*)(ctx->buffer + ctx->offset);
36+
*val = *(uint16_t *)(ctx->buffer + ctx->offset);
3837
CTX_CHECK_AND_ADVANCE(ctx, 2);
3938
return parser_ok;
4039
}
4140

42-
parser_error_t read_u32(parser_context_t* ctx, uint32_t* val) {
41+
parser_error_t read_u32(parser_context_t *ctx, uint32_t *val) {
4342
CHECK_INPUT(ctx);
4443
CHECK_INPUT(val);
4544

46-
*val = *(uint32_t*)(ctx->buffer + ctx->offset);
45+
*val = *(uint32_t *)(ctx->buffer + ctx->offset);
4746
CTX_CHECK_AND_ADVANCE(ctx, OFFSET_U32);
4847
return parser_ok;
4948
}
5049

51-
parser_error_t read_u64(parser_context_t* ctx, uint64_t* val) {
50+
parser_error_t read_u64(parser_context_t *ctx, uint64_t *val) {
5251
CHECK_INPUT(ctx);
5352
CHECK_INPUT(val);
5453

55-
*val = *(uint64_t*)(ctx->buffer + ctx->offset);
54+
*val = *(uint64_t *)(ctx->buffer + ctx->offset);
5655
CTX_CHECK_AND_ADVANCE(ctx, 8);
5756
return parser_ok;
5857
}

app/src/borsh.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ typedef enum {
3636
// Add other types as needed
3737
} borsh_type_t;
3838

39-
parser_error_t read_u8(parser_context_t* ctx, uint8_t* val);
40-
parser_error_t read_u16(parser_context_t* ctx, uint16_t* val);
41-
parser_error_t read_u32(parser_context_t* ctx, uint32_t* val);
42-
parser_error_t read_u64(parser_context_t* ctx, uint64_t* val);
39+
parser_error_t read_u8(parser_context_t *ctx, uint8_t *val);
40+
parser_error_t read_u16(parser_context_t *ctx, uint16_t *val);
41+
parser_error_t read_u32(parser_context_t *ctx, uint32_t *val);
42+
parser_error_t read_u64(parser_context_t *ctx, uint64_t *val);
4343
void print_buffer(bytes_t *buffer, const char *title);
4444
void print_string(const char *str);
4545
void print_buffer_str(bytes_t *buffer, const char *title);

0 commit comments

Comments
 (0)