Skip to content

Commit

Permalink
smoke
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed Jul 19, 2021
1 parent e33d5fe commit 5cb24a1
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 49 deletions.
2 changes: 1 addition & 1 deletion cop.h
Expand Up @@ -885,7 +885,7 @@ struct block_loop {
* Note the contrast with CvLVALUE(), which is a property of the sub
* rather than the call site.
*/
#define CxLVAL(c) (0 + ((c)->blk_u16 & 0xff))
#define CxLVAL(c) (0 + ((U8)((c)->blk_u16)))



Expand Down
2 changes: 1 addition & 1 deletion dist/Storable/Storable.pm
Expand Up @@ -28,7 +28,7 @@ our @EXPORT_OK = qw(
our ($canonical, $forgive_me);

BEGIN {
our $VERSION = '3.23';
our $VERSION = '3.24';
}

our $recursion_limit;
Expand Down
2 changes: 1 addition & 1 deletion dist/Storable/Storable.xs
Expand Up @@ -1247,7 +1247,7 @@ static const char byteorderstr_56[] = {BYTEORDER_BYTES_56, 0};
# define Sntohl(x) (x)
# else
static U32 Sntohl(U32 x) {
return ((x & 0xFF) << 24) + ((x * 0xFF00) << 8)
return (((U8) x) << 24) + ((x * 0xFF00) << 8)
+ ((x & 0xFF0000) >> 8) + ((x & 0xFF000000) >> 24);
}
# endif
Expand Down
2 changes: 1 addition & 1 deletion dist/Unicode-Normalize/Normalize.pm
Expand Up @@ -16,7 +16,7 @@ use Carp;

no warnings 'utf8';

our $VERSION = '1.28';
our $VERSION = '1.29';
our $PACKAGE = __PACKAGE__;

our @EXPORT = qw( NFC NFD NFKC NFKD );
Expand Down
16 changes: 8 additions & 8 deletions dist/Unicode-Normalize/Normalize.xs
Expand Up @@ -139,8 +139,8 @@ static U8* dec_canonical(UV uv)
plane = (U8***)UNF_canon[uv >> 16];
if (! plane)
return NULL;
row = plane[(uv >> 8) & 0xff];
return row ? row[uv & 0xff] : NULL;
row = plane[(U8) (uv >> 8)];
return row ? row[(U8) uv] : NULL;
}

static U8* dec_compat(UV uv)
Expand All @@ -151,8 +151,8 @@ static U8* dec_compat(UV uv)
plane = (U8***)UNF_compat[uv >> 16];
if (! plane)
return NULL;
row = plane[(uv >> 8) & 0xff];
return row ? row[uv & 0xff] : NULL;
row = plane[(U8) (uv >> 8)];
return row ? row[(U8) uv] : NULL;
}

static UV composite_uv(UV uv, UV uv2)
Expand All @@ -175,10 +175,10 @@ static UV composite_uv(UV uv, UV uv2)
plane = UNF_compos[uv >> 16];
if (! plane)
return 0;
row = plane[(uv >> 8) & 0xff];
row = plane[(U8) (uv >> 8)];
if (! row)
return 0;
cell = row[uv & 0xff];
cell = row[(U8) uv];
if (! cell)
return 0;
for (i = cell; i->nextchar; i++) {
Expand All @@ -196,8 +196,8 @@ static U8 getCombinClass(UV uv)
plane = (U8**)UNF_combin[uv >> 16];
if (! plane)
return 0;
row = plane[(uv >> 8) & 0xff];
return row ? row[uv & 0xff] : 0;
row = plane[(U8) (uv >> 8)];
return row ? row[(U8) uv] : NULL;
}

static U8* pv_cat_decompHangul(pTHX_ U8* d, UV uv)
Expand Down
3 changes: 2 additions & 1 deletion doop.c
Expand Up @@ -363,7 +363,8 @@ S_do_trans_count_invmap(pTHX_ SV * const sv, AV * const invmap)
SSize_t i;
STRLEN s_len;

