aboutsummaryrefslogtreecommitdiff
path: root/src/flatfile.cpp
diff options
context:
space:
mode:
authorJim Posen <jim.posen@gmail.com>2019-01-24 11:20:57 -0800
committerJim Posen <jim.posen@gmail.com>2019-02-22 17:38:45 -0800
commit04cca330944f859b4ed68cb8da8a79f5206fd630 (patch)
treea0c42f2d1b123a0c73e3bf3943cbdb18393e441d /src/flatfile.cpp
parent4c01e4e159db82ce4b2acce75f709cac996367d7 (diff)
downloadbitcoin-04cca330944f859b4ed68cb8da8a79f5206fd630.tar.xz
Style cleanup.
Diffstat (limited to 'src/flatfile.cpp')
-rw-r--r--src/flatfile.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/flatfile.cpp b/src/flatfile.cpp
index d2e11825d5..8a8f7b681c 100644
--- a/src/flatfile.cpp
+++ b/src/flatfile.cpp
@@ -30,25 +30,24 @@ fs::path FlatFileSeq::FileName(const FlatFilePos& pos) const
return m_dir / strprintf("%s%05u.dat", m_prefix, pos.nFile);
}
-FILE* FlatFileSeq::Open(const FlatFilePos& pos, bool fReadOnly)
+FILE* FlatFileSeq::Open(const FlatFilePos& pos, bool read_only)
{
- if (pos.IsNull())
+ if (pos.IsNull()) {
return nullptr;
+ }
fs::path path = FileName(pos);
fs::create_directories(path.parent_path());
- FILE* file = fsbridge::fopen(path, fReadOnly ? "rb": "rb+");
- if (!file && !fReadOnly)
+ FILE* file = fsbridge::fopen(path, read_only ? "rb": "rb+");
+ if (!file && !read_only)
file = fsbridge::fopen(path, "wb+");
if (!file) {
LogPrintf("Unable to open file %s\n", path.string());
return nullptr;
}
- if (pos.nPos) {
- if (fseek(file, pos.nPos, SEEK_SET)) {
- LogPrintf("Unable to seek to position %u of %s\n", pos.nPos, path.string());
- fclose(file);
- return nullptr;
- }
+ if (pos.nPos && fseek(file, pos.nPos, SEEK_SET)) {
+ LogPrintf("Unable to seek to position %u of %s\n", pos.nPos, path.string());
+ fclose(file);
+ return nullptr;
}
return file;
}