Change parameter type from pointer to array

This commit is contained in:
GHOSCHT 2022-02-05 19:19:38 +01:00
parent 3740769a01
commit 620cdd25ac
No known key found for this signature in database
GPG key ID: A35BD466B8871994
2 changed files with 4 additions and 4 deletions

View file

@ -13,7 +13,7 @@ void StreamCommunicator::sendMessage(int *values, __SIZE_TYPE__ numberOfValues)
stream.println(message); stream.println(message);
} }
void StreamCommunicator::sendMessage(char *message) void StreamCommunicator::sendMessage(const char message[])
{ {
stream.println(message); stream.println(message);
} }
@ -33,7 +33,7 @@ __SIZE_TYPE__ StreamCommunicator::calculateMessageOutSize(__SIZE_TYPE__ numberOf
return numberOfValues + (numberOfValues - 1) + 1; return numberOfValues + (numberOfValues - 1) + 1;
} }
void StreamCommunicator::parseIDs(int *values, __SIZE_TYPE__ numberOfValues, char *output) void StreamCommunicator::parseIDs(const int values[], __SIZE_TYPE__ numberOfValues, char *output)
{ {
__SIZE_TYPE__ outputSize = calculateMessageOutSize(numberOfValues); __SIZE_TYPE__ outputSize = calculateMessageOutSize(numberOfValues);
__SIZE_TYPE__ outputCharPointer = 0; __SIZE_TYPE__ outputCharPointer = 0;

View file

@ -7,12 +7,12 @@ protected:
char *messageBuffer; char *messageBuffer;
__SIZE_TYPE__ bufferSize; __SIZE_TYPE__ bufferSize;
__SIZE_TYPE__ calculateMessageOutSize(__SIZE_TYPE__ numberOfValues); __SIZE_TYPE__ calculateMessageOutSize(__SIZE_TYPE__ numberOfValues);
void parseIDs(int *values, __SIZE_TYPE__ numberOfValues, char *out); void parseIDs(const int values[], __SIZE_TYPE__ numberOfValues, char *out);
public: public:
StreamCommunicator(Stream &s_out, __SIZE_TYPE__ bufferSize); StreamCommunicator(Stream &s_out, __SIZE_TYPE__ bufferSize);
void sendMessage(int *values, __SIZE_TYPE__ numberOfValues); void sendMessage(int *values, __SIZE_TYPE__ numberOfValues);
void sendMessage(char *message); void sendMessage(const char message[]);
char *receiveMessage(); char *receiveMessage();
char *getBuffer(); char *getBuffer();
int getBufferSize(); int getBufferSize();