Re: [Patch] More static analysis and resulting fixes: cppcheck

2010-02-17 Thread Enrico Forestieri
On Thu, Feb 18, 2010 at 12:08:37AM +0800, John McCabe-Dansted wrote: > On Sun, Feb 14, 2010 at 11:27 PM, John McCabe-Dansted > wrote: > > http://gmatht.homelinux.net/xp/lyx/cppcheck/ > > Attached is a possible fix for: > > [./src/support/os_cygwin.cpp:181]: (error) Mismatching allocation and >

Re: [Patch] More static analysis and resulting fixes: cppcheck

2010-02-17 Thread John McCabe-Dansted
On Sun, Feb 14, 2010 at 11:27 PM, John McCabe-Dansted wrote: > http://gmatht.homelinux.net/xp/lyx/cppcheck/ Attached is a possible fix for: [./src/support/os_cygwin.cpp:181]: (error) Mismatching allocation and deallocation: ptr Does it look right? -- John C. McCabe-Dansted Index: lyx/src/su

Re: [Patch] More static analysis and resulting fixes: cppcheck

2010-02-15 Thread John McCabe-Dansted
On Mon, Feb 15, 2010 at 2:49 PM, Pavel Sanda wrote: > John McCabe-Dansted wrote: >> Well, Jürgen also prefers ++i to  i++, at least in new code being >> submitted to LyX. > > we have such advice in lyx coding rules, thats true and i understand its usage > for non-POD objects, anyway using it in in

Re: [Patch] More static analysis and resulting fixes: cppcheck

2010-02-14 Thread Pavel Sanda
John McCabe-Dansted wrote: > Well, Jürgen also prefers ++i to i++, at least in new code being > submitted to LyX. we have such advice in lyx coding rules, thats true and i understand its usage for non-POD objects, anyway using it in int loops somewhat catches the eyes. no to speak that i had to t

Re: [Patch] More static analysis and resulting fixes: cppcheck

2010-02-14 Thread John McCabe-Dansted
On Mon, Feb 15, 2010 at 11:54 AM, Pavel Sanda wrote: > i fail to see why > for (int i = 0; i < count; i++) > is better than > for (int i = 0; i < count; ++i) Well, Jürgen also prefers ++i to i++, at least in new code being submitted to LyX. Whether it is worth patching old code is another issue

Re: [Patch] More static analysis and resulting fixes: cppcheck

2010-02-14 Thread Pavel Sanda
John McCabe-Dansted wrote: > I ran cppcheck on the LyX codebase. I got a number of style warnings > about ++i being better than i++. The attached patch fixes these > warnings, the patch was generated by the attached > post2pre_increment.sh. i fail to see why for (int i = 0; i < count; i++) is bett

[Patch] More static analysis and resulting fixes: cppcheck

2010-02-14 Thread John McCabe-Dansted
I ran cppcheck on the LyX codebase. I got a number of style warnings about ++i being better than i++. The attached patch fixes these warnings, the patch was generated by the attached post2pre_increment.sh. The following two bugs are fixed in leak_brace.patch (attached) [./development/lyxserver/ser