diff --git a/include/psyc.h b/include/psyc.h index 1689ac7..7be4ff8 100644 --- a/include/psyc.h +++ b/include/psyc.h @@ -17,6 +17,14 @@ #ifndef PSYC_H #define PSYC_H +#ifdef __cplusplus +extern "C" +{ +#if 0 /* keep Emacsens' auto-indent happy */ +} +#endif +#endif + #include #include #include @@ -72,4 +80,11 @@ typedef struct { #include "psyc/text.h" #include "psyc/uniform.h" +#if 0 /* keep Emacsens' auto-indent happy */ +{ +#endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/psyc/match.h b/include/psyc/match.h index 8be0704..b3c8c11 100644 --- a/include/psyc/match.h +++ b/include/psyc/match.h @@ -45,8 +45,8 @@ psyc_map_lookup (const PsycMap *map, size_t size, * @see psyc_map_lookup */ static inline intptr_t -psyc_map_lookup_int (const PsycMapInt * map, size_t size, - const char *key, size_t keylen, PsycBool inherit) +psyc_map_lookup_int (const PsycMapInt *map, size_t size, + const char *key, size_t keylen, PsycBool inherit) { return (intptr_t) psyc_map_lookup((PsycMap *) map, size, key, keylen, inherit); } diff --git a/include/psyc/packet.h b/include/psyc/packet.h index 9f593a8..9cb04cd 100644 --- a/include/psyc/packet.h +++ b/include/psyc/packet.h @@ -256,17 +256,15 @@ psyc_modifier_init (PsycModifier *m, PsycOperator oper, char *name, size_t namelen, char *value, size_t valuelen, PsycModifierFlag flag) { - *m = (PsycModifier) { - .oper = oper, - .name = {namelen, name}, - .value = {valuelen, value}, - .flag = flag - }; + m->oper = oper; + m->name = (PsycString){namelen, name}; + m->value = (PsycString){valuelen, value}; + m->flag = flag; if (flag == PSYC_MODIFIER_CHECK_LENGTH) // find out if it needs a length m->flag = psyc_modifier_length_check(m); else if (flag & PSYC_MODIFIER_ROUTING) - m->flag |= PSYC_MODIFIER_NO_LENGTH; + m->flag = (PsycModifierFlag)(m->flag | PSYC_MODIFIER_NO_LENGTH); } /** diff --git a/include/psyc/parse.h b/include/psyc/parse.h index 01ea398..71c32b0 100644 --- a/include/psyc/parse.h +++ b/include/psyc/parse.h @@ -611,7 +611,7 @@ psyc_parse_content_length (PsycParseState *state) static inline PsycBool psyc_parse_content_length_found (PsycParseState *state) { - return state->contentlen_found; + return (PsycBool) state->contentlen_found; } static inline size_t @@ -623,7 +623,7 @@ psyc_parse_value_length (PsycParseState *state) static inline PsycBool psyc_parse_value_length_found (PsycParseState *state) { - return state->valuelen_found; + return (PsycBool) state->valuelen_found; } static inline size_t diff --git a/include/psyc/variable.h b/include/psyc/variable.h index b947829..6005aef 100644 --- a/include/psyc/variable.h +++ b/include/psyc/variable.h @@ -72,7 +72,8 @@ static inline PsycRoutingVar psyc_var_routing (const char *name, size_t len) { return (PsycRoutingVar) - psyc_map_lookup((PsycMap*)psyc_rvars, psyc_rvars_num, name, len, PSYC_NO); + psyc_map_lookup_int((PsycMapInt*)psyc_rvars, psyc_rvars_num, name, len, + PSYC_NO); } /** @@ -82,8 +83,8 @@ static inline PsycType psyc_var_type (const char *name, size_t len) { return (PsycType) - psyc_map_lookup((PsycMap*)psyc_var_types, psyc_var_types_num, - name, len, PSYC_YES); + psyc_map_lookup_int((PsycMapInt*)psyc_var_types, psyc_var_types_num, + name, len, PSYC_YES); } /**