Files
openstreetmap-mod_tile-pyth…/includes/request_queue.h
Hummeltech d6309f6316 Address compiler warnings (#376)
* `includes/config.h.in`
  * Wrap contents in `#ifndef CONFIG_H`
* `includes/mod_tile.h`
  * Include `protocol.h`
    * For `XMLCONFIG_MAX`
  * Include `apr_tables.h`
    * For `apr_array_header_t`/`apr_time_t`/`apr_uint64_t`
  * Include `netinet/in.h`
    * For `in6_addr`/`in_addr_t`
* `src/cache_expire.c`
  * Include `netinet/in.h`
    * For `htonl`/`htons`
* `src/gen_tile.cpp`
  * Use `snprintf` instead of `sprintf`
    * To resolve `warning: 'sprintf' is deprecated` in [`macOS` builds](https://github.com/openstreetmap/mod_tile/actions/runs/7590268635/job/20677236621#step:5:579)
* `src/gen_tile_test.cpp`
  * Use `snprintf` instead of `sprintf`
    * To resolve `warning: 'sprintf' is deprecated` in [`macOS` builds](https://github.com/openstreetmap/mod_tile/actions/runs/7590268635/job/20677236621#step:5:579)
* `src/mod_tile.c`
  * Use `snprintf` instead of `sprintf`
    * To resolve `warning: 'sprintf' is deprecated` in [`macOS` builds](https://github.com/openstreetmap/mod_tile/actions/runs/7590268635/job/20677236621#step:5:579)
  * Cast `os_thread` to `(unsigned long)` in `ap_log_rerror` calls format
    * To resolve `warning: format specifies type 'long' but the argument has type 'apr_os_thread_t'`
    * `os_thread` is an alias of `unsigned long`
  * Use `"%" APR_OFF_T_FMT`/`APR_UINT64_T_FMT "..."` to resolve warnings under `macOS`
    * To resolve `warning: format specifies type 'long' but the argument has type 'off_t'`
      * The format/type for `apr_off_t` varies under `macOS`
        * See [here](8e68a77f61/include/apr.h.in (L610-L645))
    * And resolve `warning: format specifies type 'long' but the argument has type 'apr_uint64_t'`
      * The format/type for `apr_uint64_t` varies under `macOS` 
        * See [here](8e68a77f61/include/apr.h.in (L610-L645))
  * Divide by `2.0` rather than `2`
    * To resolve `possible loss of precision` warning
  * Use `%li` rather than `"%" APR_TIME_T_FMT` as format for `maxAge`
    * It is defined as a `long int`
* `src/render_submit_queue.c`
  * Include `string.h`/`strings.h`
    * To resolve `warning: call to undeclared library function 'bzero'`
    * To resolve `warning: call to undeclared library function 'strncpy'`
    * To resolve `warning: call to undeclared library function 'strdup'`
    * To resolve `warning: call to undeclared library function 'strerror'`
    * To resolve `warning: call to undeclared library function 'strchr'`
    * To resolve `warning: call to undeclared library function 'strlen'`
    * To resolve `warning: call to undeclared library function 'memset'`
  * Cast `performance_stats.stat[i].noRendered` to `(float)`
    * To resolve `possible loss of precision` warning
* `src/renderd.c`
  * Use `snprintf` instead of `sprintf`
    * To resolve `warning: 'sprintf' is deprecated` in [`macOS` builds](https://github.com/openstreetmap/mod_tile/actions/runs/7590268635/job/20677236621#step:5:579)
  * Change `const char` to `char` for `ini_fileExtension`, `ini_mimeType`, `ini_outputFormat`
    * To resolve `warning: format specifies type 'char *' but the argument has type 'const char *'`
* `src/request_queue.c`
  * Add `default case` to `switch` statements
    * To resolve:
      * `warning: enumeration values 'queueRender' and 'queueDuplicate' not handled in switch`
      * `warning: enumeration values 'cmdIgnore', 'cmdDone', and 'cmdNotDone' not handled in switch`
* `src/store_file.c`
  * Cast `pthread_self()` to `(unsigned long)`
    * To resolve `warning: format specifies type 'unsigned long' but the argument has type 'pthread_t'`
* No longer need `CFLAGS=-Wno-implicit-function-declaration`
2024-01-30 09:42:38 -07:00

82 lines
2.2 KiB
C

/*
* Copyright (c) 2007 - 2023 by mod_tile contributors (see AUTHORS file)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
#ifndef REQUEST_QUEUE_H
#define REQUEST_QUEUE_H
#include "gen_tile.h"
#include "render_config.h"
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#define HASHIDX_SIZE 2213
typedef struct {
long noDirtyRender;
long noReqRender;
long noReqPrioRender;
long noReqLowRender;
long noReqBulkRender;
long noReqDroped;
long noZoomRender[MAX_ZOOM + 1];
long timeReqRender;
long timeReqPrioRender;
long timeReqLowRender;
long timeReqBulkRender;
long timeReqDirty;
long timeZoomRender[MAX_ZOOM + 1];
} stats_struct;
struct item_idx {
struct item_idx *next;
struct item *item;
};
struct request_queue {
int hashidxSize;
struct item reqHead, reqPrioHead, reqLowHead, reqBulkHead, dirtyHead, renderHead;
struct item_idx * item_hashidx;
int reqNum, reqPrioNum, reqLowNum, reqBulkNum, dirtyNum;
pthread_mutex_t qLock;
pthread_cond_t qCond;
stats_struct stats;
};
struct request_queue *request_queue_init();
void request_queue_close(struct request_queue * queue);
struct item *request_queue_fetch_request(struct request_queue * queue);
enum protoCmd request_queue_add_request(struct request_queue * queue, struct item * request);
void request_queue_remove_request(struct request_queue * queue, struct item * request, int render_time);
void request_queue_clear_requests_by_fd(struct request_queue * queue, int fd);
int request_queue_no_requests_queued(struct request_queue * queue, enum protoCmd);
void request_queue_copy_stats(struct request_queue * queue, stats_struct * stats);
#ifdef __cplusplus
}
#endif
#endif