On Sat, Feb 17, 2018 at 5:58 AM, Alexander Traud <[email protected]> wrote:
> While compiling Asterisk on OpenBSD, I get a lot of warnings about the > usage of data-type time_t, when used in combination with printf/scanf, > for example in the file res_http_media_cache.c: > > struct timeval actual_expires = ast_tvnow(); // gettimeofday(&t, NULL); > snprintf(time_buf, sizeof(time_buf), "%30lu", actual_expires.tv_sec); > > On the Internet, there are a lot of suggestions, like > <http://stackoverflow.com/q/27057677>. Which approach does the Asterisk > team prefer? Or should I create a new issue report with all findings so > that somebody else can look into each of those? > As that link shows there is no good way to do it. You just have to settle for a portable enough way. Nor is there an "official" Asterisk way. You probably could search the Asterisk code and find an example of all those suggestions. Usually, I have just cast the value to match an appropriate printf format specifier to head off nuisance compiler messages. However, even with the casts I just saw on another related stackoverflow page some compilers are stupid enough to still complain. Richard
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
