From 4c9f611141f9850572ceb72379efdb0875764fda Mon Sep 17 00:00:00 2001 From: Eric Betts Date: Mon, 17 Jan 2022 14:46:17 -0800 Subject: [PATCH] Be more CONSTant with the parameters we will not modify --- client/include/pm3.h | 4 ++-- client/src/cmdmain.c | 2 +- client/src/cmdmain.h | 2 +- client/src/comms.c | 2 +- client/src/comms.h | 2 +- client/src/pm3.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/include/pm3.h b/client/include/pm3.h index ff0a69d0c..4cb348a9b 100644 --- a/client/include/pm3.h +++ b/client/include/pm3.h @@ -18,8 +18,8 @@ typedef struct pm3_device pm3; -pm3 *pm3_open(char *port); -int pm3_console(pm3 *dev, char *cmd); +pm3 *pm3_open(const char *port); +int pm3_console(pm3 *dev, const char *cmd); const char *pm3_name_get(pm3 *dev); void pm3_close(pm3 *dev); pm3 *pm3_get_current_dev(void); diff --git a/client/src/cmdmain.c b/client/src/cmdmain.c index beafe21b6..8c11f7bc5 100644 --- a/client/src/cmdmain.c +++ b/client/src/cmdmain.c @@ -351,7 +351,7 @@ static int CmdHelp(const char *Cmd) { // Entry point into our code: called whenever the user types a command and // then presses Enter, which the full command line that they typed. //----------------------------------------------------------------------------- -int CommandReceived(char *Cmd) { +int CommandReceived(const char *Cmd) { return CmdsParse(CommandTable, Cmd); } diff --git a/client/src/cmdmain.h b/client/src/cmdmain.h index 7a834d3c5..d39d9a0a6 100644 --- a/client/src/cmdmain.h +++ b/client/src/cmdmain.h @@ -22,7 +22,7 @@ #include "common.h" #include "cmdparser.h" // command_t -int CommandReceived(char *Cmd); +int CommandReceived(const char *Cmd); int CmdRem(const char *Cmd); command_t *getTopLevelCommandTable(void); diff --git a/client/src/comms.c b/client/src/comms.c index feea9523a..4c84dd3b2 100644 --- a/client/src/comms.c +++ b/client/src/comms.c @@ -549,7 +549,7 @@ bool IsCommunicationThreadDead(void) { return ret; } -bool OpenProxmark(pm3_device_t **dev, char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed) { +bool OpenProxmark(pm3_device_t **dev, const char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed) { if (!wait_for_port) { PrintAndLogEx(INFO, "Using UART port " _YELLOW_("%s"), port); diff --git a/client/src/comms.h b/client/src/comms.h index e400789d4..0c1329cda 100644 --- a/client/src/comms.h +++ b/client/src/comms.h @@ -84,7 +84,7 @@ void clearCommandBuffer(void); #define FLASHMODE_SPEED 460800 bool IsCommunicationThreadDead(void); -bool OpenProxmark(pm3_device_t **dev, char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed); +bool OpenProxmark(pm3_device_t **dev, const char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed); int TestProxmark(pm3_device_t *dev); void CloseProxmark(pm3_device_t *dev); diff --git a/client/src/pm3.c b/client/src/pm3.c index c10738803..1c0667ff2 100644 --- a/client/src/pm3.c +++ b/client/src/pm3.c @@ -27,7 +27,7 @@ #include "util_posix.h" #include "comms.h" -pm3_device_t *pm3_open(char *port) { +pm3_device_t *pm3_open(const char *port) { pm3_init(); OpenProxmark(&g_session.current_device, port, false, 20, false, USART_BAUD_RATE); if (g_session.pm3_present && (TestProxmark(g_session.current_device) != PM3_SUCCESS)) { @@ -54,7 +54,7 @@ void pm3_close(pm3_device_t *dev) { } } -int pm3_console(pm3_device_t *dev, char *cmd) { +int pm3_console(pm3_device_t *dev, const char *cmd) { // For now, there is no real device context: (void) dev; return CommandReceived(cmd);