aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkStream.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-18 20:53:49 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-18 20:53:49 +0000
commit070235e746c46f6c0a26ed6c23c832c532b974e9 (patch)
tree9df2c570d89812cfc3a1951c03ae4991c6c2e144 /src/core/SkStream.cpp
parent4f7e846cd8b577fc40f30cce6d982d853763a3eb (diff)
revert 8204 -- what is happening???
git-svn-id: http://skia.googlecode.com/svn/trunk@8205 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkStream.cpp')
-rw-r--r--src/core/SkStream.cpp64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index acbcfbc53d..fb343ea76a 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -13,14 +13,6 @@
#include "SkString.h"
#include "SkOSFile.h"
-#if SK_MMAP_SUPPORT
- #include <unistd.h>
- #include <sys/mman.h>
- #include <fcntl.h>
- #include <errno.h>
- #include <unistd.h>
-#endif
-
SK_DEFINE_INST_COUNT(SkStream)
SK_DEFINE_INST_COUNT(SkWStream)
SK_DEFINE_INST_COUNT(SkFILEStream)
@@ -797,59 +789,3 @@ bool SkDebugWStream::write(const void* buffer, size_t size)
#endif
return true;
}
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-static bool mmap_filename(const char path[], void** addrPtr, size_t* sizePtr) {
-#if SK_MMAP_SUPPORT
- int fd = open(path, O_RDONLY);
- if (fd < 0) {
- return false;
- }
-
- off_t offset = lseek(fd, 0, SEEK_END); // find the file size
- if (offset == -1) {
- close(fd);
- return false;
- }
- (void)lseek(fd, 0, SEEK_SET); // restore file offset to beginning
-
- // to avoid a 64bit->32bit warning, I explicitly create a size_t size
- size_t size = static_cast<size_t>(offset);
-
- void* addr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
- close(fd);
-
- if (MAP_FAILED == addr) {
- return false;
- }
-
- *addrPtr = addr;
- *sizePtr = size;
- return true;
-#else
- return false;
-#endif
-}
-
-SkStream* SkStream::NewFromFile(const char path[]) {
- void* addr;
- size_t size;
- if (mmap_filename(path, &addr, &size)) {
- SkAutoTUnref<SkData> data(SkData::NewFromMMap(addr, size));
- if (data.get()) {
- return SkNEW_ARGS(SkMemoryStream, (data.get()));
- }
- }
-
- // If we get here, then our attempt at using mmap failed, so try normal
- // file access.
- SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path));
- if (!stream->isValid()) {
- stream->unref();
- stream = NULL;
- }
- return stream;
-}
-