-1 is a valid tree_type value.

Adjust tree_expanded and FieldInformation::treeType accordingly.

Change-Id: I9b12c28550ba2639f636531a7ea1841df0638b5e
Reviewed-on: https://code.wireshark.org/review/24844
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2017-12-15 13:40:34 -08:00 committed by Anders Broman
parent 67a49eb2ec
commit 3c87991c28
2 changed files with 5 additions and 14 deletions

View File

@ -5,19 +5,7 @@
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* SPDX-License-Identifier: GPL-2.0+
*/
#include "config.h"
@ -11801,6 +11789,9 @@ proto_check_field_name(const gchar *field_name)
gboolean
tree_expanded(int tree_type)
{
if (tree_type == -1) {
return FALSE;
}
g_assert(tree_type >= 0 && tree_type < num_tree_types);
return tree_is_expanded[tree_type >> 5] & (1U << (tree_type & 31));
}

View File

@ -52,7 +52,7 @@ void FieldInformation::setParentField(field_info * par_fi)
int FieldInformation::treeType()
{
if (fi_) {
Q_ASSERT(fi_->tree_type >= 0 && fi_->tree_type < num_tree_types);
Q_ASSERT(fi_->tree_type >= -1 && fi_->tree_type < num_tree_types);
return fi_->tree_type;
}
return -1;