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; |
} |