diff options
| author | Dave Hibberd <hibby@debian.org> | 2024-07-23 21:26:30 +0100 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2024-07-23 21:26:30 +0100 |
| commit | b1d1488de60dfff8b89872f863098a884133852f (patch) | |
| tree | 71bff59b52ada4ab5d74a74f2186ac893d624a04 /UZ7HOUtils.c | |
| parent | 0804f4a994d4d16438baa207f7cd0ba8400e9494 (diff) | |
New upstream version 0.0.0.72.1upstream/0.0.0.72.1
Diffstat (limited to 'UZ7HOUtils.c')
| -rw-r--r-- | UZ7HOUtils.c | 25 |
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;
|
