const char *p;
for (p = str; p; p++) {
if (*p == '\0') {
- return (p - str);
+ return (int)(p - str);
}
}
/* NOTREACHED */
}
}
}
- *out_ptr = '\0';
- return max - length;
+ if (max > 0)
+ *out_ptr = '\0';
+ return max - (length + 1); /* don't include the final NULL in the return value */
}
int