pkasting@chromium.org
2014-11-20 22:28:14 +00:00
parent edc6e57a92
commit 4591fbd09f
341 changed files with 2610 additions and 2613 deletions

View File

@ -187,19 +187,16 @@ int FileWrapperImpl::OpenFromFileHandle(FILE* handle,
return 0;
}
int FileWrapperImpl::Read(void* buf, int length) {
int FileWrapperImpl::Read(void* buf, size_t length) {
WriteLockScoped write(*rw_lock_);
if (length < 0)
return -1;
if (id_ == NULL)
return -1;
int bytes_read = static_cast<int>(fread(buf, 1, length, id_));
size_t bytes_read = fread(buf, 1, length, id_);
if (bytes_read != length && !looping_) {
CloseFileImpl();
}
return bytes_read;
return static_cast<int>(bytes_read);
}
int FileWrapperImpl::WriteText(const char* format, ...) {
@ -226,14 +223,11 @@ int FileWrapperImpl::WriteText(const char* format, ...) {
}
}
bool FileWrapperImpl::Write(const void* buf, int length) {
bool FileWrapperImpl::Write(const void* buf, size_t length) {
WriteLockScoped write(*rw_lock_);
if (buf == NULL)
return false;
if (length < 0)
return false;
if (read_only_)
return false;