Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Unified Diff: skia/ext/SkFontHost_fontconfig.cpp

Issue 8800017: Change SkFileDescriptorStream to handle failure to open the file descriptor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/SkFontHost_fontconfig.cpp
===================================================================
--- skia/ext/SkFontHost_fontconfig.cpp (revision 112974)
+++ skia/ext/SkFontHost_fontconfig.cpp (working copy)
@@ -243,6 +243,7 @@
SkFileDescriptorStream(int fd) {
memory_ = NULL;
offset_ = 0;
+ length_ = 0;
bungeman-skia 2011/12/05 21:02:45 This is following the existing convention, but sho
struct stat st;
if (fstat(fd, &st))
@@ -273,20 +274,12 @@
return length_;
}
- if (!buffer) {
- // This is a request to skip bytes.
- if (offset_ + size < offset_)
- return offset_;
- offset_ += size;
- if (offset_ > length_)
- offset_ = length_;
- return offset_;
- }
-
size_t remaining = length_ - offset_;
if (size > remaining)
size = remaining;
- memcpy(buffer, memory_ + offset_, size);
+ if (buffer)
+ memcpy(buffer, memory_ + offset_, size);
+
offset_ += size;
return size;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698