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

Side by Side Diff: active_main_firmware.cc

Issue 3530001: first cut: establishes base helper classes and main (Closed) Base URL: http://git.chromium.org/git/cros_boot_mode.git
Patch Set: truncation is bad, m'kay. . . Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « active_main_firmware.h ('k') | boot_mode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium OS 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 // ActiveMainFirmware implementation
6
7 #include "active_main_firmware.h"
8
9 #include <sys/types.h>
10
11 #include "helpers.h"
12
13 namespace cros_boot_mode {
14
15 const char *ActiveMainFirmware::kActiveMainFirmwareText[] = {
16 "recovery",
17 "a",
18 "b",
19 };
20
21 const char *ActiveMainFirmware::c_str() const {
22 return (value() >= 0 ? kActiveMainFirmwareText[value()] : "unsupported");
23 }
24
25 const size_t ActiveMainFirmware::kActiveMainFirmwareCount =
26 sizeof(kActiveMainFirmwareText) / sizeof(*kActiveMainFirmwareText);
27
28 ActiveMainFirmware::ActiveMainFirmware() { }
29 ActiveMainFirmware::~ActiveMainFirmware() { }
30
31 int ActiveMainFirmware::Process(const char *contents, size_t length) {
32 int volume = helpers::to_int(contents, length);
33 if (volume >= 0 &&
34 volume < static_cast<int>(kActiveMainFirmwareCount))
35 return volume;
36 return kUnsupported;
37 }
38
39 } // namespace cros_boot_mode
OLDNEW
« no previous file with comments | « active_main_firmware.h ('k') | boot_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698