fix: a bunch of iggy string encoding UB and use simdutf

This commit is contained in:
Tropical
2026-03-22 22:56:08 -05:00
parent 009279bb1b
commit f820e73cf8
39 changed files with 217 additions and 90 deletions
@@ -0,0 +1,61 @@
project('simdutf',
'cpp',
default_options: ['cpp_std=c++23'],
version: '8.2.0',
license: ['MIT'],
)
pymod = import('python')
python = pymod.find_installation('python3', required: true)
simdutf_amalgamate_args = [
'--no-zip',
'--no-readme',
'--source-dir', meson.project_source_root() / 'src',
'--include-dir', meson.project_source_root() / 'include',
'--output-dir', meson.project_build_root(),
]
if get_option('utf8')
simdutf_amalgamate_args += ['--with-utf8']
endif
if get_option('utf16')
simdutf_amalgamate_args += ['--with-utf16']
endif
if get_option('utf32')
simdutf_amalgamate_args += ['--with-utf32']
endif
if get_option('ascii')
simdutf_amalgamate_args += ['--with-ascii']
endif
if get_option('latin1')
simdutf_amalgamate_args += ['--with-latin1']
endif
if get_option('base64')
simdutf_amalgamate_args += ['--with-base64']
endif
if get_option('detect-enc')
simdutf_amalgamate_args += ['--with-detect-enc']
endif
simdutf_amalgamate = custom_target(
'amalgamate',
input: [],
output: ['simdutf.h', 'simdutf.cpp'],
command: [
python,
files('singleheader' / 'amalgamate.py'),
] + simdutf_amalgamate_args,
)
simdutf_lib = static_library(
'simdutf',
sources: simdutf_amalgamate,
)
simdutf_dep = declare_dependency(
sources: simdutf_amalgamate,
link_with: simdutf_lib,
)
meson.override_dependency('simdutf', simdutf_dep)
@@ -0,0 +1,34 @@
option('utf8',
type: 'boolean',
value: false,
description: 'Include UTF-8 support')
option('utf16',
type: 'boolean',
value: false,
description: 'Include UTF-16 support')
option('utf32',
type: 'boolean',
value: false,
description: 'Include UTF-32 support')
option('base64',
type: 'boolean',
value: false,
description: 'Include Base64 support')
option('detect-enc',
type: 'boolean',
value: false,
description: 'Include encoding detection support')
option('ascii',
type: 'boolean',
value: false,
description: 'Include ASCII support')
option('latin1',
type: 'boolean',
value: false,
description: 'Include Latin1 support')