Skip to content

Commit b16ce33

Browse files
committed
Fix: Remove static from array declaration to resolve MSVC error
1 parent be120d8 commit b16ce33

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.github/workflows/run_test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ "master" ]
88

99
jobs:
10-
build:
10+
build-ubuntu:
1111
runs-on: ubuntu-latest
1212
name: Build and test on the latest Ubuntu
1313

@@ -26,10 +26,11 @@ jobs:
2626
- name: make test-full
2727
run: make test-full
2828

29+
2930
build-powerpc64:
3031
runs-on: ubuntu-latest
3132
name: Build and test on PowerPC 64
32-
needs: build
33+
needs: build-ubuntu
3334

3435
steps:
3536
- uses: actions/checkout@v4

librhash/blake3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static const uint8_t permutations[7][16] = {
112112
* @param flags bit flags used to compress the current block
113113
*/
114114
static void compress(uint32_t *output,
115-
const uint32_t msg[static 16], const uint32_t hash[static 8],
115+
const uint32_t msg[16], const uint32_t hash[8],
116116
uint64_t counter, uint32_t length, uint32_t flags)
117117
{
118118
uint32_t v[16] = {
@@ -151,7 +151,7 @@ static void compress(uint32_t *output,
151151
}
152152

153153
/* Process a block of 64 bytes */
154-
static void process_block(struct blake3_ctx *ctx, const uint32_t msg[static 16])
154+
static void process_block(struct blake3_ctx *ctx, const uint32_t msg[16])
155155
{
156156
uint32_t *cur_hash = ctx->stack + ctx->stack_depth * words_per_stack_entry;
157157
uint64_t tail_index = ctx->length - 1;

win_utils.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "win_utils.h"
77
# define WIN32_LEAN_AND_MEAN
88
#include <windows.h>
9+
#include <limits.h>
10+
#include <stdlib.h>
911

1012
/**
1113
* Set process priority and affinity to use any CPU but the first one,
@@ -71,7 +73,12 @@ struct console_data_t console_data;
7173
*/
7274
static wchar_t* cstr_to_wchar_buffer(const char* str, int codepage, wchar_t* buffer, size_t buf_size)
7375
{
74-
if (MultiByteToWideChar(codepage, 0, str, -1, buffer, buf_size / sizeof(wchar_t)) != 0)
76+
size_t length = buf_size / sizeof(wchar_t);
77+
if (length > INT_MAX) {
78+
errno = EINVAL;
79+
return NULL;
80+
}
81+
if (MultiByteToWideChar(codepage, 0, str, -1, buffer, (int)length) != 0)
7582
return buffer;
7683
set_errno_from_last_file_error();
7784
return NULL; /* conversion failed */

0 commit comments

Comments
 (0)