[Tile-serving] [openstreetmap/mod_tile] Address compiler warnings (PR #376)

Hummeltech notifications at github.com
Sat Jan 20 04:35:23 UTC 2024


* `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_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`
    * 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` 
  * 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'`
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/mod_tile/pull/376

-- Commit Summary --

  * Wrap config.h contents
  * Cast `pthread_self()` to `unsigned long`
  * Cast `os_thread` to `unsigned long`
  * Include `string.h`/`strings.h` to resolve `undeclared library function`
  * Include `netinet/in.h` for `htons`/`htonl`
  * Include `netinet/in.h` for `in6_addr`/`in_addr_t`
  * Include `protocol.h` for `XMLCONFIG_MAX`
  * Include `apr_tables.h` for `apr_*`
  * Resolve `warning: format specifies type 'char *' but the argument has type 'const char *'`
  * Resolve `warning: enumeration values ... not handled in switch`
  * Resolve `warning: format specifies type 'long' but the argument has type 'apr_uint64_t'`
  * Resolve `warning: format specifies type 'long long' but the argument has type 'long'`
  * Resolve `warning: format specifies type 'long' but the argument has type 'off_t'`
  * Resolve `warning: 'sprintf' is deprecated`
  * Resolve loss of precision
  * Don't need `-Wno-implicit-function-declaration`

-- File Changes --

    M .github/workflows/build-and-test.yml (1)
    M includes/config.h.in (3)
    M includes/mod_tile.h (3)
    M src/cache_expire.c (1)
    M src/gen_tile.cpp (2)
    M src/gen_tile_test.cpp (2)
    M src/mod_tile.c (92)
    M src/render_submit_queue.c (4)
    M src/renderd.c (8)
    M src/request_queue.c (6)
    M src/store_file.c (2)

-- Patch Links --

https://github.com/openstreetmap/mod_tile/pull/376.patch
https://github.com/openstreetmap/mod_tile/pull/376.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/mod_tile/pull/376
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/mod_tile/pull/376 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20240119/c659b417/attachment.htm>


More information about the Tile-serving mailing list