if (bad & 1) {
/* Rewalk the string fragment while warning */
char *ptr;
- flags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
+ const int flags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
for (ptr = *s; ptr < from; ptr += UTF8SKIP(ptr)) {
if (ptr >= end) break;
utf8n_to_uvuni((U8 *) ptr, end-ptr, &retlen, flags);
I32
Perl_unpack_str(pTHX_ char *pat, char *patend, char *s, char *strbeg, char *strend, char **new_s, I32 ocnt, U32 flags)
{
- tempsym_t sym = { 0 };
+ tempsym_t sym = { NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL };
+ (void)strbeg;
+ (void)new_s;
+ (void)ocnt;
if (flags & FLAG_DO_UTF8) flags |= FLAG_WAS_UTF8;
else if (need_utf8(pat, patend)) {
I32
Perl_unpackstring(pTHX_ char *pat, char *patend, char *s, char *strend, U32 flags)
{
- tempsym_t sym = { 0 };
+ tempsym_t sym = { NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL };
if (flags & FLAG_DO_UTF8) flags |= FLAG_WAS_UTF8;
else if (need_utf8(pat, patend)) {
const int bits_in_uv = CHAR_BIT * sizeof(cuv);
bool beyond = FALSE;
bool explicit_length;
- bool unpack_only_one = (symptr->flags & FLAG_UNPACK_ONLY_ONE) != 0;
+ const bool unpack_only_one = (symptr->flags & FLAG_UNPACK_ONLY_ONE) != 0;
bool utf8 = (symptr->flags & FLAG_PARSE_UTF8) ? 1 : 0;
symptr->strbeg = s - strbeg;
while (next_symbol(symptr)) {
packprops_t props;
- I32 len, ai32;
+ I32 len;
I32 datumtype = symptr->code;
/* do first one only unless in list context
/ is implemented by unpacking the count, then popping it from the
props = packprops[TYPE_NO_ENDIANNESS(datumtype)];
if (props) {
/* props nonzero means we can process this letter. */
- long size = props & PACK_SIZE_MASK;
- long howmany = (strend - s) / size;
+ const long size = props & PACK_SIZE_MASK;
+ const long howmany = (strend - s) / size;
if (len > howmany)
len = howmany;
case '(':
{
tempsym_t savsym = *symptr;
- U32 group_modifiers = TYPE_MODIFIERS(datumtype & ~symptr->flags);
+ const U32 group_modifiers = TYPE_MODIFIERS(datumtype & ~symptr->flags);
symptr->flags |= group_modifiers;
symptr->patend = savsym.grpend;
symptr->previous = &savsym;
case '.' | TYPE_IS_SHRIEKING:
#endif
case '.': {
- char *from;
+ const char *from;
SV *sv;
#ifdef PERL_PACK_CAN_SHRIEKSIGN
- bool u8 = utf8 && !(datumtype & TYPE_IS_SHRIEKING);
+ const bool u8 = utf8 && !(datumtype & TYPE_IS_SHRIEKING);
#else /* PERL_PACK_CAN_SHRIEKSIGN */
- bool u8 = utf8;
+ const bool u8 = utf8;
#endif
if (howlen == e_star) from = strbeg;
else if (len <= 0) from = s;
s -= len;
}
break;
- case 'x' | TYPE_IS_SHRIEKING:
+ case 'x' | TYPE_IS_SHRIEKING: {
+ I32 ai32;
if (!len) /* Avoid division by 0 */
len = 1;
if (utf8) ai32 = utf8_length((U8 *) strbeg, (U8 *) s) % len;
else ai32 = (s - strbeg) % len;
if (ai32 == 0) break;
len -= ai32;
+ }
/* FALL THROUGH */
case 'x':
if (utf8) {
str = SvPVX(sv);
if (datumtype == 'b') {
U8 bits = 0;
- ai32 = len;
+ I32 ai32 = len;
for (len = 0; len < ai32; len++) {
if (len & 7) bits >>= 1;
else if (utf8) {
}
} else {
U8 bits = 0;
- ai32 = len;
+ I32 ai32 = len;
for (len = 0; len < ai32; len++) {
if (len & 7) bits <<= 1;
else if (utf8) {
str = SvPVX(sv);
if (datumtype == 'h') {
U8 bits = 0;
- ai32 = len;
+ I32 ai32 = len;
for (len = 0; len < ai32; len++) {
if (len & 1) bits >>= 4;
else if (utf8) {
}
} else {
U8 bits = 0;
- ai32 = len;
+ I32 ai32 = len;
for (len = 0; len < ai32; len++) {
if (len & 1) bits <<= 4;
else if (utf8) {
void
Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
{
- tempsym_t sym = { 0 };
- sym.patptr = pat;
- sym.patend = patend;
- sym.flags = FLAG_PACK;
+ tempsym_t sym = { pat, patend, NULL, NULL, 0, 0, 0, 0, FLAG_PACK, 0, NULL };
+ (void)next_in_list;
+ (void)flags;
(void)pack_rec( cat, &sym, beglist, endlist );
}
Perl_packlist(pTHX_ SV *cat, char *pat, register char *patend, register SV **beglist, SV **endlist )
{
STRLEN no_len;
- tempsym_t sym = { 0 };
-
- sym.patptr = pat;
- sym.patend = patend;
- sym.flags = FLAG_PACK;
+ tempsym_t sym = { pat, patend, NULL, NULL, 0, 0, 0, 0, FLAG_PACK, 0, NULL };
/* We're going to do changes through SvPVX(cat). Make sure it's valid.
Also make sure any UTF8 flag is loaded */
if (cur < start+symptr->strbeg) {
/* Make sure group starts don't point into the void */
tempsym_t *group;
- STRLEN length = cur-start;
+ const STRLEN length = cur-start;
for (group = symptr;
group && length < group->strbeg;
group = group->previous) group->strbeg = length;