Skip to content

Commit

Permalink
Fix more mutable string constants
Browse files Browse the repository at this point in the history
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' {} +
  • Loading branch information
mspang committed Dec 5, 2023
1 parent 1129dd4 commit b6c264a
Show file tree
Hide file tree
Showing 66 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <ota/OTAInitializer.h>
#endif

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "Globals.h"
#include "LEDWidget.h"

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define APP_EVENT_QUEUE_SIZE 10
#define APP_TASK_STACK_SIZE (3072)

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

namespace {
TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/BluetoothWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "ScreenManager.h"
#endif

extern const char * TAG;
extern const char TAG[];

void BluetoothWidget::Init()
{
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <vector>

static const char * TAG = "Button.cpp";
static const char TAG[] = "Button.cpp";

extern Button gButtons[BUTTON_NUMBER];

Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <app-common/zap-generated/ids/Clusters.h>
#endif

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using namespace ::chip::Credentials;
using namespace ::chip::DeviceManager;
using namespace ::chip::DeviceLayer;

static const char * TAG = "DeviceWithDisplay";
static const char TAG[] = "DeviceWithDisplay";

#if CONFIG_DEVICE_TYPE_M5STACK

Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/QRCodeScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <setup_payload/QRCodeSetupPayloadGenerator.h>

// TODO need sensible library tag when put in library
extern const char * TAG;
extern const char TAG[];

namespace {

Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/WiFiWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "ScreenManager.h"
#endif

extern const char * TAG;
extern const char TAG[];

void WiFiWidget::Init()
{
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ using namespace ::chip::Credentials;
// Used to indicate that an IP address has been added to the QRCode
#define EXAMPLE_VENDOR_TAG_IP 1

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

static AppDeviceCallbacks EchoCallbacks;
static AppDeviceCallbacksDelegate sAppDeviceCallbacksDelegate;
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/nxp/mw320/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ enum
};
static int Matter_Selection = MAX_SELECTION;
#define RUN_RST_LT_DELAY 10
static const char * TAG = "mw320";
static const char TAG[] = "mw320";

/*******************************************************************************
* Variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "Globals.h"
#include "LEDWidget.h"

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define APP_EVENT_QUEUE_SIZE 10
#define APP_TASK_STACK_SIZE (3072)

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

namespace {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "ScreenManager.h"
#endif

extern const char * TAG;
extern const char TAG[];

void BluetoothWidget::Init()
{
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/esp32/main/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <vector>

static const char * TAG = "Button.cpp";
static const char TAG[] = "Button.cpp";

extern Button gButtons[BUTTON_NUMBER];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <app-common/zap-generated/ids/Clusters.h>
#endif

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using namespace ::chip::Credentials;
using namespace ::chip::DeviceManager;
using namespace ::chip::DeviceLayer;

static const char * TAG = "DeviceWithDisplay";
static const char TAG[] = "DeviceWithDisplay";

#if CONFIG_DEVICE_TYPE_M5STACK

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <setup_payload/QRCodeSetupPayloadGenerator.h>

// TODO need sensible library tag when put in library
extern const char * TAG;
extern const char TAG[];

namespace {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#if CONFIG_HAVE_DISPLAY
#include "ScreenManager.h"
#endif
extern const char * TAG;
extern const char TAG[];

void WiFiWidget::Init()
{
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ using namespace ::chip::DeviceManager;
// Used to indicate that an IP address has been added to the QRCode
#define EXAMPLE_VENDOR_TAG_IP 1

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

static AppDeviceCallbacks EchoCallbacks;
static AppDeviceCallbacksDelegate sAppDeviceCallbacksDelegate;
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "DeviceCallbacks.h"

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

using namespace ::chip;
using namespace ::chip::app;
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
#endif // CONFIG_ENABLE_ESP32_DEVICE_INFO_PROVIDER
} // namespace

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

using namespace ::chip;
using namespace ::chip::DeviceManager;
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "Globals.h"
#include "LEDWidget.h"

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/esp32/main/QRCodeScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <setup_payload/QRCodeSetupPayloadGenerator.h>

// TODO need sensible library tag when put in library
extern const char * TAG;
extern const char TAG[];

namespace {

Expand Down
2 changes: 1 addition & 1 deletion examples/chef/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg)
ChipLogProgress(Shell, "Current free heap: %u\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
}

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

#if CONFIG_HAVE_DISPLAY
void printQRCode()
Expand Down
2 changes: 1 addition & 1 deletion examples/common/screen-framework/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// The M5Stack's backlight is on Channel 7
#define BACKLIGHT_CHANNEL LEDC_CHANNEL_7

static const char * TAG = "Display";
static const char TAG[] = "Display";

uint16_t DisplayHeight = 0;
uint16_t DisplayWidth = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/common/tracing/TraceDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <transport/raw/MessageHeader.h>

constexpr uint16_t kMaxLineLen = 4096;
constexpr const char * jsonPrefix = " json\t";
constexpr const char jsonPrefix[] = " json\t";

namespace chip {
namespace trace {
Expand Down
2 changes: 1 addition & 1 deletion examples/common/tracing/TraceDecoderArgumentParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ OptionDef sProgramOptionDefs[] = {
{}
};

const char * sProgramOptionHelp = " --source <filepath>\n"
const char sProgramOptionHelp[] = " --source <filepath>\n"
" The log file to decode.\n"
// Protocol
" --disable-protocol-secure-channel\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "Globals.h"
#include "LEDWidget.h"

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

using namespace chip;

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

Button AppButton;

Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/esp32/main/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define GPIO_INPUT_PIN_SEL (1ULL << GPIO_INPUT_IO_0)
#define ESP_INTR_FLAG_DEFAULT 0

static const char * TAG = "Button";
static const char TAG[] = "Button";

static Button::ButtonPressCallback button_press_handler = nullptr;

Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "DeviceCallbacks.h"
#include <lib/support/logging/CHIPLogging.h>

static const char * TAG = "light-switch-app-callbacks";
static const char TAG[] = "light-switch-app-callbacks";

using namespace chip;
using namespace chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
#endif // CONFIG_ENABLE_ESP32_DEVICE_INFO_PROVIDER
} // namespace

static const char * TAG = "light-switch-app";
static const char TAG[] = "light-switch-app";

static AppDeviceCallbacks EchoCallbacks;
static AppDeviceCallbacksDelegate sAppDeviceCallbacksDelegate;
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/ameba/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <ota/OTAInitializer.h>
#endif

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/beken/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <support/logging/CHIPLogging.h>
#include <support/logging/Constants.h>

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

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using namespace ::chip::app;
using namespace ::chip::Credentials;
using namespace ::chip::DeviceLayer;

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

LEDWidget AppLED;

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/esp32/main/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <vector>

static const char * TAG = "Button.cpp";
static const char TAG[] = "Button.cpp";

extern Button gButtons[BUTTON_NUMBER];

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <app/ConcreteAttributePath.h>
#include <lib/support/logging/CHIPLogging.h>

static const char * TAG = "light-app-callbacks";
static const char TAG[] = "light-app-callbacks";

extern LEDWidget AppLED;

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/esp32/main/DeviceWithDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using namespace ::chip::Credentials;
using namespace ::chip::DeviceManager;
using namespace ::chip::DeviceLayer;

static const char * TAG = "DeviceWithDisplay";
static const char TAG[] = "DeviceWithDisplay";

#if CONFIG_DEVICE_TYPE_M5STACK

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/esp32/main/LEDWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#endif
#include "led_strip.h"

static const char * TAG = "LEDWidget";
static const char TAG[] = "LEDWidget";

void LEDWidget::Init(void)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern const char insights_auth_key_start[] asm("_binary_insights_auth_key_txt_s
extern const char insights_auth_key_end[] asm("_binary_insights_auth_key_txt_end");
#endif

static const char * TAG = "light-app";
static const char TAG[] = "light-app";

static AppDeviceCallbacks EchoCallbacks;
static AppDeviceCallbacksDelegate sAppDeviceCallbacksDelegate;
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include <app-common/zap-generated/ids/Clusters.h>

static const char * TAG = "lock-devicecallbacks";
static const char TAG[] = "lock-devicecallbacks";

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
#endif // CONFIG_ENABLE_ESP32_DEVICE_INFO_PROVIDER
} // namespace

static const char * TAG = "lock-app";
static const char TAG[] = "lock-app";

static AppDeviceCallbacks EchoCallbacks;

Expand Down
2 changes: 1 addition & 1 deletion examples/ota-provider-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
**/
#include "DeviceCallbacks.h"

static const char * TAG = "echo-devicecallbacks";
static const char TAG[] = "echo-devicecallbacks";

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
Loading

0 comments on commit b6c264a

Please sign in to comment.