Author: jackburton Date: 2010-04-08 22:37:15 +0200 (Thu, 08 Apr 2010) New Revision: 36094 Changeset: http://dev.haiku-os.org/changeset/36094/haiku Modified: haiku/trunk/src/kits/interface/Shelf.cpp Log: Better error checking. Style changes Modified: haiku/trunk/src/kits/interface/Shelf.cpp =================================================================== --- haiku/trunk/src/kits/interface/Shelf.cpp 2010-04-08 20:02:14 UTC (rev 36093) +++ haiku/trunk/src/kits/interface/Shelf.cpp 2010-04-08 20:37:15 UTC (rev 36094) @@ -1108,21 +1108,32 @@ 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 @@ const char *name; if (msg->FindString("name", &name) != B_OK) break; - for (int32 i=0; i<CountReplicants(); i++) { + for (int32 i = 0; i < CountReplicants(); i++) { BView *view = NULL; ReplicantAt(i, &view, &ID, &err); if (err == B_OK) { @@ -1498,7 +1509,7 @@ uint32 id; if (msg->FindInt32("id", (int32 *)&id) != B_OK) break; - for (int32 i=0; i<CountReplicants(); i++) { + for (int32 i = 0; i < CountReplicants(); i++) { BView *view = NULL; ReplicantAt(i, &view, &ID, &err); if (err == B_OK) {