red = 0;
ccase = 0;
- for(i = 0; i < strlen(s2); ++i)
+ int len = strlen(s2);
+ for (i = 0; i < len; ++i)
{
for(j = 0; j < NUM_MARKUPS; ++j)
{
s = strzone(s);
lleft = l;
- for (i = 0;i < strlen(s);++i)
+ int len = strlen(s);
+ for (i = 0; i < len; ++i)
{
if (substring(s, i, 2) == "\\n")
{
if (lleft > 0)
{
callback(" ");
- lleft = lleft - 1;
+ --lleft;
}
}
else
{
- for (j = i+1;j < strlen(s);++j)
+ for (j = i+1; j < len; ++j)
// ^^ this skips over the first character of a word, which
// is ALWAYS part of the word
// this is safe since if i+1 == strlen(s), i will become
lleft = l;
}
callback(substring(s, i, wlen));
- lleft = lleft - wlen;
+ lleft -= wlen;
i = j - 1;
}
}
void InputBox_enterText(entity me, string ch)
{
- float i;
- for (i = 0; i < strlen(ch); ++i)
+ int len = strlen(ch);
+ for (int i = 0; i < len; ++i)
if (strstrofs(me.forbiddenCharacters, substring(ch, i, 1), 0) > -1) return;
if (me.maxLength > 0)
{
- if (strlen(ch) + strlen(me.text) > me.maxLength) return;
+ if (len + strlen(me.text) > me.maxLength) return;
}
else if (me.maxLength < 0)
{
if (u8_strsize(ch) + u8_strsize(me.text) > -me.maxLength) return;
}
me.setText(me, strcat(substring(me.text, 0, me.cursorPos), ch, substring(me.text, me.cursorPos, strlen(me.text) - me.cursorPos)));
- me.cursorPos += strlen(ch);
+ me.cursorPos += len;
}
float InputBox_keyDown(entity me, float key, float ascii, float shift)
if (main.mainNexposee.ModalController_state == 0) return;
vector v = '0 0 0';
int scalemode = SCALEMODE_CROP;
- for (int i = 0, l = 0; i < strlen(algn); ++i)
+ int len = strlen(algn);
+ for (int i = 0, l = 0; i < len; ++i)
{
string c = substring(algn, i, 1);
switch (c)
vector oldscale = draw_scale;
vector oldshift = draw_shift;
#define SET_YRANGE(start,end) \
- draw_scale = boxToGlobalSize(eX * 1 + eY * (end - start), oldscale); \
+ draw_scale = boxToGlobalSize(eX + eY * (end - start), oldscale); \
draw_shift = boxToGlobal(eY * start, oldshift, oldscale);
for (j = 0; j < category_draw_count; ++j) {