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

Unified Diff: skia/images/SkFDStream.cpp

Issue 113827: Remove the remainder of the skia source code from the Chromium repo.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months 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 | « skia/images/SkCreateRLEPixelRef.cpp ('k') | skia/images/SkFlipPixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/images/SkFDStream.cpp
===================================================================
--- skia/images/SkFDStream.cpp (revision 16859)
+++ skia/images/SkFDStream.cpp (working copy)
@@ -1,85 +0,0 @@
-#include "SkStream.h"
-#include <unistd.h>
-
-//#define TRACE_FDSTREAM
-
-SkFDStream::SkFDStream(int fileDesc, bool closeWhenDone)
- : fFD(fileDesc), fCloseWhenDone(closeWhenDone) {
-}
-
-SkFDStream::~SkFDStream() {
- if (fFD >= 0 && fCloseWhenDone) {
- ::close(fFD);
- }
-}
-
-bool SkFDStream::rewind() {
- if (fFD >= 0) {
- off_t value = ::lseek(fFD, 0, SEEK_SET);
-#ifdef TRACE_FDSTREAM
- if (value) {
- SkDebugf("xxxxxxxxxxxxxx rewind failed %d\n", value);
- }
-#endif
- return value == 0;
- }
- return false;
-}
-
-size_t SkFDStream::read(void* buffer, size_t size) {
- if (fFD >= 0) {
- if (buffer == NULL && size == 0) { // request total size
- off_t curr = ::lseek(fFD, 0, SEEK_CUR);
- if (curr < 0) {
-#ifdef TRACE_FDSTREAM
- SkDebugf("xxxxxxxxxxxxx lseek failed 0 CURR\n");
-#endif
- return 0; // error
- }
- off_t size = ::lseek(fFD, 0, SEEK_END);
- if (size < 0) {
-#ifdef TRACE_FDSTREAM
- SkDebugf("xxxxxxxxxxxxx lseek failed 0 END\n");
-#endif
- size = 0; // error
- }
- if (::lseek(fFD, curr, SEEK_SET) != curr) {
- // can't restore, error
-#ifdef TRACE_FDSTREAM
- SkDebugf("xxxxxxxxxxxxx lseek failed %d SET\n", curr);
-#endif
- return 0;
- }
- return size;
- } else if (NULL == buffer) { // skip
- off_t oldCurr = ::lseek(fFD, 0, SEEK_CUR);
- if (oldCurr < 0) {
-#ifdef TRACE_FDSTREAM
- SkDebugf("xxxxxxxxxxxxx lseek1 failed %d CUR\n", oldCurr);
-#endif
- return 0; // error;
- }
- off_t newCurr = ::lseek(fFD, size, SEEK_CUR);
- if (newCurr < 0) {
-#ifdef TRACE_FDSTREAM
- SkDebugf("xxxxxxxxxxxxx lseek2 failed %d CUR\n", newCurr);
-#endif
- return 0; // error;
- }
- // return the actual amount we skipped
- return newCurr - oldCurr;
- } else { // read
- ssize_t actual = ::read(fFD, buffer, size);
- // our API can't return an error, so we return 0
- if (actual < 0) {
-#ifdef TRACE_FDSTREAM
- SkDebugf("xxxxxxxxxxxxx read failed %d actual %d\n", size, actual);
-#endif
- actual = 0;
- }
- return actual;
- }
- }
- return 0;
-}
-
« no previous file with comments | « skia/images/SkCreateRLEPixelRef.cpp ('k') | skia/images/SkFlipPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698