Skip to content

Commit 573eaf3

Browse files
gpsheadclaude
andcommitted
Fix MSVC build: move table_b2a_base64 before inline functions
MSVC doesn't support forward declarations of arrays without explicit size. Move the table definition before the inline functions that use it, eliminating the need for a forward declaration. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2d2be30 commit 573eaf3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Modules/binascii.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ static const unsigned char table_a2b_base64[] = {
109109
* This allows the compiler to better optimize the hot loops.
110110
*/
111111

112-
/* Forward declaration for table defined after the inline functions */
113-
static const unsigned char table_b2a_base64[];
112+
static const unsigned char table_b2a_base64[] =
113+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
114114

115115
/* Encode 3 bytes into 4 base64 characters. */
116116
static inline void
@@ -198,9 +198,6 @@ base64_decode_fast(const unsigned char *in, Py_ssize_t in_len,
198198
return i * 4;
199199
}
200200

201-
static const unsigned char table_b2a_base64[] =
202-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
203-
204201

205202
static const unsigned short crctab_hqx[256] = {
206203
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,

0 commit comments

Comments
 (0)