ART: Add FdFile constructors
Make Open protected, and expose constructors instead. Add a move
constructor and move assignment operator.
Add OS functions that return the FdFile non-pointer version.
Add tests.
Bug: 21192156
Test: m test-art-host
Test: m test-art-target (shamu)
Change-Id: I83e390edde7cd37c900e9d5c3e4d21da22981b3f
diff --git a/runtime/utils.cc b/runtime/utils.cc
index 6a50b8e..3f779df 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -136,8 +136,8 @@
}
bool ReadFileToString(const std::string& file_name, std::string* result) {
- File file;
- if (!file.Open(file_name, O_RDONLY)) {
+ File file(file_name, O_RDONLY, false);
+ if (!file.IsOpened()) {
return false;
}
@@ -155,8 +155,8 @@
}
bool PrintFileToLog(const std::string& file_name, LogSeverity level) {
- File file;
- if (!file.Open(file_name, O_RDONLY)) {
+ File file(file_name, O_RDONLY, false);
+ if (!file.IsOpened()) {
return false;
}