projects
/
libdcp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
24fb1bb
)
Cleanup: use std::vector rather than a raw array.
author
Carl Hetherington
<cth@carlh.net>
Sat, 17 Feb 2024 22:49:27 +0000
(23:49 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Sat, 17 Feb 2024 22:49:27 +0000
(23:49 +0100)
src/util.cc
patch
|
blob
|
history
diff --git
a/src/util.cc
b/src/util.cc
index a030ecb098ab930364b5d57a8e4a550cd112eba7..f5a15944ac6447728fffe1e478949cef2d731d22 100644
(file)
--- a/
src/util.cc
+++ b/
src/util.cc
@@
-265,14
+265,13
@@
dcp::file_to_string (boost::filesystem::path p, uintmax_t max_length)
throw FileError ("could not open file", p, errno);
}
-
char* c = new char[len]
;
+
std::vector<char> buffer(len)
;
/* This may read less than `len' if we are on Windows and we have CRLF in the file */
- int const N = f.read(c, 1, len);
+ int const N = f.read(buffer.data(), 1, len);
+ return string(buffer.data(), N);
+}
- string s (c, N);
- delete[] c;
- return s;
}