summaryrefslogtreecommitdiff
path: root/UZ7HOUtils.c
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2024-07-23 21:26:34 +0100
committerDave Hibberd <hibby@debian.org>2024-07-23 21:26:34 +0100
commit4172fa5fdbda80c64e25cb97f27c5b7b4cfee1ea (patch)
treeb6c2ffb8ae1248ab0e4b0fb9f1bc26119586b1c0 /UZ7HOUtils.c
parente67baf26b150eb848909ebb9f4e13bf6bed3bd0d (diff)
parentb1d1488de60dfff8b89872f863098a884133852f (diff)
Update upstream source from tag 'upstream/0.0.0.72.1'
Update to upstream version '0.0.0.72.1' with Debian dir 3be9dd1ec6203d09272f9d129187c43762eebbe7
Diffstat (limited to 'UZ7HOUtils.c')
-rw-r--r--UZ7HOUtils.c25
1 files changed, 24 insertions, 1 deletions
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;