Skip to content

Commit

Permalink
Make long->int conversions explicit in par.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowfiend committed Nov 6, 2013
1 parent 629c8d5 commit 56a5779
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion par/charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static int hexdigtoint(wchar_t c)
if (!c) return -1;
p = wcschr(hexdigits, c);
if (!p) return -1;
n = p - hexdigits;
n = (int)(p - hexdigits);
if (n >= 16) n -= 6;
return n;

Expand Down
12 changes: 6 additions & 6 deletions par/par.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static int digtoint(char c)

if (!c) return -1;
p = strchr(digits,c);
return p ? p - digits : -1;
return p ? (int)(p - digits) : -1;

/* We can't simply return c - '0' because this is ANSI C code, */
/* so it has to work for any character set, not just ones which */
Expand Down Expand Up @@ -362,7 +362,7 @@ static wchar_t **readlines(
}
}
else {
vlnlen = p - ln;
vlnlen = (int)(p - ln);
vln = malloc((vlnlen + 1) * sizeof (wchar_t));
if (!vln) {
wcscpy(errmsg,outofmem);
Expand Down Expand Up @@ -510,7 +510,7 @@ static void compresuflen(
else
break;
}
*ppre = end - start;
*ppre = (int)(end - start);

knownstart = *lines + *ppre;
for (end = knownstart; *end; ++end);
Expand All @@ -537,7 +537,7 @@ static void compresuflen(
}
else
while (end - start >= 2 && *start == L' ' && start[1] == L' ') ++start;
*psuf = end - start;
*psuf = (int)(end - start);
}


Expand Down Expand Up @@ -676,7 +676,7 @@ static void setaffixes(
int numin, pre, suf;
const wchar_t *p;

numin = endline - inlines;
numin = (int)(endline - inlines);

if ((*pprefix < 0 || *psuffix < 0) && numin > hang + 1)
compresuflen(inlines + hang, endline, bodychars, body, 0, 0, &pre, &suf);
Expand All @@ -685,7 +685,7 @@ static void setaffixes(
if (numin == 1 && quote)
while (*p && csmember (*p, quotechars))
++p;
*pafp = p - *inlines;
*pafp = (int)(p - *inlines);
*pfs = props->s;

if (*pprefix < 0)
Expand Down
4 changes: 2 additions & 2 deletions par/reformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ wchar_t **reformat(
dummy.next = dummy.prev = NULL;
dummy.flags = 0;
head = tail = &dummy;
numin = endline - inlines;
numin = (int)(endline - inlines);
if (numin <= 0) {
swprintf(errmsg,errmsg_size,impossibility,4);
goto rfcleanup;
Expand Down Expand Up @@ -383,7 +383,7 @@ wchar_t **reformat(
w1->prev = tail;
tail = tail->next = w1;
w1->chrs = p1;
w1->length = p2 - p1;
w1->length = (int)(p2 - p1);
w1->width = getWidth(p1, p2);
w1->flags = 0;
p1 = p2;
Expand Down

0 comments on commit 56a5779

Please sign in to comment.