[haiku-commits] Re: haiku: hrev47248 - in src: apps/webpositive system/libroot/posix/string

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 23 May 2014 22:15:53 +0200

On 05/23/2014 05:56 PM, pulkomandy@xxxxxxxxxxxxx wrote:
5710ad9: Move overflowing items from bookmark bar to a menu.

Thanks! The current implementation really sucked (especially because the menu bar restricted the window size).

+BookmarkBar::BookmarkBar(const char* title, BHandler* target,
+       const entry_ref* navDir)
+       : BMenuBar(title)

Coding style. The super class constructor goes to the next line.


+{
+       BEntry(navDir).GetNodeRef(&fNodeRef);

Space after comma.
Missing checks.

+       while(dir.GetNextEntry(&bookmark) == B_OK) {

Space after while.

+               node_ref ref;
+               bookmark.GetNodeRef(&ref);

Again, no checks for failure at all.

+       switch(message->what) {

Space after switch.

+                       switch(opcode) {

And again.

+                                       const char *name;

Asterisk style.

+                                       BEntry entry(&ref);
+                                       _AddItem(inode, &entry);

Still no checks for failure. The code quality is really poor.

+                                       if (fItemsMap[inode] == NULL)
+                                       {

Parenthesis go the end of the previous line.
Many more of those issues in the next lines that I don't need to mention again (I hope).

+                                                       const char *name;
+                                                       message->FindString("name", 
&name);

No checks again, and in this case, the form:
const char* name = message->FindString("name");

is much more compact.

+       if(entry->IsDirectory()) {

Space after if.

+               item = new IconMenuItem(name, message, &info,
+                       B_MINI_ICON);

This fits on a single line.

+               BMenuItem* extraItem = fOverflowMenu->ItemAt(0);
+               while (extraItem) {

extraItem != NULL.

+//#pragma mark - private methods

Space after //

Bye,
   Axel.


Other related posts: