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

Side by Side Diff: src/platform/update_engine/omaha_response_handler_action.cc

Issue 545072: AU: Gut code for old updater. New protobuf for v2 updater. (Closed)
Patch Set: better comments Created 10 years, 11 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. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "update_engine/omaha_response_handler_action.h" 5 #include "update_engine/omaha_response_handler_action.h"
6 #include <string> 6 #include <string>
7 #include "update_engine/utils.h" 7 #include "update_engine/utils.h"
8 8
9 using std::string; 9 using std::string;
10 10
(...skipping 29 matching lines...) Expand all
40 if (last_slash == string::npos) 40 if (last_slash == string::npos)
41 filename = response.codebase; 41 filename = response.codebase;
42 else 42 else
43 filename = response.codebase.substr(last_slash + 1); 43 filename = response.codebase.substr(last_slash + 1);
44 install_plan.is_full_update = (filename.find(kFullUpdateTag) != string::npos); 44 install_plan.is_full_update = (filename.find(kFullUpdateTag) != string::npos);
45 45
46 if (filename.size() > 255) { 46 if (filename.size() > 255) {
47 // Very long name. Let's shorten it 47 // Very long name. Let's shorten it
48 filename.resize(255); 48 filename.resize(255);
49 } 49 }
50 // TODO(adlr): come up with a better place to download to:
51 install_plan.download_path = string(utils::kStatefulPartition) + "/" +
52 filename;
53 if (HasOutputPipe()) 50 if (HasOutputPipe())
54 SetOutputObject(install_plan); 51 SetOutputObject(install_plan);
55 LOG(INFO) << "Using this install plan:"; 52 LOG(INFO) << "Using this install plan:";
56 install_plan.Dump(); 53 install_plan.Dump();
57 completer.set_success(true); 54 completer.set_success(true);
58 } 55 }
59 56
60 bool OmahaResponseHandlerAction::GetInstallDev(const std::string& boot_dev, 57 bool OmahaResponseHandlerAction::GetInstallDev(const std::string& boot_dev,
61 std::string* install_dev) { 58 std::string* install_dev) {
62 TEST_AND_RETURN_FALSE(!boot_dev.empty()); 59 TEST_AND_RETURN_FALSE(!boot_dev.empty());
63 string ret(boot_dev); 60 string ret(boot_dev);
64 char last_char = *ret.rbegin(); 61 char last_char = *ret.rbegin();
65 TEST_AND_RETURN_FALSE((last_char >= '0') && (last_char <= '9')); 62 TEST_AND_RETURN_FALSE((last_char >= '0') && (last_char <= '9'));
66 // Chop off last char 63 // Chop off last char
67 ret.resize(ret.size() - 1); 64 ret.resize(ret.size() - 1);
68 // If last_char is odd (1 or 3), increase it, otherwise decrease 65 // If last_char is odd (1 or 3), increase it, otherwise decrease
69 if (last_char % 2) 66 if (last_char % 2)
70 last_char++; 67 last_char++;
71 else 68 else
72 last_char--; 69 last_char--;
73 ret += last_char; 70 ret += last_char;
74 *install_dev = ret; 71 *install_dev = ret;
75 return true; 72 return true;
76 } 73 }
77 74
78 } // namespace chromeos_update_engine 75 } // namespace chromeos_update_engine
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698