Skip to content

Commit 921c930

Browse files
committed
chore: add explicit casts for newer clang compatbility
1 parent ec3ae3e commit 921c930

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

beacon_chain/libnimbus_lc/test_libnimbus_lc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void *readEntireFile(const char *path, int *numBytes)
4545
err = fseek(file, 0, SEEK_SET);
4646
check(!err);
4747

48-
char *buffer = malloc((size_t) size + 1);
48+
char *buffer = (char *)malloc((size_t) size + 1);
4949
check(buffer);
5050

5151
size_t actualSize = fread(buffer, 1, (size_t) size, file);
@@ -66,7 +66,7 @@ ETH_RESULT_USE_CHECK
6666
static ETHConsensusConfig *loadCfg(const char *path)
6767
{
6868
void *fileContent = readEntireFile(path, /* numBytes: */ NULL);
69-
ETHConsensusConfig *cfg = ETHConsensusConfigCreateFromYaml(fileContent);
69+
ETHConsensusConfig *cfg = ETHConsensusConfigCreateFromYaml((const char *)fileContent);
7070
check(cfg);
7171
free(fileContent);
7272
return cfg;
@@ -90,7 +90,7 @@ static ETHBeaconState *loadGenesis(const ETHConsensusConfig *cfg, const char *pa
9090

9191
static void printHexString(const void *bytes, int numBytes)
9292
{
93-
const uint8_t *bytes_ = bytes;
93+
const uint8_t *bytes_ = (const uint8_t *)bytes;
9494
printf("0x");
9595
for (int i = 0; i < numBytes; i++) {
9696
printf("%02x", bytes_[i]);
@@ -99,7 +99,7 @@ static void printHexString(const void *bytes, int numBytes)
9999

100100
static void printHexStringReversed(const void *bytes, int numBytes)
101101
{
102-
const uint8_t *bytes_ = bytes;
102+
const uint8_t *bytes_ = (const uint8_t *)bytes;
103103
printf("0x");
104104
for (int i = numBytes - 1; i >= 0; i--) {
105105
printf("%02x", bytes_[i]);
@@ -369,7 +369,7 @@ int main(void)
369369
void *blockHeaderJson = readEntireFile(
370370
__DIR__ "/test_files/executionBlockHeader.json", /* numBytes: */ NULL);
371371
ETHExecutionBlockHeader *executionBlockHeader =
372-
ETHExecutionBlockHeaderCreateFromJson(copiedExecutionHash, blockHeaderJson);
372+
ETHExecutionBlockHeaderCreateFromJson(copiedExecutionHash, (const char *)blockHeaderJson);
373373
check(executionBlockHeader);
374374
free(blockHeaderJson);
375375
ETHRootDestroy(copiedExecutionHash);
@@ -434,7 +434,7 @@ int main(void)
434434
void *sampleTransactionsJson = readEntireFile(
435435
__DIR__ "/test_files/transactions.json", /* numBytes: */ NULL);
436436
ETHTransactions *transactions =
437-
ETHTransactionsCreateFromJson(&sampleTransactionsRoot, sampleTransactionsJson);
437+
ETHTransactionsCreateFromJson(&sampleTransactionsRoot, (const char *)sampleTransactionsJson);
438438
check(transactions);
439439
free(sampleTransactionsJson);
440440

@@ -447,7 +447,7 @@ int main(void)
447447
void *sampleReceiptsJson = readEntireFile(
448448
__DIR__ "/test_files/receipts.json", /* numBytes: */ NULL);
449449
ETHReceipts *receipts =
450-
ETHReceiptsCreateFromJson(&sampleReceiptsRoot, sampleReceiptsJson, transactions);
450+
ETHReceiptsCreateFromJson(&sampleReceiptsRoot, (const char *)sampleReceiptsJson, transactions);
451451
check(receipts);
452452
free(sampleReceiptsJson);
453453

0 commit comments

Comments
 (0)