forked from github/server
fixes for -ansi -pedantic
This commit is contained in:
parent
78b7dcd727
commit
496aa22e65
20 changed files with 38 additions and 34 deletions
|
@ -21,7 +21,7 @@ extern "C" {
|
|||
|
||||
typedef enum {
|
||||
TNONE = 0, TINTEGER = 1, TREAL = 2, TSTRING = 3,
|
||||
TUNIT = 10, TFACTION = 11, TREGION = 12, TBUILDING = 13, TSHIP = 14,
|
||||
TUNIT = 10, TFACTION = 11, TREGION = 12, TBUILDING = 13, TSHIP = 14
|
||||
} object_type;
|
||||
|
||||
extern struct attrib_type at_object;
|
||||
|
|
|
@ -296,7 +296,7 @@ static int read_ext(attrib * a, void *owner, struct storage *store)
|
|||
a->data.v = 0;
|
||||
ur_add(data, a, resolve_bson);
|
||||
return AT_READ_OK;
|
||||
};
|
||||
}
|
||||
|
||||
attrib_type at_lua_ext = {
|
||||
"lua", init_ext, free_ext, age_ext, write_ext, read_ext
|
||||
|
|
|
@ -69,7 +69,7 @@ int tolua_faction_add_item(lua_State * L)
|
|||
if (itype != NULL) {
|
||||
item *i = i_change(&self->items, itype, number);
|
||||
result = i ? i->number : 0;
|
||||
} // if (itype!=NULL)
|
||||
} /* if (itype!=NULL) */
|
||||
}
|
||||
lua_pushnumber(L, result);
|
||||
return 1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
|
||||
// kernel includes
|
||||
/* kernel includes */
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/message.h>
|
||||
|
@ -9,10 +9,10 @@
|
|||
#include <kernel/region.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
// util includes
|
||||
/* util includes */
|
||||
#include <util/message.h>
|
||||
|
||||
// lua includes
|
||||
/* lua includes */
|
||||
#include <lua.h>
|
||||
#include <tolua.h>
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ without prior permission by the authors of Eressea.
|
|||
#include "bind_attrib.h"
|
||||
#include "bindings.h"
|
||||
|
||||
// attributes includes
|
||||
/* attributes includes */
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/key.h>
|
||||
|
||||
// kernel includes
|
||||
/* kernel includes */
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/faction.h>
|
||||
|
@ -37,7 +37,7 @@ without prior permission by the authors of Eressea.
|
|||
#include <kernel/spell.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
// util includes
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/base36.h>
|
||||
#include <util/event.h>
|
||||
|
@ -937,7 +937,7 @@ void tolua_unit_open(lua_State * L)
|
|||
tolua_function(L, TOLUA_CAST "clear_orders", &tolua_unit_clear_orders);
|
||||
tolua_variable(L, TOLUA_CAST "orders", &tolua_unit_get_orders, 0);
|
||||
|
||||
// key-attributes for named flags:
|
||||
/* key-attributes for named flags: */
|
||||
tolua_function(L, TOLUA_CAST "set_flag", &tolua_unit_set_flag);
|
||||
tolua_function(L, TOLUA_CAST "get_flag", &tolua_unit_get_flag);
|
||||
tolua_variable(L, TOLUA_CAST "flags", &tolua_unit_get_flags,
|
||||
|
@ -945,21 +945,21 @@ void tolua_unit_open(lua_State * L)
|
|||
tolua_variable(L, TOLUA_CAST "age", &tolua_unit_get_age,
|
||||
tolua_unit_set_age);
|
||||
|
||||
// items:
|
||||
/* items: */
|
||||
tolua_function(L, TOLUA_CAST "get_item", &tolua_unit_get_item);
|
||||
tolua_function(L, TOLUA_CAST "add_item", &tolua_unit_add_item);
|
||||
tolua_variable(L, TOLUA_CAST "items", &tolua_unit_get_items, 0);
|
||||
tolua_function(L, TOLUA_CAST "get_pooled", &tolua_unit_get_pooled);
|
||||
tolua_function(L, TOLUA_CAST "use_pooled", &tolua_unit_use_pooled);
|
||||
|
||||
// skills:
|
||||
/* skills: */
|
||||
tolua_function(L, TOLUA_CAST "get_skill", &tolua_unit_getskill);
|
||||
tolua_function(L, TOLUA_CAST "eff_skill", &tolua_unit_effskill);
|
||||
tolua_function(L, TOLUA_CAST "set_skill", &tolua_unit_setskill);
|
||||
|
||||
tolua_function(L, TOLUA_CAST "add_notice", &tolua_unit_addnotice);
|
||||
|
||||
// npc logic:
|
||||
/* npc logic: */
|
||||
tolua_function(L, TOLUA_CAST "add_handler", &tolua_unit_addhandler);
|
||||
|
||||
tolua_variable(L, TOLUA_CAST "race_name", &tolua_unit_get_racename,
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <bindings/bind_ship.h>
|
||||
#include <bindings/bind_storage.h>
|
||||
#include <bindings/bind_unit.h>
|
||||
#endif // BINDINGS_TOLUA
|
||||
#endif /* BINDINGS_TOLUA */
|
||||
|
||||
#if MUSEUM_MODULE
|
||||
#include <modules/museum.h>
|
||||
|
|
|
@ -731,7 +731,7 @@ static void
|
|||
growing_trees_e3(region * r, const int current_season,
|
||||
const int last_weeks_season)
|
||||
{
|
||||
const static int transform[4][3] = {
|
||||
static const int transform[4][3] = {
|
||||
{-1, -1, 0},
|
||||
{TREE_SEED, TREE_SAPLING, 2},
|
||||
{TREE_SAPLING, TREE_TREE, 2},
|
||||
|
|
|
@ -2400,7 +2400,7 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
rnl(F);
|
||||
nr_paragraph(F, m, f);
|
||||
}
|
||||
//
|
||||
/* */
|
||||
} else {
|
||||
if (!fval(r->terrain, SEA_REGION) && rpeasants(r) / TRADE_FRACTION > 0) {
|
||||
rnl(F);
|
||||
|
|
|
@ -754,7 +754,7 @@ static xmlNodePtr report_root(report_context * ctx)
|
|||
xmlAddChild(xmlReport, xml_region(ctx, sr));
|
||||
}
|
||||
return xmlReport;
|
||||
};
|
||||
}
|
||||
|
||||
/* main function of the xmlreport. creates the header and traverses all regions */
|
||||
static int
|
||||
|
|
|
@ -96,8 +96,8 @@ typedef struct alliance_transaction {
|
|||
struct alliance_transaction *next;
|
||||
unit *u;
|
||||
order *ord;
|
||||
// alliance * al;
|
||||
// variant userdata;
|
||||
/* alliance * al; */
|
||||
/* variant userdata; */
|
||||
} alliance_transaction;
|
||||
|
||||
static struct alliance_transaction *transactions[ALLIANCE_MAX];
|
||||
|
@ -321,9 +321,9 @@ void alliance_cmd(void)
|
|||
if (stree == NULL) {
|
||||
syntaxtree *slang = stree = stree_create();
|
||||
while (slang) {
|
||||
// struct tnode * root = calloc(sizeof(tnode), 1);
|
||||
/* struct tnode * root = calloc(sizeof(tnode), 1); */
|
||||
struct tnode *leaf = calloc(sizeof(tnode), 1);
|
||||
// add_command(root, leaf, LOC(slang->lang, "alliance"), NULL);
|
||||
/* add_command(root, leaf, LOC(slang->lang, "alliance"), NULL); */
|
||||
add_command(leaf, NULL, LOC(slang->lang, "new"), &cmd_new);
|
||||
add_command(leaf, NULL, LOC(slang->lang, "invite"), &cmd_invite);
|
||||
add_command(leaf, NULL, LOC(slang->lang, "join"), &cmd_join);
|
||||
|
|
|
@ -494,7 +494,9 @@ item *i_change(item ** pi, const item_type * itype, int delta)
|
|||
if (i->number < 0) {
|
||||
log_error(("serious accounting error. number of items is %d.\n",
|
||||
i->number));
|
||||
/* FIXME what's this supposed to mean??
|
||||
assert(i >= 0);
|
||||
*/
|
||||
i->number = 0;
|
||||
}
|
||||
if (i->number == 0) {
|
||||
|
|
|
@ -53,7 +53,7 @@ extern "C" {
|
|||
SPP_BUILDING, /* - : atoi() -> int */
|
||||
SPP_SHIP, /* - : atoi() -> int */
|
||||
SPP_STRING, /* "c" */
|
||||
SPP_INT, /* "i" : atoi() -> int */
|
||||
SPP_INT /* "i" : atoi() -> int */
|
||||
} sppobj_t;
|
||||
|
||||
typedef struct spllprm {
|
||||
|
|
|
@ -1141,7 +1141,7 @@ void seen_done(seen_region * seehash[])
|
|||
reuse = seehash[i];
|
||||
seehash[i] = NULL;
|
||||
}
|
||||
// free(seehash);
|
||||
/* free(seehash); */
|
||||
}
|
||||
|
||||
void free_seen(void)
|
||||
|
|
|
@ -22,7 +22,7 @@ extern "C" {
|
|||
#define SMF_RIDING (1<<2) /* Bonus für berittene - an der rasse */
|
||||
|
||||
typedef struct skill {
|
||||
skill_t id:8;
|
||||
unsigned int id:8;
|
||||
unsigned int level:8;
|
||||
unsigned int weeks:8;
|
||||
unsigned int old:8;
|
||||
|
|
|
@ -135,7 +135,7 @@ static int txt_open(struct storage *store, const char *filename, int mode)
|
|||
FILE *F = fopen(filename, modes[mode]);
|
||||
store->userdata = F;
|
||||
if (F) {
|
||||
const char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
|
||||
char utf8_bom[4] = { (char)0xef, (char)0xbb, (char)0xbf };
|
||||
if (mode == IO_READ) {
|
||||
char token[8];
|
||||
/* recognize UTF8 BOM */
|
||||
|
|
|
@ -1869,9 +1869,9 @@ static int parse_races(xmlDocPtr doc)
|
|||
assert(propValue != NULL);
|
||||
frc = rc_find((const char *)propValue);
|
||||
if (frc == NULL) {
|
||||
// log_error(("%s not registered, is familiar for %s\n",
|
||||
// (const char*)propValue, rc->_name[0]));
|
||||
// assert(frc!=NULL);
|
||||
/* log_error(("%s not registered, is familiar for %s\n", */
|
||||
/* (const char*)propValue, rc->_name[0])); */
|
||||
/* assert(frc!=NULL); */
|
||||
frc = rc_add(rc_new((const char *)propValue));
|
||||
}
|
||||
if (xml_bvalue(node, "default", false)) {
|
||||
|
|
|
@ -16,6 +16,8 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ escape_string_inplace(char * buffer, unsigned int len, unsigned int offset)
|
|||
}
|
||||
d[i] = o;
|
||||
if (i<MAXQUOTES) {
|
||||
// more than 32 hits! must go recursive
|
||||
// more than 32 hits! must go recursive
|
||||
char * start = d[i];
|
||||
unsigned int nlen = len - (start-buffer) - MAXQUOTES;
|
||||
escape_string_inplace(start, nlen, MAXQUOTES);
|
||||
|
@ -121,11 +121,11 @@ INLINE_FUNCTION unsigned int jenkins_hash(unsigned int a)
|
|||
|
||||
INLINE_FUNCTION unsigned int wang_hash(unsigned int a)
|
||||
{
|
||||
a = ~a + (a << 15); // a = (a << 15) - a - 1;
|
||||
a = ~a + (a << 15); /* a = (a << 15) - a - 1; */
|
||||
a = a ^ (a >> 12);
|
||||
a = a + (a << 2);
|
||||
a = a ^ (a >> 4);
|
||||
a = a * 2057; // a = (a + (a << 3)) + (a << 11);
|
||||
a = a * 2057; /* a = (a + (a << 3)) + (a << 11); */
|
||||
a = a ^ (a >> 16);
|
||||
return a;
|
||||
}
|
||||
|
|
|
@ -81,12 +81,12 @@ unicode_latin1_to_utf8(utf8_t * out, size_t * outlen, const char *in,
|
|||
if (c > 0xBF) {
|
||||
if (op - out >= os - 1)
|
||||
break;
|
||||
*op++ = 0xC3;
|
||||
*op++ = (char) 0xC3;
|
||||
*op++ = c - 64;
|
||||
} else if (c > 0x7F) {
|
||||
if (op - out >= os - 1)
|
||||
break;
|
||||
*op++ = 0xC2;
|
||||
*op++ = (char) 0xC2;
|
||||
*op++ = c;
|
||||
} else {
|
||||
if (op - out >= os)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
const xmlChar *xml_i(double number)
|
||||
{
|
||||
static char buffer[128];
|
||||
snprintf(buffer, sizeof(buffer), "%.0lf", number);
|
||||
snprintf(buffer, sizeof(buffer), "%.0f", number);
|
||||
return (const xmlChar *)buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue