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

Side by Side Diff: chrome/installer/util/l10n_string_util.cc

Issue 151101: Fixit: Remove bunch of coverity warnings from chrome/installer/*. (Closed)
Patch Set: Created 11 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // This file defines specific implementation of BrowserDistribution class for
6 // Google Chrome.
7
1 #include <atlbase.h> 8 #include <atlbase.h>
2 #include <shlwapi.h> 9 #include <shlwapi.h>
3 10
4 #include <map> 11 #include <map>
5 12
6 #include "base/logging.h" 13 #include "base/logging.h"
7 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
8 #include "base/string_util.h" 15 #include "base/string_util.h"
9 16
10 #include "installer_util_strings.h" 17 #include "installer_util_strings.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 NOTREACHED() << "Unable to find resource id " << message_id; 166 NOTREACHED() << "Unable to find resource id " << message_id;
160 } 167 }
161 168
162 return localized_string; 169 return localized_string;
163 } 170 }
164 171
165 // Here we generate the url spec with the Microsoft res:// scheme which is 172 // Here we generate the url spec with the Microsoft res:// scheme which is
166 // explained here : http://support.microsoft.com/kb/220830 173 // explained here : http://support.microsoft.com/kb/220830
167 std::wstring GetLocalizedEulaResource() { 174 std::wstring GetLocalizedEulaResource() {
168 wchar_t full_exe_path[MAX_PATH]; 175 wchar_t full_exe_path[MAX_PATH];
169 int len = ::GetModuleFileNameW(NULL, full_exe_path, MAX_PATH); 176 int len = ::GetModuleFileName(NULL, full_exe_path, MAX_PATH);
170 if (len <= 0 && len >= MAX_PATH) 177 if (len == 0 || len == MAX_PATH)
171 return L""; 178 return L"";
172 std::wstring language = GetSystemLanguage(); 179 std::wstring language = GetSystemLanguage();
173 const wchar_t* resource = L"IDR_OEMPG_EN.HTML"; 180 const wchar_t* resource = L"IDR_OEMPG_EN.HTML";
174 181
175 static std::map<int, wchar_t*> html_map; 182 static std::map<int, wchar_t*> html_map;
176 if (html_map.empty()) { 183 if (html_map.empty()) {
177 html_map[IDS_L10N_OFFSET_AR] = L"IDR_OEMPG_AR.HTML"; 184 html_map[IDS_L10N_OFFSET_AR] = L"IDR_OEMPG_AR.HTML";
178 html_map[IDS_L10N_OFFSET_BG] = L"IDR_OEMPG_BG.HTML"; 185 html_map[IDS_L10N_OFFSET_BG] = L"IDR_OEMPG_BG.HTML";
179 html_map[IDS_L10N_OFFSET_CA] = L"IDR_OEMPG_CA.HTML"; 186 html_map[IDS_L10N_OFFSET_CA] = L"IDR_OEMPG_CA.HTML";
180 html_map[IDS_L10N_OFFSET_CS] = L"IDR_OEMPG_CS.HTML"; 187 html_map[IDS_L10N_OFFSET_CS] = L"IDR_OEMPG_CS.HTML";
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 DWORD count = url_path.size() * 3; 235 DWORD count = url_path.size() * 3;
229 scoped_ptr<wchar_t> url_canon(new wchar_t[count]); 236 scoped_ptr<wchar_t> url_canon(new wchar_t[count]);
230 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), 237 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(),
231 &count, URL_ESCAPE_UNSAFE); 238 &count, URL_ESCAPE_UNSAFE);
232 if (SUCCEEDED(hr)) 239 if (SUCCEEDED(hr))
233 return std::wstring(url_canon.get()); 240 return std::wstring(url_canon.get());
234 return url_path; 241 return url_path;
235 } 242 }
236 243
237 } // namespace installer_util 244 } // namespace installer_util
OLDNEW
« no previous file with comments | « chrome/installer/util/google_chrome_distribution_unittest.cc ('k') | chrome/installer/util/lzma_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698