}
else if (SCM_CHARSETP (char_pred))
{
- int i;
+ size_t i;
for (i = cstart; i < cend; i++)
if (SCM_CHARSET_GET (char_pred, cstr[i]))
{
if (SCM_CHARP (char_pred))
{
char cchr = SCM_CHAR (char_pred);
- int i;
+ size_t i;
for (i = cstart; i < cend; i++)
if (cstr[i] != cchr)
{
}
else if (SCM_CHARSETP (char_pred))
{
- int i;
+ size_t i;
for (i = cstart; i < cend; i++)
if (!SCM_CHARSET_GET (char_pred, cstr[i]))
{
/* The RES string remains untouched since nobody knows about it
yet. No need to refetch P.
*/
- ch = scm_call_1 (proc, scm_from_int (i));
+ ch = scm_call_1 (proc, scm_from_size_t (i));
if (!SCM_CHARP (ch))
SCM_MISC_ERROR ("procedure ~S returned non-char", scm_list_1 (proc));
*p++ = SCM_CHAR (ch);
/* Helper function for the string uppercase conversion functions.
* No argument checking is performed. */
static SCM
-string_upcase_x (SCM v, int start, int end)
+string_upcase_x (SCM v, size_t start, size_t end)
{
size_t k;
char *dst;
/* Helper function for the string lowercase conversion functions.
* No argument checking is performed. */
static SCM
-string_downcase_x (SCM v, int start, int end)
+string_downcase_x (SCM v, size_t start, size_t end)
{
size_t k;
char *dst;
/* Helper function for the string capitalization functions.
* No argument checking is performed. */
static SCM
-string_titlecase_x (SCM str, int start, int end)
+string_titlecase_x (SCM str, size_t start, size_t end)
{
unsigned char *sz;
size_t i;
/* Reverse the portion of @var{str} between str[cstart] (including)
and str[cend] excluding. */
static void
-string_reverse_x (char * str, int cstart, int cend)
+string_reverse_x (char * str, size_t cstart, size_t cend)
{
char tmp;
- cend--;
- while (cstart < cend)
+ if (cend > 0)
{
- tmp = str[cstart];
- str[cstart] = str[cend];
- str[cend] = tmp;
- cstart++;
cend--;
+ while (cstart < cend)
+ {
+ tmp = str[cstart];
+ str[cstart] = str[cend];
+ str[cend] = tmp;
+ cstart++;
+ cend--;
+ }
}
}
{
const char *cs;
char *p;
- size_t cstart, cend, cfrom, cto;
+ size_t cstart, cend;
+ int cfrom, cto;
SCM result;
MY_VALIDATE_SUBSTRING_SPEC (1, s,
4, start, cstart,
5, end, cend);
- cfrom = scm_to_size_t (from);
+ cfrom = scm_to_int (from);
if (SCM_UNBNDP (to))
cto = cfrom + (cend - cstart);
else
- cto = scm_to_size_t (to);
+ cto = scm_to_int (to);
if (cstart == cend && cfrom != cto)
SCM_MISC_ERROR ("start and end indices must not be equal", SCM_EOL);
cs = scm_i_string_chars (s);
while (cfrom < cto)
{
- int t = ((cfrom < 0) ? -cfrom : cfrom) % (cend - cstart);
+ size_t t = ((cfrom < 0) ? -cfrom : cfrom) % (cend - cstart);
if (cfrom < 0)
*p = cs[(cend - cstart) - t];
else
{
char *p;
const char *cs;
- size_t ctstart, csfrom, csto, cstart, cend;
+ size_t ctstart, cstart, cend;
+ int csfrom, csto;
SCM dummy = SCM_UNDEFINED;
size_t cdummy;
MY_VALIDATE_SUBSTRING_SPEC (3, s,
6, start, cstart,
7, end, cend);
- csfrom = scm_to_size_t (sfrom);
+ csfrom = scm_to_int (sfrom);
if (SCM_UNBNDP (sto))
csto = csfrom + (cend - cstart);
else
- csto = scm_to_size_t (sto);
+ csto = scm_to_int (sto);
if (cstart == cend && csfrom != csto)
SCM_MISC_ERROR ("start and end indices must not be equal", SCM_EOL);
SCM_ASSERT_RANGE (1, tstart,
cs = scm_i_string_chars (s);
while (csfrom < csto)
{
- int t = ((csfrom < 0) ? -csfrom : csfrom) % (cend - cstart);
+ size_t t = ((csfrom < 0) ? -csfrom : csfrom) % (cend - cstart);
if (csfrom < 0)
*p = cs[(cend - cstart) - t];
else
if (SCM_CHARSETP (token_set))
{
- int idx;
+ size_t idx;
while (cstart < cend)
{