diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-12-11 13:18:40 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-12-11 13:18:40 -0800 |
commit | d43c803bfe1edfe828141e801190f39e072aa3d2 (patch) | |
tree | 9ead82c01d0398704067a75b6a805831991411fb /history.cpp | |
parent | eec6db0a2312e923f74402bb2e714f4bb331d9bd (diff) |
Fix for build errors with g++ 4.0.1
Diffstat (limited to 'history.cpp')
-rw-r--r-- | history.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/history.cpp b/history.cpp index 6cf14db2..c4f34b5f 100644 --- a/history.cpp +++ b/history.cpp @@ -85,6 +85,8 @@ public: } }; +static const file_id_t kInvalidFileID((dev_t)(-1), (ino_t)(-1)); + /* Lock a file via fcntl; returns true on success, false on failure. */ static bool history_file_lock(int fd, short type) { @@ -99,7 +101,7 @@ static bool history_file_lock(int fd, short type) /* Get a file_id_t corresponding to the given fd */ static file_id_t history_file_identify(int fd) { - file_id_t result(-1, -1); + file_id_t result = kInvalidFileID; struct stat buf = {}; if (0 == fstat(fd, &buf)) { @@ -473,7 +475,7 @@ history_t::history_t(const wcstring &pname) : first_unwritten_new_item_index(0), mmap_start(NULL), mmap_length(0), - mmap_file_id(-1, -1), + mmap_file_id(kInvalidFileID), birth_timestamp(time(NULL)), countdown_to_vacuum(-1), loaded_old(false), @@ -569,8 +571,8 @@ void history_t::get_string_representation(wcstring &result, const wcstring &sepa bool first = true; - /* Append new items */ - for (std::vector<history_item_t>::const_reverse_iterator iter=new_items.rbegin(); iter < new_items.rend(); ++iter) + /* Append new items. Note that in principle we could use const_reverse_iterator, but we do not because reverse_iterator is not convertible to const_reverse_iterator ( http://github.com/fish-shell/fish-shell/issues/431 ) */ + for (std::vector<history_item_t>::reverse_iterator iter=new_items.rbegin(); iter < new_items.rend(); ++iter) { if (! first) result.append(separator); @@ -580,7 +582,7 @@ void history_t::get_string_representation(wcstring &result, const wcstring &sepa /* Append old items */ load_old_if_needed(); - for (std::vector<size_t>::const_reverse_iterator iter = old_item_offsets.rbegin(); iter != old_item_offsets.rend(); ++iter) + for (std::vector<size_t>::reverse_iterator iter = old_item_offsets.rbegin(); iter != old_item_offsets.rend(); ++iter) { size_t offset = *iter; const history_item_t item = history_t::decode_item(mmap_start + offset, mmap_length - offset, mmap_type); |