View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000490 | LDMud 3.2 | Portability | public | 2006-11-12 21:15 | 2018-01-29 21:57 |
Reporter | zippo | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.2.13 | ||||
Fixed in Version | 3.2.16 | ||||
Summary | 0000490: x86_64 sprintf.c problem | ||||
Description | This is actually for 3.2.14, but it's not listed in Mantis. sprintf.c: In function `string_print_formatted': sprintf.c:1681: warning: comparison is always false due to limited range of data type sprintf.c:1682: warning: large integer implicitly truncated to unsigned type | ||||
Additional Information | Either the "fs" variable should be unsigned long (instead of unsigned int), or we should be using INT_MAX and INT_MIN instead of PINT_MAX and PINT_MIN here. On my system, SIZEOF_LONG and SIZEOF_CHAR_P are both == 8, and PINT_MAX then = LONG_MAX (and PINT_MIN = LONG_MIN). But the "fs" variable is unsigned int. | ||||
Tags | No tags attached. | ||||
|
Actually, looking a bit further, it doesn't seem to make sense that fs is unsigned: if (fs == WHATEVER_MINIMUM) { fs = WHATEVER_MAXIMUM } else { fs = -fs } I was going to say that since it's unsigned int, we should have if (fs == 0) { fs = UINT_MAX } ... but then I read the 'else' clause, and it doesn't make much sense to me. I guess I'm just confused, and you'll probably know the answer before I finish typing this. Either way, something is amiss. |
|
I believe to resolve this problem it is sufficient to define fs as type p_uint (which is the unsigned variant of p_int). I don't have a x86-64 at my hands, so you'll have to check the correction. fs is unsigned as it is supposed to handle the always-positive field size. The code in question however reads the fieldsize from the given NUMBER svalue, where a negative value indicates a left-aligned field (default is right-aligned): in that case, the negative value needs to be converted safely into its corresponding positive one. |
Date Modified | Username | Field | Change |
---|---|---|---|
2006-11-12 21:15 | zippo | New Issue | |
2006-11-12 21:28 | zippo | Note Added: 0000519 | |
2007-10-06 19:19 |
|
Status | new => resolved |
2007-10-06 19:19 |
|
Fixed in Version | => 3.2.16 |
2007-10-06 19:19 |
|
Resolution | open => fixed |
2007-10-06 19:19 |
|
Assigned To | => lars |
2007-10-06 19:19 |
|
Note Added: 0000551 | |
2010-11-16 09:42 |
|
Source_changeset_attached | => ldmud.git master 9e29f382 |
2010-11-16 09:42 |
|
Source_changeset_attached | => ldmud.git master-3.2 6d38e39b |
2018-01-29 18:59 |
|
Source_changeset_attached | => ldmud.git master 9e29f382 |
2018-01-29 18:59 |
|
Source_changeset_attached | => ldmud.git master-3.2 6d38e39b |
2018-01-29 21:57 |
|
Source_changeset_attached | => ldmud.git master 9e29f382 |
2018-01-29 21:57 |
|
Source_changeset_attached | => ldmud.git master-3.2 6d38e39b |