/* Get the code point of the next character in the string */
/* remove from loop; look for all INVARIANT calls in the code; should be replaceable
* Get the code point of the next character in the string */
if (! SvUTF8(sv) || UTF8_IS_INVARIANT(*s)) {
from = *s;
s_len = 1;
Expand Down
2 changes: 1 addition & 1 deletion dump.c
Expand Up @@ -181,7 +181,7 @@ Perl_pv_escape( pTHX_ SV *dsv, char const * const str,

for ( ; (pv < end && (!max || (wrote < max))) ; pv += readsize ) {
const UV u= (isuni) ? utf8_to_uvchr_buf((U8*)pv, (U8*) end, &readsize) : (U8)*pv;
const U8 c = (U8)u & 0xFF;
const U8 c = (U8)u;

if ( ( u > 255 )
|| (flags & PERL_PV_ESCAPE_ALL)
Expand Down
2 changes: 1 addition & 1 deletion ext/Opcode/Opcode.xs
Expand Up @@ -68,7 +68,7 @@ op_names_init(pTHX)
bitmap = (U8*)SvPV(opset_all, len);
memset(bitmap, 0xFF, len-1); /* deal with last byte specially, see below */
/* Take care to set the right number of bits in the last byte */
bitmap[len-1] = (PL_maxo & 0x07) ? ((~(0xFF << (PL_maxo & 0x07))) & 0xFF)
bitmap[len-1] = (PL_maxo & 0x07) ? ((U8) (~(0xFF << (PL_maxo & 0x07))))
: 0xFF;
put_op_bitspec(aTHX_ STR_WITH_LEN(":all"), opset_all); /* don't mortalise */
}
Expand Down
2 changes: 1 addition & 1 deletion ext/POSIX/POSIX.xs
Expand Up @@ -1678,7 +1678,7 @@ static const struct lconv_offset lconv_integers[] = {
* in the first place, though. -- Ingo Weinhold
*/
#if defined(__HAIKU__)
# define WMUNGE(x) (((x) & 0xFF00) >> 8 | ((x) & 0x00FF) << 8)
# define WMUNGE(x) (((x) & 0xFF00) >> 8 | (((U8) (x)) << 8))
#else
# define WMUNGE(x) (x)
#endif
Expand Down
2 changes: 1 addition & 1 deletion ext/POSIX/lib/POSIX.pm
Expand Up @@ -4,7 +4,7 @@ use warnings;

our ($AUTOLOAD, %SIGRT);

our $VERSION = '1.98';
our $VERSION = '1.99';

require XSLoader;

Expand Down
1 change: 1 addition & 0 deletions inline.h
Expand Up @@ -667,6 +667,7 @@ Perl_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep)
#ifndef EBCDIC

PERL_STATIC_INLINE unsigned int
/* rename to pos */
Perl_variant_byte_number(PERL_UINTMAX_T word)
{

Expand Down
16 changes: 8 additions & 8 deletions perl.h
Expand Up @@ -1224,18 +1224,18 @@ Use L</UV> to declare variables of the maximum usable size on this platform.

/* byte-swapping functions for big-/little-endian conversion */
# define _swab_16_(x) ((U16)( \
(((U16)(x) & UINT16_C(0x00ff)) << 8) | \
(((U16)(x) & UINT16_C(0xff00)) >> 8) ))
(((U16)(U8) (x) ) << 8) | \
(((U16) (x) & UINT16_C(0xff00)) >> 8) ))

# define _swab_32_(x) ((U32)( \
(((U32)(x) & UINT32_C(0x000000ff)) << 24) | \
(((U32)(U8)(x) ) << 24) | \
(((U32)(x) & UINT32_C(0x0000ff00)) << 8) | \
(((U32)(x) & UINT32_C(0x00ff0000)) >> 8) | \
(((U32)(x) & UINT32_C(0xff000000)) >> 24) ))

