[haiku-bugs] Re: [Haiku] #3560: Have window status line indicate used disk space

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Fri, 24 Oct 2014 10:58:22 -0000

#3560: Have window status line indicate used disk space
------------------------------+---------------------------
   Reporter:  BeOSR           |      Owner:  stippi
       Type:  enhancement     |     Status:  new
   Priority:  normal          |  Milestone:  R1
  Component:  User Interface  |    Version:  R1/pre-alpha1
 Resolution:                  |   Keywords:
 Blocked By:                  |   Blocking:
Has a Patch:  0               |   Platform:  All
------------------------------+---------------------------

Comment (by pulkomandy):

 Hi,
 Now I see a few more problems:

 {{{
 if(fLastCount != fPoseView->CountItems())
     fLastCount = fPoseView->CountItems();
 }}}

 The if is useless.

 {{{
 if(model->IsDirectory())
 }}}

 Add a space between if and parentesis

 {{{
 off_t fileSize = 0;
 }}}

 This variable is useless, you can do this:
 {{{
 fTotalFilesSize += statbuf.st_size;
 }}}

 {{{
 else
                 // we can't check for files and folders if model is not a
 directory
                 return;
 }}}

 Multiline else needs braces (even if it's a single statement, for our
 coding guidelines)

 I think the call to dir.Rewind() is useless. When you create a BDirectory
 it is initialized to point at the start of the directory already.

 Your error handling should be improved. If there is a file you can't stat,
 you are just exiting early, and the view will show the wrong numbers. You
 should at least replace the return with a continue to scan the remaining
 entries, and maybe add a warning message to the view in that case ("Some
 entries can't be identified" or something similar). But maybe the message
 would take too much space and it's better to ignore it.

--
Ticket URL: <https://dev.haiku-os.org/ticket/3560#comment:11>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: