aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-11-18 22:31:45 -0500
committerMichael Mann <mmann78@netscape.net>2017-11-19 05:14:57 +0000
commitbb47a68e0983fa4da5b607dd775e227528da1955 (patch)
tree7a1b5d63cb183f807620eaab28291b82633b2507 /epan
parent752d0ef753983b45142e76a71dcdf3ab3c082439 (diff)
Move dissect_leb128 to file-elf.c
This allows for the removal of epan/dwarf.[ch] Functionality could probably be handled by an encoding (like dissect_uleb128), but for now keep it in file-elf.c as that's the only functionality currently using it. Change-Id: I84cf6af02abb3d53ea7d9b774e3313d77a1ff497 Reviewed-on: https://code.wireshark.org/review/24486 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r--epan/CMakeLists.txt2
-rw-r--r--epan/Makefile.am2
-rw-r--r--epan/dissectors/file-elf.c23
-rw-r--r--epan/dissectors/packet-mqtt.c1
-rw-r--r--epan/dissectors/packet-netsync.c1
-rw-r--r--epan/dwarf.c63
-rw-r--r--epan/dwarf.h43
7 files changed, 22 insertions, 113 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index a4842ca40a..5497a077dc 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -88,7 +88,6 @@ set(LIBWIRESHARK_PUBLIC_HEADERS
dtd.h
dtd_parse.h
dvb_chartbl.h
- dwarf.h
eap.h
eapol_keydes_types.h
epan.h
@@ -197,7 +196,6 @@ set(LIBWIRESHARK_FILES
disabled_protos.c
dissector_filters.c
dvb_chartbl.c
- dwarf.c
epan.c
ex-opt.c
except.c
diff --git a/epan/Makefile.am b/epan/Makefile.am
index 2632cb9a8c..85f7f393ae 100644
--- a/epan/Makefile.am
+++ b/epan/Makefile.am
@@ -61,7 +61,6 @@ LIBWIRESHARK_SRC = \
disabled_protos.c \
dissector_filters.c \
dvb_chartbl.c \
- dwarf.c \
epan.c \
ex-opt.c \
except.c \
@@ -196,7 +195,6 @@ LIBWIRESHARK_INCLUDES_PUBLIC = \
dtd.h \
dtd_parse.h \
dvb_chartbl.h \
- dwarf.h \
eap.h \
eapol_keydes_types.h \
epan.h \
diff --git a/epan/dissectors/file-elf.c b/epan/dissectors/file-elf.c
index 3452524b86..509742b820 100644
--- a/epan/dissectors/file-elf.c
+++ b/epan/dissectors/file-elf.c
@@ -34,7 +34,6 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
-#include "dwarf.h"
static dissector_handle_t elf_handle;
@@ -596,6 +595,28 @@ typedef struct _segment_info_t {
void proto_register_elf(void);
void proto_reg_handoff_elf(void);
+static gint
+dissect_leb128(tvbuff_t *tvb, gint offset, gint64 *value)
+{
+ guint start_offset = offset;
+ guint shift = 0;
+ guint8 byte;
+
+ *value = 0;
+
+ do {
+ byte = tvb_get_guint8(tvb, offset);
+ offset += 1;
+
+ *value |= ((guint64)(byte & 0x7F) << shift);
+ shift += 7;
+ } while ((byte & 0x80) && (shift < 64));
+
+ if (shift < 64 && byte & 0x40)
+ *value |= - ((gint64)1 << shift);
+
+ return offset - start_offset;
+}
/* Wireshark support "offset" as gint, but ELF needed guint64 size, so check if there is no overflow */
static gint
diff --git a/epan/dissectors/packet-mqtt.c b/epan/dissectors/packet-mqtt.c
index c7a9a98683..7f03466e31 100644
--- a/epan/dissectors/packet-mqtt.c
+++ b/epan/dissectors/packet-mqtt.c
@@ -48,7 +48,6 @@
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/uat.h>
-#include <epan/dwarf.h>
#include "packet-tcp.h"
#include "packet-ssl.h"
diff --git a/epan/dissectors/packet-netsync.c b/epan/dissectors/packet-netsync.c
index 39374424d8..422665a48b 100644
--- a/epan/dissectors/packet-netsync.c
+++ b/epan/dissectors/packet-netsync.c
@@ -28,7 +28,6 @@
#include <epan/packet.h>
#include <epan/prefs.h>
-#include "dwarf.h"
#include "packet-tcp.h"
void proto_register_netsync(void);
diff --git a/epan/dwarf.c b/epan/dwarf.c
deleted file mode 100644
index 8c7a145e9b..0000000000
--- a/epan/dwarf.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* dwarf.c
- * Common DWARF parts
- *
- * Wireshark - Network traffic analyzer
- * 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.
- */
-
-#include "config.h"
-
-#include <epan/tvbuff.h>
-
-#include "dwarf.h"
-
-gint
-dissect_leb128(tvbuff_t *tvb, gint offset, gint64 *value)
-{
- guint start_offset = offset;
- guint shift = 0;
- guint8 byte;
-
- *value = 0;
-
- do {
- byte = tvb_get_guint8(tvb, offset);
- offset += 1;
-
- *value |= ((guint64)(byte & 0x7F) << shift);
- shift += 7;
- } while ((byte & 0x80) && (shift < 64));
-
- if (shift < 64 && byte & 0x40)
- *value |= - ((gint64)1 << shift);
-
- return offset - start_offset;
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 8
- * indent-tabs-mode: nil
- * End:
- *
- * vi: set shiftwidth=4 tabstop=8 expandtab:
- * :indentSize=4:tabSize=8:noTabs=true:
- */
diff --git a/epan/dwarf.h b/epan/dwarf.h
deleted file mode 100644
index 211aca5713..0000000000
--- a/epan/dwarf.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* dwarf.h
- * Common DWARF parts
- *
- * Wireshark - Network traffic analyzer
- * 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.
- */
-
-#ifndef __DWARF_H__
-#define __DWARF_H__
-
-#include <glib.h>
-
-gint dissect_leb128(tvbuff_t *tvb, gint offset, gint64 *value);
-
-#endif /* __DWARF_H__ */
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 8
- * indent-tabs-mode: nil
- * End:
- *
- * vi: set shiftwidth=4 tabstop=8 expandtab:
- * :indentSize=4:tabSize=8:noTabs=true:
- */