# ifdef HAS_QUAD
# define _swab_64_(x) ((U64)( \
(((U64)(x) & UINT64_C(0x00000000000000ff)) << 56) | \
(((U64)(U8)(x) ) << 56) | \
(((U64)(x) & UINT64_C(0x000000000000ff00)) << 40) | \
(((U64)(x) & UINT64_C(0x0000000000ff0000)) << 24) | \
(((U64)(x) & UINT64_C(0x00000000ff000000)) << 8) | \
Expand Down Expand Up @@ -3512,7 +3512,7 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex)
if (MY_POSIX_EXIT) { \
if (evalue <= 0xFF00) { \
if (evalue > 0xFF) \
evalue = (evalue >> child_offset_bits) & 0xFF; \
evalue = ((U8) (evalue >> child_offset_bits)); \
PL_statusvalue_vms = \
(C_FAC_POSIX | (evalue << 3 ) | \
((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1)); \
Expand Down Expand Up @@ -4220,11 +4220,11 @@ my_swap16(const U16 x) {
# define htovl(x) vtohl(x)
# define htovs(x) vtohs(x)
#elif BYTEORDER == 0x4321 || BYTEORDER == 0x87654321
# define vtohl(x) ((((x)&0xFF)<<24) \
+(((x)>>24)&0xFF) \
# define vtohl(x) ((((U8) (x)) << 24) \
+((U8) ((x) >> 24)) \
+(((x)&0x0000FF00)<<8) \
+(((x)&0x00FF0000)>>8) )
# define vtohs(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
# define vtohs(x) ((((U8) (x)) << 8) + ((U8) ((x) >> 8)))
# define htovl(x) vtohl(x)
# define htovs(x) vtohs(x)
#else
Expand Down
12 changes: 6 additions & 6 deletions pp_pack.c
Expand Up @@ -223,7 +223,7 @@ S_mul128(pTHX_ SV *sv, U8 m)
#define TYPE_IS_PACK 0x800
#define TYPE_ENDIANNESS_MASK (TYPE_IS_BIG_ENDIAN|TYPE_IS_LITTLE_ENDIAN)
#define TYPE_MODIFIERS(t) ((t) & ~0xFF)
#define TYPE_NO_MODIFIERS(t) ((t) & 0xFF)
#define TYPE_NO_MODIFIERS(t) ((U8) (t))

# define TYPE_ENDIANNESS(t) ((t) & TYPE_ENDIANNESS_MASK)
# define TYPE_NO_ENDIANNESS(t) ((t) & ~TYPE_ENDIANNESS_MASK)
Expand Down Expand Up @@ -263,7 +263,7 @@ utf8_to_byte(pTHX_ const char **s, const char *end, I32 datumtype)
Perl_ck_warner(aTHX_ packWARN(WARN_UNPACK),
"Character in '%c' format wrapped in unpack",
(int) TYPE_NO_MODIFIERS(datumtype));
val &= 0xff;
val = (U8) val;
}
*s += retlen;
return (U8)val;
Expand Down Expand Up @@ -296,7 +296,7 @@ S_utf8_to_bytes(pTHX_ const char **s, const char *end, const char *buf, SSize_t
} else from += retlen;
if (val >= 0x100) {
bad |= 2;
val &= 0xff;
val = (U8) val;
}
if (UNLIKELY(needs_swap))
*(U8 *)--buf = (U8)val;
Expand Down Expand Up @@ -2573,7 +2573,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
if ((-128 > aiv || aiv > 127))
Perl_ck_warner(aTHX_ packWARN(WARN_PACK),
"Character in 'c' format wrapped in pack");
PUSH_BYTE(utf8, cur, (U8)(aiv & 0xff));
PUSH_BYTE(utf8, cur, (U8)aiv);
}
break;
case 'C':
Expand All @@ -2588,7 +2588,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
if ((0 > aiv || aiv > 0xff))
Perl_ck_warner(aTHX_ packWARN(WARN_PACK),
"Character in 'C' format wrapped in pack");
PUSH_BYTE(utf8, cur, (U8)(aiv & 0xff));
PUSH_BYTE(utf8, cur, (U8)aiv);
}
break;
case 'W': {
Expand Down Expand Up @@ -2628,7 +2628,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
}
Perl_ck_warner(aTHX_ packWARN(WARN_PACK),
"Character in 'W' format wrapped in pack");
auv &= 0xff;
auv = (U8) auv;
}
if (cur >= end) {
*cur = '\0';
Expand Down
2 changes: 1 addition & 1 deletion regcomp.h
Expand Up @@ -592,7 +592,7 @@ struct regnode_ssc {
* are cautioned about its shared nature */
#define ANYOF_SHARED_d_MATCHES_ALL_NON_UTF8_NON_ASCII_non_d_WARN_SUPER 0x80

#define ANYOF_FLAGS_ALL (0xff & ~0x10)
#define ANYOF_FLAGS_ALL ((U8) ~0x10)

#define ANYOF_LOCALE_FLAGS (ANYOFL_FOLD | ANYOF_MATCHES_POSIXL)

Expand Down
14 changes: 10 additions & 4 deletions t/op/vec.t
Expand Up @@ -6,12 +6,15 @@ BEGIN {
set_up_inc('../lib');
}

use warnings;
use strict;
use Config;

plan(tests => 78);

my $exception_134139 = "Use of strings with code points over 0xFF as arguments to vec is forbidden";

my $foo;
is(vec($foo,0,1), 0);
is(length($foo), undef);
vec($foo,0,1) = 1;
Expand All @@ -29,11 +32,14 @@ is(vec($foo,1,8), 0xf1);
is((unpack('C',substr($foo,1,1)) & 255), 0xf1);
is(vec($foo,2,4), 1);;
is(vec($foo,3,4), 15);

my $Vec;
vec($Vec, 0, 32) = 0xbaddacab;
is($Vec, "\xba\xdd\xac\xab");
is(vec($Vec, 0, 32), 3135089835);

# ensure vec() handles numericalness correctly
my ($bar, $baz);
$foo = $bar = $baz = 0;
vec($foo = 0,0,1) = 1;
vec($bar = 0,1,1) = 1;
Expand All @@ -44,7 +50,7 @@ ok("$foo $bar $baz" eq "1 2 3");

# error cases

$x = eval { vec $foo, 0, 3 };
my $x = eval { vec $foo, 0, 3 };
like($@, qr/^Illegal number of bits in vec/);
$@ = undef;
$x = eval { vec $foo, 0, 0 };
Expand All @@ -67,7 +73,7 @@ is(vec($x, 0, 8), 255);
$@ = undef;
{
local $@;
eval { vec($foo, 1, 8) };
eval { my $foo = vec($foo, 1, 8) };
like($@, qr/$exception_134139/,
"Caught exception: code point over 0xFF used as argument to vec");
$@ = undef;
Expand Down Expand Up @@ -236,7 +242,7 @@ like($@, qr/^Modification of a read-only value attempted at /,
like($@, qr/Negative offset to vec in lvalue context/, "RT131083 lval -1");

$off = ~0;
my $v = RT131083(0, vec($s, $off, 8));
$v = RT131083(0, vec($s, $off, 8));
is($v, 0, "RT131083 rval ~0");
$v = eval { RT131083(1, vec($s, $off, 8)); };
like($@, qr/Out of memory!/, "RT131083 lval ~0");
Expand All @@ -247,7 +253,7 @@ like($@, qr/^Modification of a read-only value attempted at /,

local $@;
my $foo = "\x{100}" . "\xff\xfe";
eval { vec($foo, 1, 8) };
eval { my $bar = vec($foo, 1, 8) };
like($@, qr/$exception_134139/,
"RT 134139: Use of strings with code points over 0xFF as arguments to 'vec' is now forbidden");
}
2 changes: 1 addition & 1 deletion toke.c
Expand Up @@ -9283,7 +9283,7 @@ Perl_yylex(pTHX)
if (PL_lex_brackets > 100)
Renew(PL_lex_brackstack, PL_lex_brackets + 10, char);
PL_lex_brackstack[PL_lex_brackets++] =
(char) ((next_type >> 16) & 0xff);
(char) ((U8) (next_type >> 16));
}
if (next_type & (2<<24))
PL_lex_allbrackets++;
Expand Down
4 changes: 2 additions & 2 deletions vms/vms.c
Expand Up @@ -601,8 +601,8 @@ copy_expand_vms_filename_escape(char *outspec, const char *inspec, int *output_c
if (scnt == 4) {
unsigned int c1, c2;
scnt = sscanf(inspec, "%2x%2x", &c1, &c2);
outspec[0] = c1 & 0xff;
outspec[1] = c2 & 0xff;
outspec[0] = (U8) c1;
outspec[1] = (U8) c2;
if (scnt > 1) {
(*output_cnt) += 2;
count += 4;
Expand Down
10 changes: 5 additions & 5 deletions win32/fcrypt.c
Expand Up @@ -35,10 +35,10 @@ typedef struct des_ks_struct
l|=((unsigned long)(*((c)++)))<<16, \
l|=((unsigned long)(*((c)++)))<<24)

#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \
*((c)++)=(unsigned char)(((l)>>16)&0xff), \
*((c)++)=(unsigned char)(((l)>>24)&0xff))
#define l2c(l,c) (*((c)++)=(unsigned char)((l) ), \
*((c)++)=(unsigned char)((l)>> 8), \
*((c)++)=(unsigned char)((l)>>16), \
*((c)++)=(unsigned char)((l)>>24))

static const unsigned long SPtrans[8][64]={
{ /* nibble 0 */
Expand Down Expand Up @@ -357,7 +357,7 @@ des_set_key(des_cblock *key, des_key_schedule schedule)
PERM_OP (d,c,t,1,0x55555555);
PERM_OP (c,d,t,8,0x00ff00ff);
PERM_OP (d,c,t,1,0x55555555);
d= (((d&0x000000ff)<<16)| (d&0x0000ff00) |
d= ((((U8) d) <<16)| (d&0x0000ff00) |
((d&0x00ff0000)>>16)|((c&0xf0000000)>>4));
c&=0x0fffffff;

Expand Down

0 comments on commit 5cb24a1

Please sign in to comment.