[haiku-commits] Re: haiku: hrev50824 - src/apps/packageinstaller

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 05 Jan 2017 21:45:16 +0000

On Fri, 6 Jan 2017 10:18 am waddlesplash <waddlesplash@xxxxxxxxx> wrote:

On Thu, Jan 5, 2017 at 4:05 PM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
wrote:
Am 05/01/2017 um 18:21 schrieb waddlesplash@xxxxxxxxx:

+               if (strncmp(filename + (strnlen(filename,
B_FILE_NAME_LENGTH) - 3),
+                               "pdb", 3) != 0) {


filename == "a" --> Kaboom!
Dude, the nineties are over, you have to write proper code now :-)

Oops. See, the last time I needed to do something like this, I just
converted everything to a BString, but people complained that was too
unoptimal, so I had to revert and use strncmp...


No, the last time you just made a complete hash of it by doing something
opposite to what you were told. In this particular case, a BString would
probably work well.


Other related posts: