Merge pull request #27347 from ANSHUMAN87:allocation-comments
PiperOrigin-RevId: 295238468 Change-Id: Ie60e320367d97030fb8b0aa8d2a884606ea57b51
This commit is contained in:
commit
dbc48cab35
@ -34,15 +34,12 @@ namespace tflite {
|
|||||||
FileCopyAllocation::FileCopyAllocation(const char* filename,
|
FileCopyAllocation::FileCopyAllocation(const char* filename,
|
||||||
ErrorReporter* error_reporter)
|
ErrorReporter* error_reporter)
|
||||||
: Allocation(error_reporter, Allocation::Type::kFileCopy) {
|
: Allocation(error_reporter, Allocation::Type::kFileCopy) {
|
||||||
// Obtain the file size, using an alternative method that is does not
|
// Obtain the file size using fstat, or report an error if that fails.
|
||||||
// require fstat for more compatibility.
|
|
||||||
std::unique_ptr<FILE, decltype(&fclose)> file(fopen(filename, "rb"), fclose);
|
std::unique_ptr<FILE, decltype(&fclose)> file(fopen(filename, "rb"), fclose);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
error_reporter_->Report("Could not open '%s'.", filename);
|
error_reporter_->Report("Could not open '%s'.", filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO(ahentz): Why did you think using fseek here was better for finding
|
|
||||||
// the size?
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
// support usage of msvc's posix-like fileno symbol
|
// support usage of msvc's posix-like fileno symbol
|
||||||
|
Loading…
Reference in New Issue
Block a user