From 599a58a6ef971e2dc82dc93606a72913d53cd4c1 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 8 Apr 2010 20:37:15 +0000 Subject: [PATCH] Better error checking. Style changes git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36094 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Shelf.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/kits/interface/Shelf.cpp b/src/kits/interface/Shelf.cpp index e4e8d692db..afdb8bf905 100644 --- a/src/kits/interface/Shelf.cpp +++ b/src/kits/interface/Shelf.cpp @@ -1108,21 +1108,32 @@ BShelf::operator=(const BShelf &) status_t BShelf::_Archive(BMessage *data) const { - BHandler::Archive(data); + status_t status = BHandler::Archive(data); + if (status != B_OK) + return status; - data->AddBool("_zom_dsp", DisplaysZombies()); - data->AddBool("_zom_alw", AllowsZombies()); - data->AddInt32("_sg_cnt", fGenCount); + status = data->AddBool("_zom_dsp", DisplaysZombies()); + if (status != B_OK) + return status; + + status = data->AddBool("_zom_alw", AllowsZombies()); + if (status != B_OK) + return status; + + status = data->AddInt32("_sg_cnt", fGenCount); + if (status != B_OK) + return status; BMessage archive('ARCV'); - for (int32 i = 0; i < fReplicants.CountItems(); i++) { if (((replicant_data *)fReplicants.ItemAt(i))->Archive(&archive) == B_OK) - data->AddMessage("replicant", &archive); + status = data->AddMessage("replicant", &archive); + if (status != B_OK) + break; archive.MakeEmpty(); } - return B_OK; + return status; } @@ -1480,7 +1491,7 @@ BShelf::_GetProperty(BMessage *msg, BMessage *reply) const char *name; if (msg->FindString("name", &name) != B_OK) break; - for (int32 i=0; iFindInt32("id", (int32 *)&id) != B_OK) break; - for (int32 i=0; i