Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ptimec.hh compile warning: format %lld expects argument of type long long int, but argument 4 has type uint64_t #368

Closed
aspiers opened this issue Nov 19, 2016 · 1 comment

Comments

@aspiers
Copy link
Contributor

aspiers commented Nov 19, 2016

When compiling from git master, I get this compile-time warning repeated lots of times:

In file included from lnav_util.hh:50:0,
                 from log_format.hh:53,
                 from logfile.hh:48,
                 from lnav.hh:46,
                 from readline_possibilities.cc:36:
ptimec.hh: In function ‘void ftime_i(char*, off_t&, ssize_t, const exttm&)’:
ptimec.hh:387:57: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
     snprintf(&dst[off_inout], len - off_inout, "%lld", t);
                                                         ^
aspiers added a commit to aspiers/lnav that referenced this issue Nov 20, 2016
Fix warnings like:

    ptimec.hh: In function ‘void ftime_i(char*, off_t&, ssize_t, const exttm&)’:
    ptimec.hh:387:57: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
         snprintf(&dst[off_inout], len - off_inout, "%lld", t);
                                                             ^

In this case we know that the `t` returned by `tm2sec` is a number of
seconds, so a long should be long enough, and anyway there is already
code checking for overflow.

Fixes tstack#368.

tstack#368
@aspiers
Copy link
Contributor Author

aspiers commented Nov 21, 2016

Hopefully fixed by #379.

@tstack tstack closed this as completed in 43ac636 Dec 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant