blob: c8d2b3eb1a61cd46fd91e7307c681e2ea0258c96 [file] [log] [blame]
Hridya Valsaraju31d2c262018-07-20 13:35:50 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "utility.h"
18
19using android::hardware::boot::V1_0::Slot;
20
21bool GetSlotNumber(const std::string& slot, Slot* number) {
22 if (slot.size() != 1) {
23 return false;
24 }
25 if (slot[0] < 'a' || slot[0] > 'z') {
26 return false;
27 }
28 *number = slot[0] - 'a';
29 return true;
30}