diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 20:40:33 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 20:40:33 +0000 |
commit | 66f066a4e6f58626fc71c0d7a3447299402ea664 (patch) | |
tree | 32cfd91fb44944a34bcc92ec445af40de201efde | |
parent | 18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0 (diff) | |
download | chromium_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
-rw-r--r-- | net/SConscript | 8 | ||||
-rw-r--r-- | net/base/upload_data.cc | 15 | ||||
-rw-r--r-- | net/base/upload_data.h | 1 |
3 files changed, 10 insertions, 14 deletions
diff --git a/net/SConscript b/net/SConscript index 41ef951..10a58f0 100644 --- a/net/SConscript +++ b/net/SConscript @@ -71,6 +71,7 @@ input_files = [ 'base/net_module.cc', 'base/net_util.cc', 'base/registry_controlled_domain.cc', + 'base/upload_data.cc', 'disk_cache/backend_impl.cc', 'disk_cache/block_files.cc', 'disk_cache/entry_impl.cc', @@ -102,12 +103,10 @@ if env['PLATFORM'] == 'win32': 'base/host_resolver.cc', 'base/listen_socket.cc', 'base/mime_util.cc', - 'base/platform_mime_util_win.cc', 'base/ssl_client_socket.cc', 'base/ssl_config_service.cc', 'base/tcp_client_socket.cc', 'base/telnet_server.cc', - 'base/upload_data.cc', 'base/upload_data_stream.cc', 'base/wininet_util.cc', 'base/winsock_init.cc', @@ -141,6 +140,7 @@ if env['PLATFORM'] == 'win32': ], ) input_files.extend([ + 'base/platform_mime_util_win.cc', 'disk_cache/cache_util_win.cc', 'disk_cache/file_win.cc', 'disk_cache/mapped_file_win.cc', @@ -154,6 +154,8 @@ if env['PLATFORM'] == 'darwin': if env['PLATFORM'] in ('darwin', 'posix'): input_files.extend([ + # TODO(tc): gnome-vfs? xdgmime? /etc/mime.types? + #'base/platform_mime_util_linux.cc, 'disk_cache/cache_util_posix.cc', 'disk_cache/file_posix.cc', 'disk_cache/mapped_file_posix.cc', @@ -234,8 +236,8 @@ unittest_files = [ 'base/data_url_unittest.cc', 'base/escape_unittest.cc', 'base/gzip_filter_unittest.cc', - 'base/net_util_unittest.cc', 'base/mime_sniffer_unittest.cc', + 'base/net_util_unittest.cc', 'base/registry_controlled_domain_unittest.cc', 'disk_cache/addr_unittest.cc', 'http/http_chunked_decoder_unittest.cc', 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" |