aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/k12.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-05-23 10:50:02 +0000
committerGuy Harris <guy@alum.mit.edu>2014-05-23 10:50:10 +0000
commita344c9736efe5519543da1290e1ad9065d0b0cff (patch)
tree7757d80d74ae710e5d4e4a1b0cb638d0ec644fc4 /wiretap/k12.c
parent716fdc8e398ea7435b23192ab1f7d59e7b21e32b (diff)
Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."
This reverts commit c0c480d08c175eed4524ea9e73ec86298f468cf4. A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes. That is in-progress. Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6 Reviewed-on: https://code.wireshark.org/review/1741 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/k12.c')
-rw-r--r--wiretap/k12.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/wiretap/k12.c b/wiretap/k12.c
index 013c19e6f6..cd1bbe6104 100644
--- a/wiretap/k12.c
+++ b/wiretap/k12.c
@@ -623,7 +623,7 @@ process_packet_data(struct wtap_pkthdr *phdr, Buffer *target, guint8 *buffer,
phdr->pseudo_header.k12.stuff = k12;
}
-static int k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) {
+static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) {
k12_t *k12 = (k12_t *)wth->priv;
k12_src_desc_t* src_desc;
guint8* buffer;
@@ -644,16 +644,16 @@ static int k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
if (len < 0) {
/* read error */
- return -1;
+ return FALSE;
} else if (len == 0) {
/* EOF */
*err = 0;
- return -1;
+ return FALSE;
} else if (len < K12_RECORD_SRC_ID + 4) {
/* Record not large enough to contain a src ID */
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup_printf("data record length %d too short", len);
- return -1;
+ return FALSE;
}
buffer = k12->seq_read_buff;
@@ -681,11 +681,11 @@ static int k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
process_packet_data(&wth->phdr, wth->frame_buffer, buffer, len, k12);
- return REC_TYPE_PACKET;
+ return TRUE;
}
-static int k12_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) {
+static gboolean k12_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) {
k12_t *k12 = (k12_t *)wth->priv;
guint8* buffer;
gint len;
@@ -694,18 +694,18 @@ static int k12_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, B
if ( file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
K12_DBG(5,("k12_seek_read: SEEK ERROR"));
- return -1;
+ return FALSE;
}
len = get_record(k12, wth->random_fh, seek_off, TRUE, err, err_info);
if (len < 0) {
K12_DBG(5,("k12_seek_read: READ ERROR"));
- return -1;
+ return FALSE;
} else if (len < K12_RECORD_SRC_ID + 4) {
/* Record not large enough to contain a src ID */
K12_DBG(5,("k12_seek_read: SHORT READ"));
*err = WTAP_ERR_SHORT_READ;
- return -1;
+ return FALSE;
}
buffer = k12->rand_read_buff;
@@ -714,7 +714,7 @@ static int k12_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, B
K12_DBG(5,("k12_seek_read: DONE OK"));
- return REC_TYPE_PACKET;
+ return TRUE;
}