*mgp = mg_find(sv, PERL_MAGIC_utf8);
if (*mgp && (*mgp)->mg_ptr) {
*cachep = (STRLEN *) (*mgp)->mg_ptr;
- if ((*cachep)[i] == uoff) /* An exact match. */
+ if ((*cachep)[i] == (STRLEN)uoff) /* An exact match. */
found = TRUE;
else { /* We will skip to the right spot. */
STRLEN forw = 0;
* 2 * backw in the below comes from). (The real
* figure of course depends on the UTF-8 data.) */
- if ((*cachep)[i] > uoff) {
+ if ((*cachep)[i] > (STRLEN)uoff) {
forw = uoff;
- backw = (*cachep)[i] - uoff;
+ backw = (*cachep)[i] - (STRLEN)uoff;
if (forw < 2 * backw)
p = start;
else if (i == 0) { /* (*cachep)[i] < uoff */
STRLEN ulen = sv_len_utf8(sv);
- if (uoff < ulen) {
- forw = uoff - (*cachep)[i];
- backw = ulen - uoff;
+ if ((STRLEN)uoff < ulen) {
+ forw = (STRLEN)uoff - (*cachep)[i];
+ backw = ulen - (STRLEN)uoff;
if (forw < 2 * backw)
p = start + (*cachep)[i+1];
}
/* Update the cache. */
- (*cachep)[i] = uoff;
+ (*cachep)[i] = (STRLEN)uoff;
(*cachep)[i+1] = p - start;
found = TRUE;