aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/data.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/c/data.h b/c/data.h
index 1216359..7114440 100644
--- a/c/data.h
+++ b/c/data.h
@@ -84,20 +84,21 @@ struct FileView
static FileView Initialized(const wchar_t* filename, size_t c, size_t cInit = 0)
{
- bool bExisting = GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES;
- FileView fv(filename, c);
-
/* If file didn't exist, initialize it with defaults. */
- if (!bExisting) {
+ if (cInit && GetFileAttributes(filename) == INVALID_FILE_ATTRIBUTES) {
+ FileView fv(filename, c);
T t;
cInit = cInit? cInit: c;
for (size_t i = 0; i < cInit; i++)
memcpy(fv+i, &t, sizeof(T));
}
- return fv;
+ return { filename, c };
}
+ FileView(FileView<T>&) = delete;
+ FileView(FileView<T>&& fv) = delete;
+
FileView(const wchar_t* filename, size_t c) : c(c)
{
hf = CreateFile(filename, GENERIC_READ|GENERIC_WRITE,