aboutsummaryrefslogtreecommitdiff
path: root/gold/fileread.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-09-25 00:27:29 +0000
committerIan Lance Taylor <iant@google.com>2007-09-25 00:27:29 +0000
commitba45d2478b259454e5b4c2d7dcaa7a35ecbf329c (patch)
treee9d069c39988c400a7f41583978372080b661a92 /gold/fileread.h
parent5f67a19ce6e7ddd10473df8e2754d9d229c884fe (diff)
downloadfsf-binutils-gdb-ba45d2478b259454e5b4c2d7dcaa7a35ecbf329c.zip
fsf-binutils-gdb-ba45d2478b259454e5b4c2d7dcaa7a35ecbf329c.tar.gz
fsf-binutils-gdb-ba45d2478b259454e5b4c2d7dcaa7a35ecbf329c.tar.bz2
Break out default pbytes argument to read and get_view routines,
adding new routines.
Diffstat (limited to 'gold/fileread.h')
-rw-r--r--gold/fileread.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/gold/fileread.h b/gold/fileread.h
index b2bb468..a77721d 100644
--- a/gold/fileread.h
+++ b/gold/fileread.h
@@ -80,24 +80,37 @@ class File_read
bool
is_locked();
- // Return a view into the file. The pointer will remain valid until
- // the File_read is unlocked. If PBYTES is NULL, it is an error if
- // we can not read enough data. Otherwise *PBYTES is set to the
- // number of bytes read.
+ // Return a view into the file starting at file offset START for
+ // SIZE bytes. The pointer will remain valid until the File_read is
+ // unlocked. It is an error if we can not read enough data from the
+ // file.
const unsigned char*
- get_view(off_t start, off_t size, off_t* pbytes = NULL);
+ get_view(off_t start, off_t size);
- // Read data from the file into the buffer P. PBYTES is as in
- // get_view.
+ // Return a view into the file starting at file offset START, for up
+ // to SIZE bytes. Set *PBYTES to the number of bytes read. This
+ // may be less than SIZE. The pointer will remain valid until the
+ // File_read is unlocked.
+ const unsigned char*
+ get_view_and_size(off_t start, off_t size, off_t* pbytes);
+
+ // Read data from the file into the buffer P starting at file offset
+ // START for SIZE bytes.
+ void
+ read(off_t start, off_t size, void* p);
+
+ // Read up to SIZE bytes from the file into the buffer P starting at
+ // file offset START. Set *PBYTES to the number of bytes read.
void
- read(off_t start, off_t size, void* p, off_t* pbytes = NULL);
+ read_up_to(off_t start, off_t size, void* p, off_t* pbytes);
- // Return a lasting view into the file. This is allocated with new,
- // and the caller is responsible for deleting it when done. The
- // data associated with this view will remain valid until the view
- // is deleted. PBYTES is handled as with get_view.
+ // Return a lasting view into the file starting at file offset START
+ // for SIZE bytes. This is allocated with new, and the caller is
+ // responsible for deleting it when done. The data associated with
+ // this view will remain valid until the view is deleted. It is an
+ // error if we can not read enough data from the file.
File_view*
- get_lasting_view(off_t start, off_t size, off_t *pbytes = NULL);
+ get_lasting_view(off_t start, off_t size);
private:
// This class may not be copied.