Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • L libcmatrix
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.

  • Librem5
  • libcmatrix
  • Merge requests
  • !32

enc: Use proper format specifier for size_t

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Newbyte requested to merge Newbyte/libcmatrix:fix-32-bit-build into main Sep 25, 2022
  • Overview 1
  • Commits 1
  • Pipelines 1
  • Changes 1

%lu, meaning long unsigned int, works fine on 64-bit architectures as it happens to be the same size as unsigned size_t there (both are 8 bytes), but on for instance 32-bit systems, unsigned size_t is half the size, 4 bytes, and as such this format specifier is not correct. This matters because the type returned by cm_olm_get_message_index is unsigned size_t and not unsigned long int. Replace it with %zu (unsigned size_t) which should work on any architecture.

Reference: https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-170

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: fix-32-bit-build