summaryrefslogtreecommitdiffstats
path: root/win8
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 08:40:57 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 08:40:57 +0000
commitd67eb0ff81a18335f099763db733cec9756c5b93 (patch)
treede0bcca630099e23fb8296b13e5552ad411e1404 /win8
parente21bdfb9c758ac411012ad84f83d26d3f7dd69fb (diff)
downloadchromium_src-d67eb0ff81a18335f099763db733cec9756c5b93.zip
chromium_src-d67eb0ff81a18335f099763db733cec9756c5b93.tar.gz
chromium_src-d67eb0ff81a18335f099763db733cec9756c5b93.tar.bz2
size_t fixes for building on win x64
Fixes C4267 warnings, and errors regarding passing size_t* when they chould be unsigned int *. winrt_utils: WindowsCreateString takes a UINT32 as size. Truncation would mean shorter than expected string, but presumably not a severe problem in this case. file_picker: The interface uses unsigned int, not size_t, so change implementation and callers to unsigned int. R=cpu@chromium.org BUG=166496 Review URL: https://chromiumcodereview.appspot.com/11884021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8')
-rw-r--r--win8/metro_driver/file_picker.cc10
-rw-r--r--win8/metro_driver/winrt_utils.cc3
2 files changed, 8 insertions, 5 deletions
diff --git a/win8/metro_driver/file_picker.cc b/win8/metro_driver/file_picker.cc
index 4977be6..71bd8fc 100644
--- a/win8/metro_driver/file_picker.cc
+++ b/win8/metro_driver/file_picker.cc
@@ -45,7 +45,9 @@ class StringVectorImpl : public mswr::RuntimeClass<StringVectorItf> {
return ::WindowsDuplicateString(strings_[index], item);
}
STDMETHOD(get_Size)(unsigned *size) {
- *size = strings_.size();
+ if (strings_.size() > UINT_MAX)
+ return E_UNEXPECTED;
+ *size = static_cast<unsigned>(strings_.size());
return S_OK;
}
STDMETHOD(GetView)(winfoundtn::Collections::IVectorView<HSTRING> **view) {
@@ -209,7 +211,7 @@ HRESULT OpenFilePickerSession::SinglePickerDone(SingleFileAsyncOp* async,
hr = storage_item->get_Path(file_path.GetAddressOf());
if (SUCCEEDED(hr)) {
- size_t path_len = 0;
+ UINT32 path_len = 0;
const wchar_t* path_str =
::WindowsGetStringRawBuffer(file_path.Get(), &path_len);
@@ -377,7 +379,7 @@ HRESULT OpenFilePickerSession::ComposeMultiFileResult(
// Empty the output string.
result->clear();
- size_t num_files = 0;
+ unsigned int num_files = 0;
HRESULT hr = files->get_Size(&num_files);
if (FAILED(hr))
return hr;
@@ -392,7 +394,7 @@ HRESULT OpenFilePickerSession::ComposeMultiFileResult(
FilePath base_path;
// Iterate through the collection and append the file paths to the result.
- for (size_t i = 0; i < num_files; ++i) {
+ for (unsigned int i = 0; i < num_files; ++i) {
mswr::ComPtr<winstorage::IStorageFile> file;
hr = files->GetAt(i, file.GetAddressOf());
if (FAILED(hr))
diff --git a/win8/metro_driver/winrt_utils.cc b/win8/metro_driver/winrt_utils.cc
index f00011d..04b97d0 100644
--- a/win8/metro_driver/winrt_utils.cc
+++ b/win8/metro_driver/winrt_utils.cc
@@ -23,7 +23,8 @@ void CheckHR(HRESULT hr, const char* message) {
HSTRING MakeHString(const string16& str) {
HSTRING hstr;
- if (FAILED(::WindowsCreateString(str.c_str(), str.size(), &hstr))) {
+ if (FAILED(::WindowsCreateString(str.c_str(), static_cast<UINT32>(str.size()),
+ &hstr))) {
PLOG(DFATAL) << "Hstring creation failed";
}
return hstr;