sync code with last improvements from OpenBSD
This commit is contained in:
parent
d8235ebda5
commit
0726fd4247
@ -1 +1 @@
|
|||||||
# SecBSD 1.4-58d3272: Tue Sep 19 00:00:00 UTC 2023 (Tezcatlipoca)
|
# SecBSD 1.4-d8235ebda5: Tue Sep 19 00:00:00 UTC 2023 (Tezcatlipoca)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
# ECB 4.25/4.25 1.38/1.38 1.28/1.28 1.26/1.26 1.26/1.26
|
# ECB 4.25/4.25 1.38/1.38 1.28/1.28 1.26/1.26 1.26/1.26
|
||||||
# CTR 5.42/5.42 1.92/1.92 1.44/1.44 1.28/1.28 1.26/1.26
|
# CTR 5.42/5.42 1.92/1.92 1.44/1.44 1.28/1.28 1.26/1.26
|
||||||
# CBC 4.38/4.43 4.15/1.43 4.07/1.32 4.07/1.29 4.06/1.28
|
# CBC 4.38/4.43 4.15/1.43 4.07/1.32 4.07/1.29 4.06/1.28
|
||||||
# CCM 5.66/9.42 4.42/5.41 4.16/4.40 4.09/4.15 4.06/4.07
|
# CCM 5.66/9.42 4.42/5.41 4.16/4.40 4.09/4.15 4.06/4.07
|
||||||
# OFB 5.42/5.42 4.64/4.64 4.44/4.44 4.39/4.39 4.38/4.38
|
# OFB 5.42/5.42 4.64/4.64 4.44/4.44 4.39/4.39 4.38/4.38
|
||||||
# CFB 5.73/5.85 5.56/5.62 5.48/5.56 5.47/5.55 5.47/5.55
|
# CFB 5.73/5.85 5.56/5.62 5.48/5.56 5.47/5.55 5.47/5.55
|
||||||
#
|
#
|
||||||
@ -111,7 +111,7 @@
|
|||||||
# performance is achieved by interleaving instructions working on
|
# performance is achieved by interleaving instructions working on
|
||||||
# independent blocks. In which case asymptotic limit for such modes
|
# independent blocks. In which case asymptotic limit for such modes
|
||||||
# can be obtained by dividing above mentioned numbers by AES
|
# can be obtained by dividing above mentioned numbers by AES
|
||||||
# instructions' interleave factor. Westmere can execute at most 3
|
# instructions' interleave factor. Westmere can execute at most 3
|
||||||
# instructions at a time, meaning that optimal interleave factor is 3,
|
# instructions at a time, meaning that optimal interleave factor is 3,
|
||||||
# and that's where the "magic" number of 1.25 come from. "Optimal
|
# and that's where the "magic" number of 1.25 come from. "Optimal
|
||||||
# interleave factor" means that increase of interleave factor does
|
# interleave factor" means that increase of interleave factor does
|
||||||
@ -201,7 +201,7 @@ $inout6="%xmm8"; $inout7="%xmm9";
|
|||||||
|
|
||||||
$in2="%xmm6"; $in1="%xmm7"; # used in CBC decrypt, CTR, ...
|
$in2="%xmm6"; $in1="%xmm7"; # used in CBC decrypt, CTR, ...
|
||||||
$in0="%xmm8"; $iv="%xmm9";
|
$in0="%xmm8"; $iv="%xmm9";
|
||||||
|
|
||||||
# Inline version of internal aesni_[en|de]crypt1.
|
# Inline version of internal aesni_[en|de]crypt1.
|
||||||
#
|
#
|
||||||
# Why folded loop? Because aes[enc|dec] is slow enough to accommodate
|
# Why folded loop? Because aes[enc|dec] is slow enough to accommodate
|
||||||
@ -267,7 +267,7 @@ $code.=<<___;
|
|||||||
.size ${PREFIX}_decrypt, .-${PREFIX}_decrypt
|
.size ${PREFIX}_decrypt, .-${PREFIX}_decrypt
|
||||||
___
|
___
|
||||||
}
|
}
|
||||||
|
|
||||||
# _aesni_[en|de]cryptN are private interfaces, N denotes interleave
|
# _aesni_[en|de]cryptN are private interfaces, N denotes interleave
|
||||||
# factor. Why 3x subroutine were originally used in loops? Even though
|
# factor. Why 3x subroutine were originally used in loops? Even though
|
||||||
# aes[enc|dec] latency was originally 6, it could be scheduled only
|
# aes[enc|dec] latency was originally 6, it could be scheduled only
|
||||||
@ -520,7 +520,7 @@ ___
|
|||||||
&aesni_generate6("dec");
|
&aesni_generate6("dec");
|
||||||
&aesni_generate8("enc") if ($PREFIX eq "aesni");
|
&aesni_generate8("enc") if ($PREFIX eq "aesni");
|
||||||
&aesni_generate8("dec");
|
&aesni_generate8("dec");
|
||||||
|
|
||||||
if ($PREFIX eq "aesni") {
|
if ($PREFIX eq "aesni") {
|
||||||
########################################################################
|
########################################################################
|
||||||
# void aesni_ecb_encrypt (const void *in, void *out,
|
# void aesni_ecb_encrypt (const void *in, void *out,
|
||||||
@ -674,7 +674,8 @@ $code.=<<___;
|
|||||||
movups $inout4,0x40($out)
|
movups $inout4,0x40($out)
|
||||||
movups $inout5,0x50($out)
|
movups $inout5,0x50($out)
|
||||||
jmp .Lecb_ret
|
jmp .Lecb_ret
|
||||||
#--------------------------- ECB DECRYPT ------------------------------#
|
|
||||||
|
#--------------------------- ECB DECRYPT ------------------------------#
|
||||||
.align 16
|
.align 16
|
||||||
.Lecb_decrypt:
|
.Lecb_decrypt:
|
||||||
cmp \$0x80,$len
|
cmp \$0x80,$len
|
||||||
@ -815,7 +816,7 @@ $code.=<<___;
|
|||||||
ret
|
ret
|
||||||
.size aesni_ecb_encrypt,.-aesni_ecb_encrypt
|
.size aesni_ecb_encrypt,.-aesni_ecb_encrypt
|
||||||
___
|
___
|
||||||
|
|
||||||
{
|
{
|
||||||
######################################################################
|
######################################################################
|
||||||
# void aesni_ccm64_[en|de]crypt_blocks (const void *in, void *out,
|
# void aesni_ccm64_[en|de]crypt_blocks (const void *in, void *out,
|
||||||
@ -1005,7 +1006,8 @@ $code.=<<___;
|
|||||||
ret
|
ret
|
||||||
.size aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
|
.size aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
|
||||||
___
|
___
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# void aesni_ctr32_encrypt_blocks (const void *in, void *out,
|
# void aesni_ctr32_encrypt_blocks (const void *in, void *out,
|
||||||
# size_t blocks, const AES_KEY *key,
|
# size_t blocks, const AES_KEY *key,
|
||||||
@ -1025,6 +1027,7 @@ $code.=<<___;
|
|||||||
.type aesni_ctr32_encrypt_blocks,\@function,5
|
.type aesni_ctr32_encrypt_blocks,\@function,5
|
||||||
.align 16
|
.align 16
|
||||||
aesni_ctr32_encrypt_blocks:
|
aesni_ctr32_encrypt_blocks:
|
||||||
|
endbr64
|
||||||
lea (%rsp),%rax
|
lea (%rsp),%rax
|
||||||
push %rbp
|
push %rbp
|
||||||
sub \$$frame_size,%rsp
|
sub \$$frame_size,%rsp
|
||||||
@ -1299,7 +1302,7 @@ $code.=<<___;
|
|||||||
.size aesni_ctr32_encrypt_blocks,.-aesni_ctr32_encrypt_blocks
|
.size aesni_ctr32_encrypt_blocks,.-aesni_ctr32_encrypt_blocks
|
||||||
___
|
___
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# void aesni_xts_[en|de]crypt(const char *inp,char *out,size_t len,
|
# void aesni_xts_[en|de]crypt(const char *inp,char *out,size_t len,
|
||||||
# const AES_KEY *key1, const AES_KEY *key2
|
# const AES_KEY *key1, const AES_KEY *key2
|
||||||
@ -2135,7 +2138,7 @@ $code.=<<___;
|
|||||||
.size aesni_xts_decrypt,.-aesni_xts_decrypt
|
.size aesni_xts_decrypt,.-aesni_xts_decrypt
|
||||||
___
|
___
|
||||||
} }}
|
} }}
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# void $PREFIX_cbc_encrypt (const void *inp, void *out,
|
# void $PREFIX_cbc_encrypt (const void *inp, void *out,
|
||||||
# size_t length, const AES_KEY *key,
|
# size_t length, const AES_KEY *key,
|
||||||
@ -2194,7 +2197,8 @@ $code.=<<___;
|
|||||||
mov $key_,$key # restore $key
|
mov $key_,$key # restore $key
|
||||||
xor $len,$len # len=16
|
xor $len,$len # len=16
|
||||||
jmp .Lcbc_enc_loop # one more spin
|
jmp .Lcbc_enc_loop # one more spin
|
||||||
#--------------------------- CBC DECRYPT ------------------------------#
|
|
||||||
|
#--------------------------- CBC DECRYPT ------------------------------#
|
||||||
.align 16
|
.align 16
|
||||||
.Lcbc_decrypt:
|
.Lcbc_decrypt:
|
||||||
lea (%rsp),%rax
|
lea (%rsp),%rax
|
||||||
@ -2475,7 +2479,8 @@ $code.=<<___;
|
|||||||
ret
|
ret
|
||||||
.size ${PREFIX}_cbc_encrypt,.-${PREFIX}_cbc_encrypt
|
.size ${PREFIX}_cbc_encrypt,.-${PREFIX}_cbc_encrypt
|
||||||
___
|
___
|
||||||
}
|
}
|
||||||
|
|
||||||
# int $PREFIX_set_[en|de]crypt_key (const unsigned char *userKey,
|
# int $PREFIX_set_[en|de]crypt_key (const unsigned char *userKey,
|
||||||
# int bits, AES_KEY *key)
|
# int bits, AES_KEY *key)
|
||||||
{ my ($inp,$bits,$key) = @_4args;
|
{ my ($inp,$bits,$key) = @_4args;
|
||||||
@ -2522,7 +2527,7 @@ ${PREFIX}_set_decrypt_key:
|
|||||||
.LSEH_end_set_decrypt_key:
|
.LSEH_end_set_decrypt_key:
|
||||||
.size ${PREFIX}_set_decrypt_key,.-${PREFIX}_set_decrypt_key
|
.size ${PREFIX}_set_decrypt_key,.-${PREFIX}_set_decrypt_key
|
||||||
___
|
___
|
||||||
|
|
||||||
# This is based on submission by
|
# This is based on submission by
|
||||||
#
|
#
|
||||||
# Huang Ying <ying.huang@intel.com>
|
# Huang Ying <ying.huang@intel.com>
|
||||||
@ -2655,7 +2660,7 @@ __aesni_set_encrypt_key:
|
|||||||
add \$8,%rsp
|
add \$8,%rsp
|
||||||
ret
|
ret
|
||||||
.LSEH_end_set_encrypt_key:
|
.LSEH_end_set_encrypt_key:
|
||||||
|
|
||||||
.align 16
|
.align 16
|
||||||
.Lkey_expansion_128:
|
.Lkey_expansion_128:
|
||||||
$movkey %xmm0,(%rax)
|
$movkey %xmm0,(%rax)
|
||||||
@ -2728,7 +2733,7 @@ __aesni_set_encrypt_key:
|
|||||||
.size __aesni_set_encrypt_key,.-__aesni_set_encrypt_key
|
.size __aesni_set_encrypt_key,.-__aesni_set_encrypt_key
|
||||||
___
|
___
|
||||||
}
|
}
|
||||||
|
|
||||||
$code.=<<___;
|
$code.=<<___;
|
||||||
.section .rodata
|
.section .rodata
|
||||||
.align 64
|
.align 64
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssl_lib.c,v 1.312 2023/07/19 13:34:33 tb Exp $ */
|
/* $OpenBSD: ssl_lib.c,v 1.314 2023/09/19 01:22:31 tb Exp $ */
|
||||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@ -292,7 +292,7 @@ SSL_new(SSL_CTX *ctx)
|
|||||||
|
|
||||||
CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX);
|
CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX);
|
||||||
s->ctx = ctx;
|
s->ctx = ctx;
|
||||||
s->tlsext_debug_cb = 0;
|
s->tlsext_debug_cb = NULL;
|
||||||
s->tlsext_debug_arg = NULL;
|
s->tlsext_debug_arg = NULL;
|
||||||
s->tlsext_ticket_expected = 0;
|
s->tlsext_ticket_expected = 0;
|
||||||
s->tlsext_status_type = -1;
|
s->tlsext_status_type = -1;
|
||||||
@ -2093,10 +2093,10 @@ SSL_CTX_new(const SSL_METHOD *meth)
|
|||||||
/* We take the system default */
|
/* We take the system default */
|
||||||
ret->session_timeout = ssl_get_default_timeout();
|
ret->session_timeout = ssl_get_default_timeout();
|
||||||
|
|
||||||
ret->new_session_cb = 0;
|
ret->new_session_cb = NULL;
|
||||||
ret->remove_session_cb = 0;
|
ret->remove_session_cb = NULL;
|
||||||
ret->get_session_cb = 0;
|
ret->get_session_cb = NULL;
|
||||||
ret->generate_session_id = 0;
|
ret->generate_session_id = NULL;
|
||||||
|
|
||||||
memset((char *)&ret->stats, 0, sizeof(ret->stats));
|
memset((char *)&ret->stats, 0, sizeof(ret->stats));
|
||||||
|
|
||||||
@ -2105,12 +2105,12 @@ SSL_CTX_new(const SSL_METHOD *meth)
|
|||||||
|
|
||||||
ret->info_callback = NULL;
|
ret->info_callback = NULL;
|
||||||
|
|
||||||
ret->app_verify_callback = 0;
|
ret->app_verify_callback = NULL;
|
||||||
ret->app_verify_arg = NULL;
|
ret->app_verify_arg = NULL;
|
||||||
|
|
||||||
ret->max_cert_list = SSL_MAX_CERT_LIST_DEFAULT;
|
ret->max_cert_list = SSL_MAX_CERT_LIST_DEFAULT;
|
||||||
ret->read_ahead = 0;
|
ret->read_ahead = 0;
|
||||||
ret->msg_callback = 0;
|
ret->msg_callback = NULL;
|
||||||
ret->msg_callback_arg = NULL;
|
ret->msg_callback_arg = NULL;
|
||||||
ret->verify_mode = SSL_VERIFY_NONE;
|
ret->verify_mode = SSL_VERIFY_NONE;
|
||||||
ret->sid_ctx_length = 0;
|
ret->sid_ctx_length = 0;
|
||||||
@ -2119,11 +2119,11 @@ SSL_CTX_new(const SSL_METHOD *meth)
|
|||||||
if ((ret->cert = ssl_cert_new()) == NULL)
|
if ((ret->cert = ssl_cert_new()) == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
ret->default_passwd_callback = 0;
|
ret->default_passwd_callback = NULL;
|
||||||
ret->default_passwd_callback_userdata = NULL;
|
ret->default_passwd_callback_userdata = NULL;
|
||||||
ret->client_cert_cb = 0;
|
ret->client_cert_cb = NULL;
|
||||||
ret->app_gen_cookie_cb = 0;
|
ret->app_gen_cookie_cb = NULL;
|
||||||
ret->app_verify_cookie_cb = 0;
|
ret->app_verify_cookie_cb = NULL;
|
||||||
|
|
||||||
ret->sessions = lh_SSL_SESSION_new();
|
ret->sessions = lh_SSL_SESSION_new();
|
||||||
if (ret->sessions == NULL)
|
if (ret->sessions == NULL)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# $OpenBSD: sedtest.sh,v 1.8 2018/12/07 15:30:31 schwarze Exp $
|
# $OpenBSD: sedtest.sh,v 1.9 2023/09/18 18:33:17 anton Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1992 Diomidis Spinellis.
|
# Copyright (c) 1992 Diomidis Spinellis.
|
||||||
# Copyright (c) 1992, 1993
|
# Copyright (c) 1992, 1993
|
||||||
@ -359,8 +359,7 @@ p
|
|||||||
test_print()
|
test_print()
|
||||||
{
|
{
|
||||||
echo Testing print and file routines
|
echo Testing print and file routines
|
||||||
awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
|
{ jot -c -s '' 255 1; printf '\n'; } >lines3
|
||||||
</dev/null >lines3
|
|
||||||
# GNU and SunOS sed behave differently here
|
# GNU and SunOS sed behave differently here
|
||||||
mark '7.1'
|
mark '7.1'
|
||||||
$SED -n l lines3
|
$SED -n l lines3
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: awk.h,v 1.29 2023/09/17 14:49:44 millert Exp $ */
|
/* $OpenBSD: awk.h,v 1.30 2023/09/18 19:32:19 millert Exp $ */
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
Copyright (C) Lucent Technologies 1997
|
Copyright (C) Lucent Technologies 1997
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
@ -66,6 +66,8 @@ extern bool do_posix; /* true if POSIXLY_CORRECT set */
|
|||||||
#define RECSIZE (8 * 1024) /* sets limit on records, fields, etc., etc. */
|
#define RECSIZE (8 * 1024) /* sets limit on records, fields, etc., etc. */
|
||||||
extern int recsize; /* size of current record, orig RECSIZE */
|
extern int recsize; /* size of current record, orig RECSIZE */
|
||||||
|
|
||||||
|
extern size_t awk_mb_cur_max; /* max size of a multi-byte character */
|
||||||
|
|
||||||
extern char EMPTY[]; /* this avoid -Wwritable-strings issues */
|
extern char EMPTY[]; /* this avoid -Wwritable-strings issues */
|
||||||
extern char **FS;
|
extern char **FS;
|
||||||
extern char **RS;
|
extern char **RS;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: b.c,v 1.38 2023/09/17 14:49:44 millert Exp $ */
|
/* $OpenBSD: b.c,v 1.41 2023/09/19 01:14:05 millert Exp $ */
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
Copyright (C) Lucent Technologies 1997
|
Copyright (C) Lucent Technologies 1997
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
@ -533,7 +533,7 @@ int first(Node *p) /* collects initially active leaves of p into setvec */
|
|||||||
setvec[lp] = 1;
|
setvec[lp] = 1;
|
||||||
setcnt++;
|
setcnt++;
|
||||||
}
|
}
|
||||||
if (type(p) == CCL && (*(char *) right(p)) == '\0')
|
if (type(p) == CCL && (*(int *) right(p)) == 0)
|
||||||
return(0); /* empty CCL */
|
return(0); /* empty CCL */
|
||||||
return(1);
|
return(1);
|
||||||
case PLUS:
|
case PLUS:
|
||||||
@ -834,7 +834,7 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum)
|
|||||||
buf[k++] = (c = getc(f)) != EOF ? c : 0;
|
buf[k++] = (c = getc(f)) != EOF ? c : 0;
|
||||||
}
|
}
|
||||||
c = (uschar)buf[j];
|
c = (uschar)buf[j];
|
||||||
if (c < 128)
|
if (c < 128 || awk_mb_cur_max == 1)
|
||||||
rune = c;
|
rune = c;
|
||||||
else {
|
else {
|
||||||
j--;
|
j--;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: main.c,v 1.60 2023/09/18 15:20:48 jmc Exp $ */
|
/* $OpenBSD: main.c,v 1.61 2023/09/18 19:32:19 millert Exp $ */
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
Copyright (C) Lucent Technologies 1997
|
Copyright (C) Lucent Technologies 1997
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
@ -56,6 +56,8 @@ bool CSV = false; /* true for csv input */
|
|||||||
bool safe = false; /* true => "safe" mode */
|
bool safe = false; /* true => "safe" mode */
|
||||||
bool do_posix = false; /* true => POSIX mode */
|
bool do_posix = false; /* true => POSIX mode */
|
||||||
|
|
||||||
|
size_t awk_mb_cur_max = 1;
|
||||||
|
|
||||||
static noreturn void fpecatch(int n
|
static noreturn void fpecatch(int n
|
||||||
#ifdef SA_SIGINFO
|
#ifdef SA_SIGINFO
|
||||||
, siginfo_t *si, void *uc
|
, siginfo_t *si, void *uc
|
||||||
@ -135,6 +137,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
|
setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
|
||||||
|
awk_mb_cur_max = MB_CUR_MAX;
|
||||||
|
|
||||||
cmdname = __progname;
|
cmdname = __progname;
|
||||||
if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) {
|
if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: run.c,v 1.76 2023/09/18 15:16:22 deraadt Exp $ */
|
/* $OpenBSD: run.c,v 1.77 2023/09/18 19:32:19 millert Exp $ */
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
Copyright (C) Lucent Technologies 1997
|
Copyright (C) Lucent Technologies 1997
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
@ -606,7 +606,7 @@ int u8_isutf(const char *s)
|
|||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
c = s[0];
|
c = s[0];
|
||||||
if (c < 128)
|
if (c < 128 || awk_mb_cur_max == 1)
|
||||||
return 1; /* what if it's 0? */
|
return 1; /* what if it's 0? */
|
||||||
|
|
||||||
n = strlen(s);
|
n = strlen(s);
|
||||||
@ -633,7 +633,7 @@ int u8_rune(int *rune, const char *s)
|
|||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
c = s[0];
|
c = s[0];
|
||||||
if (c < 128) {
|
if (c < 128 || awk_mb_cur_max == 1) {
|
||||||
*rune = c;
|
*rune = c;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -680,7 +680,7 @@ int u8_strlen(const char *s)
|
|||||||
totlen = 0;
|
totlen = 0;
|
||||||
for (i = 0; i < n; i += len) {
|
for (i = 0; i < n; i += len) {
|
||||||
c = s[i];
|
c = s[i];
|
||||||
if (c < 128) {
|
if (c < 128 || awk_mb_cur_max == 1) {
|
||||||
len = 1;
|
len = 1;
|
||||||
} else {
|
} else {
|
||||||
len = u8_nextlen(&s[i]);
|
len = u8_nextlen(&s[i]);
|
||||||
@ -1290,7 +1290,7 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
|
|||||||
int charval = (int) getfval(x);
|
int charval = (int) getfval(x);
|
||||||
|
|
||||||
if (charval != 0) {
|
if (charval != 0) {
|
||||||
if (charval < 128)
|
if (charval < 128 || awk_mb_cur_max == 1)
|
||||||
snprintf(p, BUFSZ(p), fmt, charval);
|
snprintf(p, BUFSZ(p), fmt, charval);
|
||||||
else {
|
else {
|
||||||
// possible unicode character
|
// possible unicode character
|
||||||
|
Loading…
Reference in New Issue
Block a user