Merge pull request #195 from badgerman/develop

fix clang build
This commit is contained in:
Enno Rehling 2015-05-18 08:10:58 +02:00
commit dba1a6e221
3 changed files with 28 additions and 20 deletions

@ -1 +1 @@
Subproject commit 61989d93368022602a2a7ac4218c83f254701f0f Subproject commit b38f6f8acdc2ce5b0613a4bb2ff8082051a25ac3

View File

@ -452,8 +452,9 @@ size_t size)
char *bufp = buf; char *bufp = buf;
bool itemcloak = false; bool itemcloak = false;
const curse_type *itemcloak_ct = 0; const curse_type *itemcloak_ct = 0;
int result = 0;
size_t bytes; size_t bytes;
item result[MAX_INVENTORY]; item results[MAX_INVENTORY];
itemcloak_ct = ct_find("itemcloak"); itemcloak_ct = ct_find("itemcloak");
if (itemcloak_ct) { if (itemcloak_ct) {
@ -511,10 +512,11 @@ size_t size)
else { else {
if (a_otherfaction && alliedunit(u, f, HELP_FSTEALTH)) { if (a_otherfaction && alliedunit(u, f, HELP_FSTEALTH)) {
faction *f = get_otherfaction(a_otherfaction); faction *f = get_otherfaction(a_otherfaction);
bytes = int result =
(size_t)_snprintf(bufp, size, ", %s (%s)", factionname(f), (size_t)_snprintf(bufp, size, ", %s (%s)", factionname(f),
factionname(u->faction)); factionname(u->faction));
if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) bytes = (size_t)result;
if (result < 0 || wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} }
else { else {
@ -538,9 +540,10 @@ size_t size)
bytes = strlcpy(bufp, "? ", size); bytes = strlcpy(bufp, "? ", size);
} }
else { else {
bytes = (size_t)_snprintf(bufp, size, "%d ", u->number); result = _snprintf(bufp, size, "%d ", u->number);
bytes = (size_t)result;
} }
if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) if (result < 0 || wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
pzTmp = get_racename(u->attribs); pzTmp = get_racename(u->attribs);
@ -658,10 +661,10 @@ size_t size)
} }
else if (!itemcloak && mode >= see_unit && !(a_fshidden else if (!itemcloak && mode >= see_unit && !(a_fshidden
&& a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) { && a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) {
int n = report_items(u->items, result, MAX_INVENTORY, u, f); int n = report_items(u->items, results, MAX_INVENTORY, u, f);
assert(n >= 0); assert(n >= 0);
if (n > 0) if (n > 0)
show = result; show = results;
else else
show = NULL; show = NULL;
} }
@ -679,8 +682,9 @@ size_t size)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
if (!dh) { if (!dh) {
bytes = (size_t)_snprintf(bufp, size, "%s: ", LOC(f->locale, "nr_inventory")); result = _snprintf(bufp, size, "%s: ", LOC(f->locale, "nr_inventory"));
if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) bytes = (size_t)result;
if (result < 0 || wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
dh = 1; dh = 1;
} }
@ -688,9 +692,10 @@ size_t size)
bytes = strlcpy(bufp, ic, size); bytes = strlcpy(bufp, ic, size);
} }
else { else {
bytes = (size_t)_snprintf(bufp, size, "%d %s", in, ic); result = _snprintf(bufp, size, "%d %s", in, ic);
bytes = (size_t)result;
} }
if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) if (result < 0 || wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} }
@ -700,26 +705,29 @@ size_t size)
if (book) { if (book) {
quicklist *ql = book->spells; quicklist *ql = book->spells;
int qi, header, maxlevel = effskill(u, SK_MAGIC); int qi, header, maxlevel = effskill(u, SK_MAGIC);
size_t bytes = (size_t)_snprintf(bufp, size, ". Aura %d/%d", get_spellpoints(u), max_spellpoints(u->region, u)); int result = _snprintf(bufp, size, ". Aura %d/%d", get_spellpoints(u), max_spellpoints(u->region, u));
if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) { size_t bytes = (size_t)result;
if (result < 0 || wrptr(&bufp, &size, bytes) != 0) {
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} }
for (header = 0, qi = 0; ql; ql_advance(&ql, &qi, 1)) { for (header = 0, qi = 0; ql; ql_advance(&ql, &qi, 1)) {
spellbook_entry * sbe = (spellbook_entry *)ql_get(ql, qi); spellbook_entry * sbe = (spellbook_entry *)ql_get(ql, qi);
if (sbe->level <= maxlevel) { if (sbe->level <= maxlevel) {
int result = 0;
if (!header) { if (!header) {
bytes = (size_t)_snprintf(bufp, size, ", %s: ", LOC(f->locale, "nr_spells")); result = _snprintf(bufp, size, ", %s: ", LOC(f->locale, "nr_spells"));
bytes = (size_t)result;
header = 1; header = 1;
} }
else { else {
bytes = strlcpy(bufp, ", ", size); bytes = strlcpy(bufp, ", ", size);
} }
if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) { if (result < 0 || wrptr(&bufp, &size, bytes) != 0) {
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} }
bytes = strlcpy(bufp, spell_name(sbe->sp, f->locale), size); bytes = strlcpy(bufp, spell_name(sbe->sp, f->locale), size);
if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) { if (wrptr(&bufp, &size, bytes) != 0) {
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} }
} }
@ -757,8 +765,8 @@ size_t size)
} }
if (sl > 0) { if (sl > 0) {
int result = _snprintf(bufp, size, " (%d)", sl); result = _snprintf(bufp, size, " (%d)", sl);
size_t bytes = (size_t)result; bytes = (size_t)result;
if (result < 0 || wrptr(&bufp, &size, bytes) != 0) if (result < 0 || wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} }

@ -1 +1 @@
Subproject commit bcc2874cf289a1d0fc9cc79ff3ed271403b2e24c Subproject commit 48768e4bef7ff28365487e047d3b910127c716d0