Skip to content

Commit 547b587

Browse files
authored
Fix improperly mutable pointers to string constants (project-chip#30804)
* Fix improperly mutable pointers to string constants The declaration const char * kStringConstant = "value"; declares a mutable pointer to const C string, and so the following assignment is legal: kStringConstant = "other value"; Obviously this is not desired. Declaring as "const char * const" avoids this, but this declares an unnecessary pointer. Change these declarations to "const(expr) char []". These edits were made by the following command: find . -name .git -prune -o -name .environment -prune -o -name third_party -prune -o -name zzz_generated -prune -o -name out -prune -o -type f \( -name '*.cpp' -o -name '*.h' \) -exec sed -i 's,^\( *\)\(static \|extern \|\)\(inline \|\)\(constexpr \|\)const char *\* * k\([A-Z][^][ ;()]*\)\( \|;\),\1\2\3\4const char k\5[]\6,g; s,^\([^()]*\)constexpr const char k\([^()]*\)\( \|;\),\1constexpr char k\2\3,g; s,^\( *\)const\(expr\|\) char \([^()]*\)\[\] *= ",\1static const\2 char \3[] = ",g' {} + with 2 fixes to add "inline" in constants defined in headers. * Fix more mutable string constants Fix static variables inside functions not named in kConstantNamingStyle: find . -name .git -prune -o -name .environment -prune -o -name third_party -prune -o -name zzz_generated -prune -o -name out -prune -o -type f \( -name '*.cpp' -o -name '*.h' \) -exec sed -i 's,^\( *\)\(static \|extern \)\(inline \|\)\(constexpr \|\)const char *\* * \([^][ ;()]*\)\( *= *"\|;\),\1\2\3\4const char \5[]\6,g' {} + Fix file scoped variables not named named in kConstantNamingStyle: find . -name .git -prune -o -name .environment -prune -o -name third_party -prune -o -name zzz_generated -prune -o -name out -prune -o -type f \( -name '*.cpp' -o -name '*.h' \) -exec sed -i 's,^\(\)\(static \|extern \|\)\(inline \|\)\(constexpr \|\)const char *\* * \([^][ ;()]*\)\( *= *"\|;\),\1\2\3\4const char \5[]\6,g' {} + * Also fix objc++ find . -name .git -prune -o -name .environment -prune -o -name third_party -prune -o -name zzz_generated -prune -o -name out -prune -o -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.mm' \) -exec sed -i 's,^\( *\)\(static \|extern \|\)\(inline \|\)\(constexpr \|\)const char *\* * k\([A-Z][^][ ;()]*\)\( \|;\),\1\2\3\4const char k\5[]\6,g; s,^\([^()]*\)constexpr const char k\([^()]*\)\( \|;\),\1constexpr char k\2\3,g; s,^\( *\)const\(expr\|\) char \([^()]*\)\[\] *= ",\1static const\2 char \3[] = ",g' {} +
1 parent 450fe1d commit 547b587

File tree

160 files changed

+470
-470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+470
-470
lines changed

examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <ota/OTAInitializer.h>
4444
#endif
4545

46-
static const char * TAG = "app-devicecallbacks";
46+
static const char TAG[] = "app-devicecallbacks";
4747

4848
using namespace ::chip;
4949
using namespace ::chip::Inet;

examples/air-quality-sensor-app/linux/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ using namespace chip::app;
3535
using namespace chip::app::Clusters;
3636

3737
namespace {
38-
constexpr const char kChipEventFifoPathPrefix[] = "/tmp/chip_air_quality_fifo_";
38+
constexpr char kChipEventFifoPathPrefix[] = "/tmp/chip_air_quality_fifo_";
3939
NamedPipeCommands sChipNamedPipeCommands;
4040
AirQualitySensorAppAttrUpdateDelegate sAirQualitySensorAppCommandDelegate;
4141
} // namespace

examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ CHIP_ERROR ActionsAttrAccess::ReadEndpointListAttribute(EndpointId endpoint, Att
6363

6464
CHIP_ERROR ActionsAttrAccess::ReadSetupUrlAttribute(EndpointId endpoint, AttributeValueEncoder & aEncoder)
6565
{
66-
const char SetupUrl[] = "https://example.com";
66+
static const char SetupUrl[] = "https://example.com";
6767
return aEncoder.Encode(chip::Span<const char>(SetupUrl, strlen(SetupUrl)));
6868
}
6969

examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#include "Globals.h"
4646
#include "LEDWidget.h"
4747

48-
static const char * TAG = "app-devicecallbacks";
48+
static const char TAG[] = "app-devicecallbacks";
4949

5050
using namespace ::chip;
5151
using namespace ::chip::Inet;

examples/all-clusters-app/esp32/main/AppTask.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#define APP_EVENT_QUEUE_SIZE 10
4343
#define APP_TASK_STACK_SIZE (3072)
4444

45-
static const char * TAG = "app-task";
45+
static const char TAG[] = "app-task";
4646

4747
namespace {
4848
TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer

examples/all-clusters-app/esp32/main/BluetoothWidget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "ScreenManager.h"
3232
#endif
3333

34-
extern const char * TAG;
34+
extern const char TAG[];
3535

3636
void BluetoothWidget::Init()
3737
{

examples/all-clusters-app/esp32/main/Button.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include <platform/CHIPDeviceLayer.h>
3636
#include <vector>
3737

38-
static const char * TAG = "Button.cpp";
38+
static const char TAG[] = "Button.cpp";
3939

4040
extern Button gButtons[BUTTON_NUMBER];
4141

examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include <app-common/zap-generated/ids/Clusters.h>
4242
#endif
4343

44-
static const char * TAG = "app-devicecallbacks";
44+
static const char TAG[] = "app-devicecallbacks";
4545

4646
using namespace ::chip;
4747
using namespace ::chip::Inet;

examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ using namespace ::chip::Credentials;
2828
using namespace ::chip::DeviceManager;
2929
using namespace ::chip::DeviceLayer;
3030

31-
static const char * TAG = "DeviceWithDisplay";
31+
static const char TAG[] = "DeviceWithDisplay";
3232

3333
#if CONFIG_DEVICE_TYPE_M5STACK
3434

examples/all-clusters-app/esp32/main/QRCodeScreen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
4444

4545
// TODO need sensible library tag when put in library
46-
extern const char * TAG;
46+
extern const char TAG[];
4747

4848
namespace {
4949

examples/all-clusters-app/esp32/main/WiFiWidget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "ScreenManager.h"
3232
#endif
3333

34-
extern const char * TAG;
34+
extern const char TAG[];
3535

3636
void WiFiWidget::Init()
3737
{

examples/all-clusters-app/esp32/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ using namespace ::chip::Credentials;
7272
// Used to indicate that an IP address has been added to the QRCode
7373
#define EXAMPLE_VENDOR_TAG_IP 1
7474

75-
const char * TAG = "all-clusters-app";
75+
extern const char TAG[] = "all-clusters-app";
7676

7777
static AppDeviceCallbacks EchoCallbacks;
7878
static AppDeviceCallbacksDelegate sAppDeviceCallbacksDelegate;

examples/all-clusters-app/linux/main-common.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ using namespace chip::DeviceLayer;
5454

5555
namespace {
5656

57-
constexpr const char kChipEventFifoPathPrefix[] = "/tmp/chip_all_clusters_fifo_";
57+
constexpr char kChipEventFifoPathPrefix[] = "/tmp/chip_all_clusters_fifo_";
5858
LowPowerManager sLowPowerManager;
5959
NamedPipeCommands sChipNamedPipeCommands;
6060
AllClustersCommandDelegate sAllClustersCommandDelegate;

examples/all-clusters-app/nxp/mw320/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ enum
111111
};
112112
static int Matter_Selection = MAX_SELECTION;
113113
#define RUN_RST_LT_DELAY 10
114-
static const char * TAG = "mw320";
114+
static const char TAG[] = "mw320";
115115

116116
/*******************************************************************************
117117
* Variables

examples/all-clusters-minimal-app/ameba/main/DeviceCallbacks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "Globals.h"
4141
#include "LEDWidget.h"
4242

43-
static const char * TAG = "app-devicecallbacks";
43+
static const char TAG[] = "app-devicecallbacks";
4444

4545
using namespace ::chip;
4646
using namespace ::chip::Inet;

examples/all-clusters-minimal-app/esp32/main/AppTask.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define APP_EVENT_QUEUE_SIZE 10
4242
#define APP_TASK_STACK_SIZE (3072)
4343

44-
static const char * TAG = "app-task";
44+
static const char TAG[] = "app-task";
4545

4646
namespace {
4747

examples/all-clusters-minimal-app/esp32/main/BluetoothWidget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "ScreenManager.h"
3232
#endif
3333

34-
extern const char * TAG;
34+
extern const char TAG[];
3535

3636
void BluetoothWidget::Init()
3737
{

examples/all-clusters-minimal-app/esp32/main/Button.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <platform/CHIPDeviceLayer.h>
3939
#include <vector>
4040

41-
static const char * TAG = "Button.cpp";
41+
static const char TAG[] = "Button.cpp";
4242

4343
extern Button gButtons[BUTTON_NUMBER];
4444

examples/all-clusters-minimal-app/esp32/main/DeviceCallbacks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include <app-common/zap-generated/ids/Clusters.h>
4141
#endif
4242

43-
static const char * TAG = "app-devicecallbacks";
43+
static const char TAG[] = "app-devicecallbacks";
4444

4545
using namespace ::chip;
4646
using namespace ::chip::Inet;

examples/all-clusters-minimal-app/esp32/main/DeviceWithDisplay.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using namespace ::chip::Credentials;
2727
using namespace ::chip::DeviceManager;
2828
using namespace ::chip::DeviceLayer;
2929

30-
static const char * TAG = "DeviceWithDisplay";
30+
static const char TAG[] = "DeviceWithDisplay";
3131

3232
#if CONFIG_DEVICE_TYPE_M5STACK
3333

examples/all-clusters-minimal-app/esp32/main/QRCodeScreen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
4444

4545
// TODO need sensible library tag when put in library
46-
extern const char * TAG;
46+
extern const char TAG[];
4747

4848
namespace {
4949

examples/all-clusters-minimal-app/esp32/main/WiFiWidget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#if CONFIG_HAVE_DISPLAY
3131
#include "ScreenManager.h"
3232
#endif
33-
extern const char * TAG;
33+
extern const char TAG[];
3434

3535
void WiFiWidget::Init()
3636
{

examples/all-clusters-minimal-app/esp32/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ using namespace ::chip::DeviceManager;
7070
// Used to indicate that an IP address has been added to the QRCode
7171
#define EXAMPLE_VENDOR_TAG_IP 1
7272

73-
const char * TAG = "all-clusters-minimal-app";
73+
extern const char TAG[] = "all-clusters-minimal-app";
7474

7575
static AppDeviceCallbacks EchoCallbacks;
7676
static AppDeviceCallbacksDelegate sAppDeviceCallbacksDelegate;

examples/bridge-app/asr/src/bridged-actions-stub.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ CHIP_ERROR ActionsAttrAccess::ReadEndpointListAttribute(EndpointId endpoint, Att
6262

6363
CHIP_ERROR ActionsAttrAccess::ReadSetupUrlAttribute(EndpointId endpoint, AttributeValueEncoder & aEncoder)
6464
{
65-
const char SetupUrl[] = "https://example.com";
65+
static const char SetupUrl[] = "https://example.com";
6666
return aEncoder.Encode(chip::Span<const char>(SetupUrl, strlen(SetupUrl)));
6767
}
6868

examples/bridge-app/esp32/main/DeviceCallbacks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "DeviceCallbacks.h"
2828

29-
static const char * TAG = "bridge-devicecallbacks";
29+
static const char TAG[] = "bridge-devicecallbacks";
3030

3131
using namespace ::chip;
3232
using namespace ::chip::app;
@@ -78,7 +78,7 @@ CHIP_ERROR ActionsAttrAccess::ReadEndpointListAttribute(EndpointId endpoint, Att
7878

7979
CHIP_ERROR ActionsAttrAccess::ReadSetupUrlAttribute(EndpointId endpoint, AttributeValueEncoder & aEncoder)
8080
{
81-
const char SetupUrl[] = "https://example.com";
81+
static const char SetupUrl[] = "https://example.com";
8282
return aEncoder.Encode(chip::CharSpan::fromCharString(SetupUrl));
8383
}
8484

examples/bridge-app/esp32/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
6060
#endif // CONFIG_ENABLE_ESP32_DEVICE_INFO_PROVIDER
6161
} // namespace
6262

63-
const char * TAG = "bridge-app";
63+
extern const char TAG[] = "bridge-app";
6464

6565
using namespace ::chip;
6666
using namespace ::chip::DeviceManager;

examples/bridge-app/linux/bridged-actions-stub.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ CHIP_ERROR ActionsAttrAccess::ReadEndpointListAttribute(EndpointId endpoint, Att
9898

9999
CHIP_ERROR ActionsAttrAccess::ReadSetupUrlAttribute(EndpointId endpoint, AttributeValueEncoder & aEncoder)
100100
{
101-
const char SetupUrl[] = "https://example.com";
101+
static const char SetupUrl[] = "https://example.com";
102102
return aEncoder.Encode(chip::CharSpan::fromCharString(SetupUrl));
103103
}
104104

examples/bridge-app/telink/src/DeviceCallbacks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ CHIP_ERROR ActionsAttrAccess::ReadEndpointListAttribute(EndpointId endpoint, Att
6666

6767
CHIP_ERROR ActionsAttrAccess::ReadSetupUrlAttribute(EndpointId endpoint, AttributeValueEncoder & aEncoder)
6868
{
69-
const char SetupUrl[] = "https://example.com";
69+
static const char SetupUrl[] = "https://example.com";
7070
return aEncoder.Encode(chip::CharSpan::fromCharString(SetupUrl));
7171
}
7272

examples/chef/ameba/main/DeviceCallbacks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include "Globals.h"
4444
#include "LEDWidget.h"
4545

46-
static const char * TAG = "app-devicecallbacks";
46+
static const char TAG[] = "app-devicecallbacks";
4747

4848
using namespace ::chip;
4949
using namespace ::chip::Inet;

examples/chef/esp32/main/QRCodeScreen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
4444

4545
// TODO need sensible library tag when put in library
46-
extern const char * TAG;
46+
extern const char TAG[];
4747

4848
namespace {
4949

examples/chef/esp32/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg)
122122
ChipLogProgress(Shell, "Current free heap: %u\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
123123
}
124124

125-
const char * TAG = "chef-app";
125+
extern const char TAG[] = "chef-app";
126126

127127
#if CONFIG_HAVE_DISPLAY
128128
void printQRCode()

examples/chip-tool/commands/clusters/ComplexArgument.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545

4646
#include "JsonParser.h"
4747

48-
inline constexpr uint8_t kMaxLabelLength = UINT8_MAX;
49-
inline constexpr const char kNullString[] = "null";
48+
inline constexpr uint8_t kMaxLabelLength = UINT8_MAX;
49+
inline constexpr char kNullString[] = "null";
5050

5151
class ComplexArgumentParser
5252
{

examples/chip-tool/commands/clusters/CustomArgument.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ class CustomArgument
239239
CHIP_ERROR Parse(const char * label, const char * json)
240240
{
241241
Json::Value value;
242-
constexpr const char kHexNumPrefix[] = "0x";
243-
constexpr size_t kHexNumPrefixLen = ArraySize(kHexNumPrefix) - 1;
242+
static constexpr char kHexNumPrefix[] = "0x";
243+
constexpr size_t kHexNumPrefixLen = ArraySize(kHexNumPrefix) - 1;
244244
if (strncmp(json, kPayloadHexPrefix, kPayloadHexPrefixLen) == 0 ||
245245
strncmp(json, kPayloadSignedPrefix, kPayloadSignedPrefixLen) == 0 ||
246246
strncmp(json, kPayloadUnsignedPrefix, kPayloadUnsignedPrefixLen) == 0 ||

examples/chip-tool/commands/clusters/WriteAttributeCommand.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
#include "DataModelLogger.h"
2424
#include "ModelCommand.h"
2525

26-
inline constexpr const char * kWriteCommandKey = "write";
27-
inline constexpr const char * kWriteByIdCommandKey = "write-by-id";
28-
inline constexpr const char * kForceWriteCommandKey = "force-write";
26+
inline constexpr char kWriteCommandKey[] = "write";
27+
inline constexpr char kWriteByIdCommandKey[] = "write-by-id";
28+
inline constexpr char kForceWriteCommandKey[] = "force-write";
2929

3030
enum class WriteCommandType
3131
{

examples/chip-tool/commands/common/CHIPCommand.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ std::set<CHIPCommand *> CHIPCommand::sDeferredCleanups;
3737

3838
using DeviceControllerFactory = chip::Controller::DeviceControllerFactory;
3939

40-
constexpr chip::FabricId kIdentityNullFabricId = chip::kUndefinedFabricId;
41-
constexpr chip::FabricId kIdentityAlphaFabricId = 1;
42-
constexpr chip::FabricId kIdentityBetaFabricId = 2;
43-
constexpr chip::FabricId kIdentityGammaFabricId = 3;
44-
constexpr chip::FabricId kIdentityOtherFabricId = 4;
45-
constexpr const char * kPAATrustStorePathVariable = "CHIPTOOL_PAA_TRUST_STORE_PATH";
46-
constexpr const char * kCDTrustStorePathVariable = "CHIPTOOL_CD_TRUST_STORE_PATH";
40+
constexpr chip::FabricId kIdentityNullFabricId = chip::kUndefinedFabricId;
41+
constexpr chip::FabricId kIdentityAlphaFabricId = 1;
42+
constexpr chip::FabricId kIdentityBetaFabricId = 2;
43+
constexpr chip::FabricId kIdentityGammaFabricId = 3;
44+
constexpr chip::FabricId kIdentityOtherFabricId = 4;
45+
constexpr char kPAATrustStorePathVariable[] = "CHIPTOOL_PAA_TRUST_STORE_PATH";
46+
constexpr char kCDTrustStorePathVariable[] = "CHIPTOOL_CD_TRUST_STORE_PATH";
4747

4848
const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr;
4949
chip::Credentials::GroupDataProviderImpl CHIPCommand::sGroupDataProvider{ kMaxGroupsPerFabric, kMaxGroupKeysPerFabric };

examples/chip-tool/commands/common/CHIPCommand.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434

3535
#pragma once
3636

37-
inline constexpr const char kIdentityAlpha[] = "alpha";
38-
inline constexpr const char kIdentityBeta[] = "beta";
39-
inline constexpr const char kIdentityGamma[] = "gamma";
37+
inline constexpr char kIdentityAlpha[] = "alpha";
38+
inline constexpr char kIdentityBeta[] = "beta";
39+
inline constexpr char kIdentityGamma[] = "gamma";
4040
// The null fabric commissioner is a commissioner that isn't on a fabric.
4141
// This is a legal configuration in which the commissioner delegates
4242
// operational communication and invocation of the commssioning complete
@@ -46,7 +46,7 @@ inline constexpr const char kIdentityGamma[] = "gamma";
4646
// commissioner portion of such an architecture. The null-fabric-commissioner
4747
// can carry a commissioning flow up until the point of operational channel
4848
// (CASE) communcation.
49-
inline constexpr const char kIdentityNull[] = "null-fabric-commissioner";
49+
inline constexpr char kIdentityNull[] = "null-fabric-commissioner";
5050

5151
class CHIPCommand : public Command
5252
{

examples/chip-tool/commands/common/Command.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <lib/support/StringSplitter.h>
3939
#include <lib/support/logging/CHIPLogging.h>
4040

41-
constexpr const char * kOptionalArgumentPrefix = "--";
41+
constexpr char kOptionalArgumentPrefix[] = "--";
4242
constexpr size_t kOptionalArgumentPrefixLength = 2;
4343

4444
bool Command::InitArguments(int argc, char ** argv)
@@ -347,8 +347,8 @@ bool Command::InitArgument(size_t argIndex, char * argValue)
347347
// By default the parameter separator is ";" in order to not collapse with the argument itself if it contains commas
348348
// (e.g a struct argument with multiple fields). In case one needs to use ";" it can be overriden with the following
349349
// environment variable.
350-
constexpr const char * kSeparatorVariable = "CHIPTOOL_CUSTOM_ARGUMENTS_SEPARATOR";
351-
char * getenvSeparatorVariableResult = getenv(kSeparatorVariable);
350+
static constexpr char kSeparatorVariable[] = "CHIPTOOL_CUSTOM_ARGUMENTS_SEPARATOR";
351+
char * getenvSeparatorVariableResult = getenv(kSeparatorVariable);
352352
getline(ss, valueAsString, getenvSeparatorVariableResult ? getenvSeparatorVariableResult[0] : ';');
353353

354354
CustomArgument * customArgument = new CustomArgument();

0 commit comments

Comments
 (0)