Changeset 156

Show
Ignore:
Timestamp:
09/04/07 14:40:58 (20 months ago)
Author:
smoku
Message:

Integrated compilation fixes by Stefan Huehner. Closes #51

Location:
trunk
Files:
21 modified

Legend:

Unmodified
Added
Removed
  • trunk/c2s/authreg.c

    r153 r156  
    5454#endif 
    5555 
    56 char *module_names[] = { 
     56static const char *module_names[] = { 
    5757#ifdef STORAGE_MYSQL 
    5858    "mysql", 
  • trunk/c2s/authreg_mysql.c

    r2 r156  
    320320 
    321321/** Provide a configuration parameter or default value. */ 
    322 char * _ar_mysql_param( config_t c, char * key, char * def ) { 
     322static char * _ar_mysql_param( config_t c, char * key, char * def ) { 
    323323    char * value = config_get_one( c, key, 0 ); 
    324324    if( value == NULL ) 
     
    333333/* expected to follow the escape characters '%' in the template. */ 
    334334/* Returns 0 on success, or an error message on failures. */ 
    335 char * _ar_mysql_check_template( char * template, char * types ) { 
     335static char * _ar_mysql_check_template( char * template, char * types ) { 
    336336    int pScan = 0; 
    337337    int pType = 0; 
     
    369369/* written to the error log. */ 
    370370/* Returns 0 on success, or 1 on errors. */ 
    371 int _ar_mysql_check_sql( authreg_t ar, char * sql, char * types ) { 
     371static int _ar_mysql_check_sql( authreg_t ar, char * sql, char * types ) { 
    372372  char * error; 
    373373 
  • trunk/router/aci.c

    r2 r156  
    9292 
    9393/** see if a username is in an acl */ 
    94 int aci_check(xht aci, char *type, char *name) { 
     94int aci_check(xht aci, const char *type, const char *name) { 
    9595    aci_user_t list, scan; 
    9696 
  • trunk/router/main.c

    r93 r156  
    2424static sig_atomic_t router_logrotate = 0; 
    2525 
    26 void router_signal(int signum) 
     26static void router_signal(int signum) 
    2727{ 
    2828    router_shutdown = 1; 
    2929} 
    3030 
    31 void router_signal_hup(int signum) 
     31static void router_signal_hup(int signum) 
    3232{ 
    3333    router_logrotate = 1; 
  • trunk/router/router.h

    r141 r156  
    202202xht     aci_load(router_t r); 
    203203void    aci_unload(xht aci); 
    204 int     aci_check(xht acls, char *type, char *name); 
     204int     aci_check(xht acls, const char *type, const char *name); 
    205205 
    206206int     user_table_load(router_t r); 
  • trunk/sm/mod_iq_vcard.c

    r4 r156  
    4343 */ 
    4444 
    45 static char *_iq_vcard_map[] = { 
     45static const char *_iq_vcard_map[] = { 
    4646    "FN",           "fn", 
    4747    "NICKNAME",     "nickname", 
     
    9898    os_object_t o; 
    9999    int i = 0, elem; 
    100     char *vkey, *dkey, *vskey, ekey[10], cdata[VCARD_MAX_FIELD_SIZE]; 
     100    char ekey[10], cdata[VCARD_MAX_FIELD_SIZE]; 
     101    const char *vkey, *dkey, *vskey; 
    101102 
    102103    log_debug(ZONE, "building object from packet"); 
     
    141142    os_object_t o; 
    142143    int i = 0, elem; 
    143     char *vkey, *dkey, *vskey, ekey[10], *dval; 
     144    char ekey[10], *dval; 
     145    const char *vkey, *dkey, *vskey; 
    144146     
    145147    log_debug(ZONE, "building packet from object"); 
  • trunk/sm/pres.c

    r22 r156  
    3838 
    3939/** select a new top session based on current session presence */ 
    40 void _pres_top(user_t user) { 
     40static void _pres_top(user_t user) { 
    4141    sess_t scan; 
    4242 
  • trunk/sm/storage.c

    r14 r156  
    5353#endif 
    5454 
    55 static char *st_driver_names[] = { 
     55static const char *st_driver_names[] = { 
    5656#ifdef STORAGE_DB 
    5757    "db", 
     
    472472} 
    473473 
    474 int _storage_match(st_filter_t f, os_object_t o, os_t os) { 
     474static int _storage_match(st_filter_t f, os_object_t o, os_t os) { 
    475475    void *val; 
    476476    os_type_t ot; 
  • trunk/sx/error.c

    r2 r156  
    2222 
    2323/** if you change these, reflect your changes in the defines in sx.h */ 
    24 static char *_stream_errors[] = { 
     24static const char *_stream_errors[] = { 
    2525    "bad-format", 
    2626    "bad-namespace-prefix", 
     
    5151 
    5252/** send an error */ 
    53 void _sx_error(sx_t s, int err, char *text) { 
     53void _sx_error(sx_t s, int err, const char *text) { 
    5454    int len = 0; 
    5555    sx_buf_t buf; 
     
    8686} 
    8787 
    88 void sx_error(sx_t s, int err, char *text) { 
     88void sx_error(sx_t s, int err, const char *text) { 
    8989    assert(s != NULL); 
    9090    assert(err >= 0 && err < stream_err_LAST); 
  • trunk/sx/ssl.h

    r55 r156  
    2626#ifdef HAVE_SSL 
    2727 
     28#include <openssl/md5.h> 
    2829#include <openssl/ssl.h> 
    2930#include <openssl/err.h> 
  • trunk/sx/sx.c

    r141 r156  
    200200   of garbage, to be overwritten by caller. otherwise, data pointed to 
    201201   by 'data' will be copied into buf */ 
    202 sx_buf_t _sx_buffer_new(char *data, int len, _sx_notify_t notify, void *notify_arg) { 
     202sx_buf_t _sx_buffer_new(const char *data, int len, _sx_notify_t notify, void *notify_arg) { 
    203203    sx_buf_t buf; 
    204204 
     
    298298 
    299299/** debug macro helpers */ 
    300 void __sx_debug(char *file, int line, const char *msgfmt, ...) { 
     300void __sx_debug(const char *file, int line, const char *msgfmt, ...) { 
    301301    va_list ap; 
    302302    char *pos, message[MAX_DEBUG]; 
     
    316316} 
    317317 
    318 int __sx_event(char *file, int line, sx_t s, sx_event_t e, void *data) { 
     318int __sx_event(const char *file, int line, sx_t s, sx_event_t e, void *data) { 
    319319    int ret; 
    320320 
  • trunk/sx/sx.h

    r78 r156  
    167167 
    168168/* send errors and close stuff */ 
    169 void                        sx_error(sx_t s, int err, char *text); 
     169void                        sx_error(sx_t s, int err, const char *text); 
    170170void                        sx_close(sx_t s); 
    171171void                        sx_kill(sx_t s); 
     
    198198 
    199199/* buffer utilities */ 
    200 sx_buf_t                     _sx_buffer_new(char *data, int len, _sx_notify_t notify, void *notify_arg); 
     200sx_buf_t                     _sx_buffer_new(const char *data, int len, _sx_notify_t notify, void *notify_arg); 
    201201void                        _sx_buffer_free(sx_buf_t buf); 
    202202void                        _sx_buffer_clear(sx_buf_t buf); 
     
    214214 
    215215/* send errors and close stuff */ 
    216 void                        _sx_error(sx_t s, int err, char *text); 
     216void                        _sx_error(sx_t s, int err, const char *text); 
    217217void                        _sx_close(sx_t s); 
    218218 
     
    348348 
    349349/** helper functions for macros when we're debugging */ 
    350 void        __sx_debug(char *file, int line, const char *msgfmt, ...); 
     350void        __sx_debug(const char *file, int line, const char *msgfmt, ...); 
    351351 
    352352/** helper and internal macro for firing the callback */ 
    353 int         __sx_event(char *file, int line, sx_t s, sx_event_t e, void *data); 
     353int         __sx_event(const char *file, int line, sx_t s, sx_event_t e, void *data); 
    354354#define _sx_event(s,e,data) __sx_event(ZONE, s, e, data) 
    355355 
  • trunk/util/config.c

    r77 r156  
    7373 
    7474/** turn an xml file into a config hash */ 
    75 int config_load(config_t c, char *file) 
     75int config_load(config_t c, const char *file) 
    7676{ 
    7777    struct build_data bd; 
     
    233233 
    234234/** get the config element for this key */ 
    235 config_elem_t config_get(config_t c, char *key) 
     235config_elem_t config_get(config_t c, const char *key) 
    236236{ 
    237237    return xhash_get(c->hash, key); 
     
    239239 
    240240/** get config value n for this key */ 
    241 char *config_get_one(config_t c, char *key, int num) 
     241char *config_get_one(config_t c, const char *key, int num) 
    242242{ 
    243243    config_elem_t elem = xhash_get(c->hash, key); 
     
    253253 
    254254/** how many values for this key? */ 
    255 int config_count(config_t c, char *key) 
     255int config_count(config_t c, const char *key) 
    256256{ 
    257257    config_elem_t elem = xhash_get(c->hash, key); 
     
    264264 
    265265/** get an attr for this value */ 
    266 char *config_get_attr(config_t c, char *key, int num, char *attr) 
     266char *config_get_attr(config_t c, const char *key, int num, const char *attr) 
    267267{ 
    268268    config_elem_t elem = xhash_get(c->hash, key); 
  • trunk/util/jid.c

    r141 r156  
    8080 
    8181/** do stringprep on the pieces */ 
    82 int jid_prep_pieces(prep_cache_t pc, char *node, char *domain, char *resource) { 
     82static int jid_prep_pieces(prep_cache_t pc, char *node, char *domain, char *resource) { 
    8383#ifdef HAVE_IDN 
    8484    char str[1024], *prep; 
  • trunk/util/log.c

    r44 r156  
    5151}; 
    5252 
    53 static int _log_facility(char *facility) { 
     53static int _log_facility(const char *facility) { 
    5454    log_facility_t *lp; 
    5555 
     
    6565} 
    6666 
    67 log_t log_new(log_type_t type, char *ident, char *facility) 
     67log_t log_new(log_type_t type, const char *ident, const char *facility) 
    6868{ 
    6969    log_t log; 
     
    171171#ifdef DEBUG 
    172172/** debug logging */ 
    173 void debug_log(char *file, int line, const char *msgfmt, ...) 
     173void debug_log(const char *file, int line, const char *msgfmt, ...) 
    174174{ 
    175175    va_list ap; 
  • trunk/util/nad.c

    r93 r156  
    6666 
    6767/** internal: do and return the math and ensure it gets realloc'd */ 
    68 int _nad_realloc(void **oblocks, int len) 
     68static int _nad_realloc(void **oblocks, int len) 
    6969{ 
    7070    void *nblocks; 
     
    8484 
    8585/** internal: append some cdata and return the index to it */ 
    86 int _nad_cdata(nad_t nad, const char *cdata, int len) 
     86static int _nad_cdata(nad_t nad, const char *cdata, int len) 
    8787{ 
    8888    NAD_SAFE(nad->cdata, nad->ccur + len, nad->clen); 
     
    9494 
    9595/** internal: create a new attr on any given elem */ 
    96 int _nad_attr(nad_t nad, int elem, int ns, const char *name, const char *val, int vallen) 
     96static int _nad_attr(nad_t nad, int elem, int ns, const char *name, const char *val, int vallen) 
    9797{ 
    9898    int attr; 
     
    842842} 
    843843 
    844 void _nad_escape(nad_t nad, int data, int len, int flag) 
     844static void _nad_escape(nad_t nad, int data, int len, int flag) 
    845845{ 
    846846    char *c; 
     
    930930 
    931931/** internal recursive printing function */ 
    932 int _nad_lp0(nad_t nad, int elem) 
     932static int _nad_lp0(nad_t nad, int elem) 
    933933{ 
    934934    int attr; 
  • trunk/util/pool.c

    r2 r156  
    7070 
    7171/** free a heap */ 
    72 void _pool_heap_free(void *arg) 
     72static void _pool_heap_free(void *arg) 
    7373{ 
    7474    struct pheap *h = (struct pheap *)arg; 
     
    7979 
    8080/** mem should always be freed last */ 
    81 void _pool_cleanup_append(pool p, struct pfree *pf) 
     81static void _pool_cleanup_append(pool p, struct pfree *pf) 
    8282{ 
    8383    struct pfree *cur; 
     
    9797 
    9898/** create a cleanup tracker */ 
    99 struct pfree *_pool_free(pool p, pool_cleaner f, void *arg) 
     99static struct pfree *_pool_free(pool p, pool_cleaner f, void *arg) 
    100100{ 
    101101    struct pfree *ret; 
     
    111111 
    112112/** create a heap and make sure it get's cleaned up */ 
    113 struct pheap *_pool_heap(pool p, int size) 
     113static struct pheap *_pool_heap(pool p, int size) 
    114114{ 
    115115    struct pheap *ret; 
  • trunk/util/str.c

    r2 r156  
    9292} 
    9393 
    94 char *j_attr(const char** atts, char *attr) 
     94char *j_attr(const char** atts, const char *attr) 
    9595{ 
    9696    int i = 0; 
     
    128128} 
    129129 
    130 void _spool_add(spool s, char *goodstr) 
     130static void _spool_add(spool s, char *goodstr) 
    131131{ 
    132132    struct spool_node *sn; 
     
    354354} 
    355355 
    356 char *zonestr(char *file, int line) 
     356static char *zonestr(char *file, int line) 
    357357{ 
    358358    static char buff[64]; 
  • trunk/util/util.h

    r90 r156  
    162162int j_strlen(const char *a); /* provides NULL safe strlen wrapper */ 
    163163int j_atoi(const char *a, int def); /* checks for NULL and uses default instead, convienence */ 
    164 char *j_attr(const char** atts, char *attr); /* decode attr's (from expat) */ 
     164char *j_attr(const char** atts, const char *attr); /* decode attr's (from expat) */ 
    165165char *j_strnchr(const char *s, int c, int n); /* like strchr, but only searches n chars */ 
    166166 
     
    399399typedef struct log_facility_st 
    400400{ 
    401     char        *facility; 
     401    const char  *facility; 
    402402    int         number; 
    403403} log_facility_t; 
    404404 
    405 extern log_t    log_new(log_type_t type, char *ident, char *facility); 
     405extern log_t    log_new(log_type_t type, const char *ident, const char *facility); 
    406406extern void     log_write(log_t log, int level, const char *msgfmt, ...); 
    407407extern void     log_free(log_t log); 
     
    572572 
    573573extern config_t         config_new(void); 
    574 extern int              config_load(config_t c, char *file); 
    575 extern config_elem_t    config_get(config_t c, char *key); 
    576 extern char             *config_get_one(config_t c, char *key, int num); 
    577 extern int              config_count(config_t c, char *key); 
    578 extern char             *config_get_attr(config_t c, char *key, int num, char *attr); 
     574extern int              config_load(config_t c, const char *file); 
     575extern config_elem_t    config_get(config_t c, const char *key); 
     576extern char             *config_get_one(config_t c, const char *key, int num); 
     577extern int              config_count(config_t c, const char *key); 
     578extern char             *config_get_attr(config_t c, const char *key, int num, const char *attr); 
    579579extern void             config_free(config_t); 
    580580 
     
    731731 
    732732typedef struct _stanza_error_st { 
    733     char        *name; 
    734     char        *type; 
    735     char        *code; 
     733    const char  *name; 
     734    const char  *type; 
     735    const char  *code; 
    736736} *stanza_error_t; 
    737737 
     
    776776int get_debug_flag(void); 
    777777void set_debug_flag(int v); 
    778 void debug_log(char *file, int line, const char *msgfmt, ...); 
     778void debug_log(const char *file, int line, const char *msgfmt, ...); 
    779779#define ZONE __FILE__,__LINE__ 
    780780#define MAX_DEBUG 8192 
  • trunk/util/xdata.c

    r141 r156  
    134134 
    135135/** option insertion */ 
    136 void xdata_option_new(xdata_field_t xdf, char *value, int lvalue, char *label, int llabel) { 
     136static void xdata_option_new(xdata_field_t xdf, char *value, int lvalue, char *label, int llabel) { 
    137137    xdata_option_t xdo; 
    138138 
  • trunk/util/xhash.c

    r2 r156  
    2626 * Andrew Binstock, "Hashing Rehashed," Dr. Dobb's Journal, April 1996. 
    2727 */ 
    28 int _xhasher(const char *s, int len) 
     28static int _xhasher(const char *s, int len) 
    2929{ 
    3030    /* ELF hash uses unsigned chars and unsigned arithmetic for portability */ 
     
    4646 
    4747 
    48 xhn _xhash_node_new(xht h, int index) 
     48static xhn _xhash_node_new(xht h, int index) 
    4949{ 
    5050    xhn n; 
     
    6767 
    6868 
    69 xhn _xhash_node_get(xht h, const char *key, int len, int index) 
     69static xhn _xhash_node_get(xht h, const char *key, int len, int index) 
    7070{ 
    7171    xhn n;