Wireshark-commits: [Wireshark-commits] master 670ebda: Add some higher-level file-read APIs and use

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Tue, 7 Oct 2014 01:02:01 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=670ebda4a6af0d30e033b0af48cfd15ce52c10eb
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

670ebda by Guy Harris (guy@xxxxxxxxxxxx):

    Add some higher-level file-read APIs and use them.
    
    Add wtap_read_bytes(), which takes a FILE_T, a pointer, a byte count, an
    error number pointer, and an error string pointer as arguments, and that
    treats a short read of any sort, including a read that returns 0 bytes,
    as a WTAP_ERR_SHORT_READ error, and that returns the error number and
    string through its last two arguments.
    
    Add wtap_read_bytes_or_eof(), which is similar, but that treats a read
    that returns 0 bytes as an EOF, supplying an error number of 0 as an EOF
    indication.
    
    Use those in file readers; that simplifies the code and makes it less
    likely that somebody will fail to supply the error number and error
    string on a file read error.
    
    Change-Id: Ia5dba2a6f81151e87b614461349d611cffc16210
    Reviewed-on: https://code.wireshark.org/review/4512
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  6397ad4   Revert "Qt: Try to fix a Visual C++ encoding warning."
    adds  670ebda   Add some higher-level file-read APIs and use them.


Summary of changes:
 wiretap/5views.c              |   29 ++-----
 wiretap/aethra.c              |   25 ++----
 wiretap/ber.c                 |    7 +-
 wiretap/btsnoop.c             |   22 +----
 wiretap/camins.c              |   33 ++------
 wiretap/commview.c            |   54 ++++++++-----
 wiretap/csids.c               |   28 ++-----
 wiretap/erf.c                 |   95 ++++++++++++----------
 wiretap/eyesdn.c              |   63 +++++++--------
 wiretap/hcidump.c             |   22 ++---
 wiretap/i4btrace.c            |   17 +---
 wiretap/ipfix.c               |   12 ++-
 wiretap/iptrace.c             |   48 +++--------
 wiretap/iseries.c             |   14 ++--
 wiretap/k12.c                 |   16 ++--
 wiretap/lanalyzer.c           |   86 +++++++++-----------
 wiretap/libpcap.c             |   24 ++----
 wiretap/logcat.c              |  139 ++++++++++++++++++-------------
 wiretap/mp2t.c                |   17 +---
 wiretap/mpeg.c                |   83 +++++++------------
 wiretap/netmon.c              |   48 +++--------
 wiretap/netscaler.c           |   81 +++++--------------
 wiretap/nettl.c               |  101 +++++++----------------
 wiretap/network_instruments.c |   85 +++++++------------
 wiretap/netxray.c             |   33 +++-----
 wiretap/ngsniffer.c           |   60 +++-----------
 wiretap/packetlogger.c        |   20 +++--
 wiretap/pcap-common.c         |  133 +++++-------------------------
 wiretap/pcapng.c              |  146 ++++++++++-----------------------
 wiretap/peekclassic.c         |   42 ++++------
 wiretap/peektagged.c          |   26 ++----
 wiretap/pppdump.c             |   17 ++--
 wiretap/radcom.c              |  180 +++++++++++++++++++----------------------
 wiretap/snoop.c               |   73 +++--------------
 wiretap/stanag4607.c          |   41 ++++------
 wiretap/tnef.c                |    8 +-
 wiretap/visual.c              |   30 ++-----
 wiretap/vwr.c                 |   30 +++----
 wiretap/wtap-int.h            |   64 ++++++++-------
 wiretap/wtap.c                |   72 ++++++++++++++---
 40 files changed, 787 insertions(+), 1337 deletions(-)