[OpenSIPS-Devel] [OpenSIPS/opensips] 1e0b87: Fix format specifier warnings on 32-bit architectu...

Peter Lemenkov noreply at github.com
Tue May 12 14:26:52 UTC 2026


  Branch: refs/heads/3.6
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 1e0b8714cee2fc4bd55cb1efc7e5df934b890a0f
      https://github.com/OpenSIPS/opensips/commit/1e0b8714cee2fc4bd55cb1efc7e5df934b890a0f
  Author: Peter Lemenkov <lemenkov at gmail.com>
  Date:   2026-05-12 (Tue, 12 May 2026)

  Changed paths:
    M modules/aaa_diameter/dm_impl.c
    M modules/http2d/server.c

  Log Message:
  -----------
  Fix format specifier warnings on 32-bit architectures (i686) (#3791)

During compilation on i686 (32-bit) architecture with GCC 15, format
specifier warnings appear due to type size differences between 32-bit
and 64-bit platforms.

```
server.c: In function 'on_frame_recv_callback':
warning: format '%ld' expects argument of type 'long int', but argument 14
has type 'size_t' {aka 'unsigned int'} [-Wformat=]
  638 |  LM_DBG("h2 header [%d], %p %ld\n", frame->hd.type, frame->headers.nva, frame->headers.nvlen);

dm_impl.c: In function 'dm_avps2json':
warning: format '%ld' expects argument of type 'long int', but argument 15
has type 'int64_t' {aka 'long long int'} [-Wformat=]
  484 |  LM_DBG("%2d. got int64   AVP %s (%u), value: %ld\n", i, dm_avp.avp_name, h->avp_code, h->avp_value->i64);

warning: format '%lu' expects argument of type 'long unsigned int', but argument 15
has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
  494 |  LM_DBG("%2d. got uint64  AVP %s (%u), value: %lu\n", i, dm_avp.avp_name, h->avp_code, h->avp_value->u64);
```

Type sizes differ between 32-bit and 64-bit architectures:

**On x86_64 (64-bit):**
- `size_t` = `unsigned long` (8 bytes)
- `int64_t` = `long int` (8 bytes)

**On i686 (32-bit):**
- `size_t` = `unsigned int` (4 bytes)
- `int64_t` = `long long int` (8 bytes)
- `uint64_t` = `unsigned long long int` (8 bytes)

Use portable C99 format specifiers that work correctly on all
architectures:

- `%zu` for `size_t` (modules/http2d/server.c line 638)
- `%" PRId64` for `int64_t` (modules/aaa_diameter/dm_impl.c line 484)
- `%" PRIu64` for `uint64_t` (modules/aaa_diameter/dm_impl.c line 494)

Assisted-by: Claude (Anthropic) <https://claude.ai>

Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
(cherry picked from commit 672e4dd4d3338f4045fb8f914cf76b47d1a0a148)



To unsubscribe from these emails, change your notification settings at https://github.com/OpenSIPS/opensips/settings/notifications



More information about the Devel mailing list