From 573f51412b628a4f643b0227fdedeb104305007b Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Mon, 19 Jul 2010 11:12:12 -0400 Subject: [PATCH] Fix 64 bits warnings and issues --- plugins/logger/logger.c | 2 +- plugins/palm/palm.c | 4 ++-- src/config.c | 22 +++++++++++----------- src/iov.c | 2 +- src/plugin.c | 4 ++-- src/scheduler.c | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/plugins/logger/logger.c b/plugins/logger/logger.c index 19f21bf..42dea09 100644 --- a/plugins/logger/logger.c +++ b/plugins/logger/logger.c @@ -205,7 +205,7 @@ int _mkp_init(void **api, char *confdir) mk_logger_timeout = MK_LOGGER_TIMEOUT_DEFAULT; section = mk_api->config_section_get(mk_api->config->config, "LOGGER"); if (section) { - timeout = (int) mk_api->config_section_getval(section, + timeout = (size_t) mk_api->config_section_getval(section, "FlushTimeout", MK_CONFIG_VAL_NUM); if (timeout <= 0) { diff --git a/plugins/palm/palm.c b/plugins/palm/palm.c index d586b2b..621cf5d 100644 --- a/plugins/palm/palm.c +++ b/plugins/palm/palm.c @@ -82,8 +82,8 @@ int mk_palm_conf(char *confdir) new->server_addr = mk_api->config_section_getval(section, "ServerAddr", MK_CONFIG_VAL_STR); /* Palm server TCP port */ - new->server_port = (int) mk_api->config_section_getval(section, "ServerPort", - MK_CONFIG_VAL_NUM); + new->server_port = (size_t) mk_api->config_section_getval(section, "ServerPort", + MK_CONFIG_VAL_NUM); #ifdef TRACE PLUGIN_TRACE("RegPalm '%s|%s|%s|%i'", new->extension, new->mimetype, diff --git a/src/config.c b/src/config.c index 60d1a65..dc2b67d 100644 --- a/src/config.c +++ b/src/config.c @@ -324,7 +324,7 @@ void *mk_config_section_getval(struct mk_config_section *section, char *key, int case MK_CONFIG_VAL_STR: return (void *) entry->val; case MK_CONFIG_VAL_NUM: - return (void *) atoi(entry->val); + return (void *) (size_t) atoi(entry->val); case MK_CONFIG_VAL_BOOL: on = strcasecmp(entry->val, VALUE_ON); off = strcasecmp(entry->val, VALUE_OFF); @@ -388,7 +388,7 @@ void mk_config_read_files(char *path_conf, char *file_conf) } /* Connection port */ - config->serverport = (int) mk_config_section_getval(section, + config->serverport = (size_t) mk_config_section_getval(section, "Port", MK_CONFIG_VAL_NUM); if (!config->serverport >= 1 && !config->serverport <= 65535) { @@ -396,7 +396,7 @@ void mk_config_read_files(char *path_conf, char *file_conf) } /* Number of thread workers */ - config->workers = (int) mk_config_section_getval(section, + config->workers = (size_t) mk_config_section_getval(section, "Workers", MK_CONFIG_VAL_NUM); if (config->workers < 1) { @@ -406,14 +406,14 @@ void mk_config_read_files(char *path_conf, char *file_conf) config->worker_capacity = mk_server_worker_capacity(config->workers); /* Timeout */ - config->timeout = (int) mk_config_section_getval(section, + config->timeout = (size_t) mk_config_section_getval(section, "Timeout", MK_CONFIG_VAL_NUM); if (config->timeout < 1) { mk_config_print_error_msg("Timeout", path); } /* KeepAlive */ - config->keep_alive = (int) mk_config_section_getval(section, + config->keep_alive = (size_t) mk_config_section_getval(section, "KeepAlive", MK_CONFIG_VAL_BOOL); if (config->keep_alive == VAR_ERR) { @@ -421,7 +421,7 @@ void mk_config_read_files(char *path_conf, char *file_conf) } /* MaxKeepAliveRequest */ - config->max_keep_alive_request = (int) + config->max_keep_alive_request = (size_t) mk_config_section_getval(section, "MaxKeepAliveRequest", MK_CONFIG_VAL_NUM); @@ -431,7 +431,7 @@ void mk_config_read_files(char *path_conf, char *file_conf) } /* KeepAliveTimeout */ - config->keep_alive_timeout = (int) mk_config_section_getval(section, + config->keep_alive_timeout = (size_t) mk_config_section_getval(section, "KeepAliveTimeout", MK_CONFIG_VAL_NUM); if (config->keep_alive_timeout == 0) { @@ -451,7 +451,7 @@ void mk_config_read_files(char *path_conf, char *file_conf) "Indexfile", MK_CONFIG_VAL_LIST); /* HideVersion Variable */ - config->hideversion = (int) mk_config_section_getval(section, + config->hideversion = (size_t) mk_config_section_getval(section, "HideVersion", MK_CONFIG_VAL_BOOL); if (config->hideversion == VAR_ERR) { @@ -462,14 +462,14 @@ void mk_config_read_files(char *path_conf, char *file_conf) config->user = mk_config_section_getval(section, "User", MK_CONFIG_VAL_STR); /* Resume */ - config->resume = (int) mk_config_section_getval(section, + config->resume = (size_t) mk_config_section_getval(section, "Resume", MK_CONFIG_VAL_BOOL); if (config->resume == VAR_ERR) { mk_config_print_error_msg("Resume", path); } /* Max Request Size */ - config->max_request_size = (int) mk_config_section_getval(section, + config->max_request_size = (size_t) mk_config_section_getval(section, "MaxRequestSize", MK_CONFIG_VAL_NUM); if (config->max_request_size <= 0) { @@ -480,7 +480,7 @@ void mk_config_read_files(char *path_conf, char *file_conf) } /* Symbolic Links */ - config->symlink = (int) mk_config_section_getval(section, + config->symlink = (size_t) mk_config_section_getval(section, "SymLink", MK_CONFIG_VAL_BOOL); if (config->symlink == VAR_ERR) { mk_config_print_error_msg("SymLink", path); diff --git a/src/iov.c b/src/iov.c index 1701b16..d013def 100644 --- a/src/iov.c +++ b/src/iov.c @@ -176,7 +176,7 @@ void mk_iov_print(struct mk_iov *mk_io) char *c; for (i = 0; i < mk_io->iov_idx; i++) { - printf("\n[index=%i len=%i]\n '", i, mk_io->io[i].iov_len); + printf("\n[index=%i len=%i]\n '", i, (int) mk_io->io[i].iov_len); fflush(stdout); for (j=0; j < mk_io->io[i].iov_len; j++) { c = mk_io->io[i].iov_base; diff --git a/src/plugin.c b/src/plugin.c index 08d2329..9ab1dd3 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -195,7 +195,7 @@ struct plugin *mk_plugin_alloc(void *handler, char *path) mk_plugin_load_symbol(handler, "_mkp_network_ip_maxlen"); /* Thread key */ - p->thread_key = (pthread_key_t) mk_plugin_load_symbol(handler, "_mkp_data"); + p->thread_key = (size_t) mk_plugin_load_symbol(handler, "_mkp_data"); /* Event handlers hooks */ p->event_read = (int (*)()) @@ -710,7 +710,7 @@ void mk_plugin_preworker_calls() #ifdef TRACE MK_TRACE("[%s] Set thread key", p->shortname); #endif - ret = pthread_key_create((void *)p->thread_key, NULL); + ret = pthread_key_create(&p->thread_key, NULL); if (ret != 0) { printf("\nPlugin Error: could not create key for %s", p->shortname); diff --git a/src/scheduler.c b/src/scheduler.c index 1f2c448..578bf4d 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -171,12 +171,12 @@ void mk_sched_set_request_index(struct request_idx *ri) void mk_sched_set_thread_poll(int epoll) { - pthread_setspecific(epoll_fd, (void *) epoll); + pthread_setspecific(epoll_fd, (void *) (size_t) epoll); } int mk_sched_get_thread_poll() { - return (int) pthread_getspecific(epoll_fd); + return (size_t) pthread_getspecific(epoll_fd); } struct sched_list_node *mk_sched_get_thread_conf() -- 2.11.4.GIT