From 51634653c61d7c478e5718d921817820e2b6d082 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 12 Jan 2005 03:25:48 +0000 Subject: [PATCH] * Fixed BMessageBody::GetInfo(): Indexed based iteration was broken for two different reasons. * Fixed BMessageBody::FindData() in case of type B_ANY_TYPE, which should match any matchingly-named field. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10678 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/MessageBody.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kits/app/MessageBody.cpp b/src/kits/app/MessageBody.cpp index 19333c02c3..59ced69753 100644 --- a/src/kits/app/MessageBody.cpp +++ b/src/kits/app/MessageBody.cpp @@ -84,13 +84,13 @@ status_t BMessageBody::GetInfo(type_code typeRequested, int32 which, int32 index = 0; for (index = 0; i != fData.end(); ++i) { - if (B_ANY_TYPE == typeRequested && i->second->Type() == typeRequested) + if (B_ANY_TYPE == typeRequested || i->second->Type() == typeRequested) { - ++index; if (index == which) { break; } + ++index; } } @@ -402,7 +402,7 @@ BMessageField* BMessageBody::FindData(const char* name, type_code type, else { Item = i->second; - if (Item->Type() != type) + if (type != B_ANY_TYPE && Item->Type() != type) { err = B_BAD_TYPE; Item = NULL;