From b1d1488de60dfff8b89872f863098a884133852f Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Tue, 23 Jul 2024 21:26:30 +0100 Subject: New upstream version 0.0.0.72.1 --- UZ7HOUtils.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'UZ7HOUtils.c') diff --git a/UZ7HOUtils.c b/UZ7HOUtils.c index a2a8fe7..70d27e2 100644 --- a/UZ7HOUtils.c +++ b/UZ7HOUtils.c @@ -96,12 +96,24 @@ void freeString(string * Msg) string * Strings(TStringList * Q, int Index) { + // Gets string at index in stringlist + if (Index >= Q->Count) return NULL; return Q->Items[Index]; } +void replaceString(TStringList * Q, int Index, string * item) +{ + // Gets string at index in stringlist + + if (Index >= Q->Count) + return; + + Q->Items[Index] = item; +} + int Add(TStringList * Q, string * Entry) { Q->Items = realloc(Q->Items,(Q->Count + 1) * sizeof(void *)); @@ -166,16 +178,27 @@ void setlength(string * Msg, int Count) Msg->Length = Count; } -string * stringAdd(string * Msg, UCHAR * Chars, int Count) +string * mystringAdd(string * Msg, UCHAR * Chars, int Count, char * FILE, int LINE) { // Add Chars to string + if (Count < 0 || Count > 65536) + { + printf("stringAdd Strange Count %d called from %s %d\r\n", Count, FILE, LINE); + } + if (Msg->Length + Count > Msg->AllocatedLength) { Msg->AllocatedLength += Count + 256; Msg->Data = realloc(Msg->Data, Msg->AllocatedLength); } + if (Msg->Data == 0) + { + printf("realloc failed\r\n"); + exit(1); + } + memcpy(&Msg->Data[Msg->Length], Chars, Count); Msg->Length += Count; -- cgit v1.2.3