[Home]

Summary:ASTERISK-04552: [change request] be careful with printf format specifiers.
Reporter:Luigi Rizzo (rizzo)Labels:
Date Opened:2005-07-10 17:36:38Date Closed:2011-06-07 14:10:30
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:recent changes to apps/app_sms.c and apps/app_readfile.c to silence the compiler
on 64 bit platforms introduced the 'z' format modifier in a couple of places.
For what matters, this breaks compilation on FreeBSD 4.x unless one
introduces a dependency on gcc 3.x

While i understand that in some cases it is unavoidable to use
new compiler or library features, this is certainly not one of them -- one instance was simply a sizeof(var)/sizeof(type),
which can be safely cast to an int or uint, and the other was a similarly
trivial strlen().

So in the interest of portability I suggest to  revert back these changes
and cast the argument instead.

****** ADDITIONAL INFORMATION ******

no patch attached because it is 2 lines. And more than the patch,
it is the principle that i care about.
Actually, maybe we could add the above notes to the coding guidelines!
Comments:By: Tilghman Lesher (tilghman) 2005-07-10 23:34:54

All requested changes require a patch, even if the patch is so insignificant as to require no disclaimer.

Please.  :-)

By: Luigi Rizzo (rizzo) 2005-07-11 14:55:06

clearly the message is not getting through, isn't it ? :)

   "no patch attached because it is 2 lines. And more than the patch,
   it is the principle that i care about.
   Actually, maybe we could add the above notes to the coding guidelines!"

By: Tilghman Lesher (tilghman) 2005-07-11 15:24:06

Reopen when you're ready to provide a patch.

By: Kevin P. Fleming (kpfleming) 2005-07-11 15:41:22

We have already publicly stated a dependency on gcc 3.x or above, especially with gcc 4.x now being the 'stable' and current release. While we have not yet enforced it, I doubt we are going to make code changes for the sole reason of preserving gcc 2.95.x compatibility.