Skip to content

Commit

Permalink
Fix string constant declarations
Browse files Browse the repository at this point in the history
When defining string constants, we typically want both the string data
and the variable referring to the string data to be immutable, which is
commonly done by declaring the string constant variables as either
`const char[]` or `const char* const`. Declaring a string constant
variable as `const char*` still allows it to point to a different
immutable string. This CL changes a few string constant declarations
from `const char*` to `const char[]`.

BUG=None
TEST=chromeos_unittests

Review-Url: https://codereview.chromium.org/2286073002
Cr-Commit-Position: refs/heads/master@{#415015}
  • Loading branch information
cbchan authored and Commit bot committed Aug 29, 2016
1 parent 03e2e55 commit 11867eb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions chromeos/dbus/fake_shill_manager_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ bool IsCellularTechnology(const std::string& type) {
type == shill::kNetworkTechnologyLteAdvanced);
}

const char* kTechnologyUnavailable = "unavailable";
const char* kNetworkActivated = "activated";
const char* kNetworkDisabled = "disabled";
const char* kCellularServicePath = "/service/cellular1";
const char* kRoamingRequired = "required";
const char kTechnologyUnavailable[] = "unavailable";
const char kNetworkActivated[] = "activated";
const char kNetworkDisabled[] = "disabled";
const char kCellularServicePath[] = "/service/cellular1";
const char kRoamingRequired[] = "required";

} // namespace

Expand Down
24 changes: 12 additions & 12 deletions chromeos/disks/mock_disk_mount_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ namespace disks {

namespace {

const char* kTestSystemPath = "/this/system/path";
const char* kTestSystemPathPrefix = "/this/system";
const char* kTestDevicePath = "/this/device/path";
const char* kTestMountPath = "/media/foofoo";
const char* kTestFilePath = "/this/file/path";
const char* kTestDeviceLabel = "A label";
const char* kTestDriveLabel = "Another label";
const char* kTestVendorId = "0123";
const char* kTestVendorName = "A vendor";
const char* kTestProductId = "abcd";
const char* kTestProductName = "A product";
const char* kTestUuid = "FFFF-FFFF";
const char kTestSystemPath[] = "/this/system/path";
const char kTestSystemPathPrefix[] = "/this/system";
const char kTestDevicePath[] = "/this/device/path";
const char kTestMountPath[] = "/media/foofoo";
const char kTestFilePath[] = "/this/file/path";
const char kTestDeviceLabel[] = "A label";
const char kTestDriveLabel[] = "Another label";
const char kTestVendorId[] = "0123";
const char kTestVendorName[] = "A vendor";
const char kTestProductId[] = "abcd";
const char kTestProductName[] = "A product";
const char kTestUuid[] = "FFFF-FFFF";

} // namespace

Expand Down
2 changes: 1 addition & 1 deletion chromeos/network/network_state_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ void NetworkStateHandler::UpdateNetworkStats() {
void NetworkStateHandler::DefaultNetworkServiceChanged(
const std::string& service_path) {
// Shill uses '/' for empty service path values; check explicitly for that.
const char* kEmptyServicePath = "/";
const char kEmptyServicePath[] = "/";
std::string new_service_path =
(service_path != kEmptyServicePath) ? service_path : "";
if (new_service_path == default_network_path_)
Expand Down

0 comments on commit 11867eb

Please sign in to comment.