----- David Maciejak <[email protected]> a écrit :
> Thanks Christophe for all these patches!
> 
> On a side note, i saw yesterday that WPrefs is using some fcts from
> WINGs/userdefaults.c, at least these 2:
> WMSetUDIntegerForKey and WMSetUDFloatForkey
> 
> The code looks the same for both fcts and are defining a buffer[128]
> and then use sprintf.
> It would be cleaner to adjust the size of the buffer and use snprintf
> instead. What's your thought ?

Hi,

Sorry for the late answer.

I had a look at the code you mentioned, and although it is true that it is not 
perfect, I'd tend to think it uses the best compromise in term of performance 
and simplicity, and the size of buffers may not be a problem: they are not 
really big, and not too small either (a reason why Coverity does not report 
anything there).

The only detail I'd see there being that using %f for float is likely to loose 
accuracy in the value stored if the number is more than a basic number, but as 
this function is not used anywhere it does not really matter...

Christophe.


> 
> regards,
> david
> 
> On Sun, Jun 1, 2014 at 1:58 AM, Christophe <[email protected]> wrote:
> > From: Christophe CURIS <[email protected]>
> >
> > Hello,
> >
> > This serie of patch fixes the code in WPrefs that are related
> > to these 13 bugs pointed by Coverity:
> >
> >  #50031: Unchecked return value
> >  #50073: Explicit null dereferenced
> >  #50098: Dereference null return value
> >  #50105: Resource leak
> >  #50107: Resource leak
> >  #50130: Resource leak
> >  #50140: Resource leak
> >  #50150: Resource leak
> >  #50156: Resource leak
> >  #50157: Resource leak
> >  #50158: Resource leak
> >  #50159: Resource leak
> >  #50200: Dereference before null check
> >
> > Christophe.
> >
> >
> >  WPrefs.app/Appearance.c     | 18 +++++++++++++-----
> >  WPrefs.app/Docks.c          |  7 ++++++-
> >  WPrefs.app/Focus.c          |  1 +
> >  WPrefs.app/Menu.c           | 15 ++++++++++-----
> >  WPrefs.app/MouseSettings.c  |  4 +++-
> >  WPrefs.app/Paths.c          |  8 +++++---
> >  WPrefs.app/TexturePanel.c   |  4 ++--
> >  WPrefs.app/WindowHandling.c | 13 +++++++++----
> >  WPrefs.app/editmenu.c       |  6 +-----
> >  WPrefs.app/xmodifier.c      | 11 ++++++++---
> >  10 files changed, 58 insertions(+), 29 deletions(-)
> >
> > --
> > 1.9.2
> >
> >
> > --
> > To unsubscribe, send mail to [email protected].


--
To unsubscribe, send mail to [email protected].

Reply via email to