summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 20:40:33 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 20:40:33 +0000
commit66f066a4e6f58626fc71c0d7a3447299402ea664 (patch)
tree32cfd91fb44944a34bcc92ec445af40de201efde /net/base
parent18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0 (diff)
downloadchromium_src-66f066a4e6f58626fc71c0d7a3447299402ea664.zip
chromium_src-66f066a4e6f58626fc71c0d7a3447299402ea664.tar.gz
chromium_src-66f066a4e6f58626fc71c0d7a3447299402ea664.tar.bz2
Make upload_data not be windows specific. Add it to the SCons build.
Also add mime_sniffer_unittest which already passes. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1178 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/upload_data.cc15
-rw-r--r--net/base/upload_data.h1
2 files changed, 5 insertions, 11 deletions
diff --git a/net/base/upload_data.cc b/net/base/upload_data.cc
index fb0a6fe..6966aeb 100644
--- a/net/base/upload_data.cc
+++ b/net/base/upload_data.cc
@@ -29,8 +29,7 @@
#include "net/base/upload_data.h"
-#include <windows.h>
-
+#include "base/file_util.h"
#include "base/logging.h"
namespace net {
@@ -49,21 +48,15 @@ uint64 UploadData::Element::GetContentLength() const {
DCHECK(type_ == TYPE_FILE);
- // NOTE: wininet is unable to upload files larger than 4GB, but we'll let the
- // http layer worry about that.
// TODO(darin): This size calculation could be out of sync with the state of
// the file when we get around to reading it. We should probably find a way
// to lock the file or somehow protect against this error condition.
- WIN32_FILE_ATTRIBUTE_DATA info;
- if (!GetFileAttributesEx(file_path_.c_str(), GetFileExInfoStandard, &info)) {
- DLOG(WARNING) << "GetFileAttributesEx failed: " << GetLastError();
+ int64 length = 0;
+ if (!file_util::GetFileSize(file_path_, &length))
return 0;
- }
- uint64 length = static_cast<uint64>(info.nFileSizeHigh) << 32 |
- info.nFileSizeLow;
- if (file_range_offset_ >= length)
+ if (file_range_offset_ >= static_cast<uint64>(length))
return 0; // range is beyond eof
// compensate for the offset and clip file_range_length_ to eof
diff --git a/net/base/upload_data.h b/net/base/upload_data.h
index 71b8f3d..971489b 100644
--- a/net/base/upload_data.h
+++ b/net/base/upload_data.h
@@ -30,6 +30,7 @@
#ifndef NET_BASE_UPLOAD_DATA_H__
#define NET_BASE_UPLOAD_DATA_H__
+#include <string>
#include <vector>
#include "base/basictypes.h"