Update tuple storage functions
This commit is contained in:
parent
24e5e14a6d
commit
6ab8a2380a
|
@ -2,7 +2,7 @@
|
||||||
* SerialPort_Windows.c
|
* SerialPort_Windows.c
|
||||||
*
|
*
|
||||||
* Created on: Feb 25, 2012
|
* Created on: Feb 25, 2012
|
||||||
* Last Updated on: Nov 01, 2021
|
* Last Updated on: Nov 03, 2021
|
||||||
* Author: Will Hedgecock
|
* Author: Will Hedgecock
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2021 Fazecast, Inc.
|
* Copyright (C) 2012-2021 Fazecast, Inc.
|
||||||
|
@ -107,7 +107,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_fazecast_jSerialComm_SerialPort_getCommP
|
||||||
wchar_t* descriptionString = wcsrchr(valueName, L'\\') ? (wcsrchr(valueName, L'\\') + 1) : valueName;
|
wchar_t* descriptionString = wcsrchr(valueName, L'\\') ? (wcsrchr(valueName, L'\\') + 1) : valueName;
|
||||||
|
|
||||||
// Add new SerialComm object to vector
|
// Add new SerialComm object to vector
|
||||||
push_back(&serialCommPorts, comPortString, descriptionString, descriptionString);
|
pushBack(&serialCommPorts, comPortString, descriptionString, descriptionString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
* WindowsHelperFunctions.c
|
* WindowsHelperFunctions.c
|
||||||
*
|
*
|
||||||
* Created on: May 05, 2015
|
* Created on: May 05, 2015
|
||||||
* Last Updated on: Mar 25, 2016
|
* Last Updated on: Nov 03, 2021
|
||||||
* Author: Will Hedgecock
|
* Author: Will Hedgecock
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2020 Fazecast, Inc.
|
* Copyright (C) 2012-2021 Fazecast, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of jSerialComm.
|
* This file is part of jSerialComm.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "WindowsHelperFunctions.h"
|
#include "WindowsHelperFunctions.h"
|
||||||
|
|
||||||
void push_back(struct charTupleVector* vector, const wchar_t* firstString, const wchar_t* secondString, const wchar_t* thirdString)
|
void pushBack(struct charTupleVector* vector, const wchar_t* key, const wchar_t* firstString, const wchar_t* secondString)
|
||||||
{
|
{
|
||||||
// Allocate memory for new string storage
|
// Allocate memory for new string storage
|
||||||
vector->length++;
|
vector->length++;
|
||||||
|
@ -43,12 +43,12 @@ void push_back(struct charTupleVector* vector, const wchar_t* firstString, const
|
||||||
vector->third = newMemory;
|
vector->third = newMemory;
|
||||||
|
|
||||||
// Store new strings
|
// Store new strings
|
||||||
vector->first[vector->length-1] = (wchar_t*)malloc((wcslen(firstString)+1)*sizeof(wchar_t));
|
vector->first[vector->length-1] = (wchar_t*)malloc((wcslen(key)+1)*sizeof(wchar_t));
|
||||||
vector->second[vector->length-1] = (wchar_t*)malloc((wcslen(secondString)+1)*sizeof(wchar_t));
|
vector->second[vector->length-1] = (wchar_t*)malloc((wcslen(firstString)+1)*sizeof(wchar_t));
|
||||||
vector->third[vector->length-1] = (wchar_t*)malloc((wcslen(thirdString)+1)*sizeof(wchar_t));
|
vector->third[vector->length-1] = (wchar_t*)malloc((wcslen(secondString)+1)*sizeof(wchar_t));
|
||||||
wcscpy(vector->first[vector->length-1], firstString);
|
wcscpy(vector->first[vector->length-1], key);
|
||||||
wcscpy(vector->second[vector->length-1], secondString);
|
wcscpy(vector->second[vector->length-1], firstString);
|
||||||
wcscpy(vector->third[vector->length-1], thirdString);
|
wcscpy(vector->third[vector->length-1], secondString);
|
||||||
}
|
}
|
||||||
|
|
||||||
char keyExists(struct charTupleVector* vector, const wchar_t* key)
|
char keyExists(struct charTupleVector* vector, const wchar_t* key)
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
* WindowsHelperFunctions.h
|
* WindowsHelperFunctions.h
|
||||||
*
|
*
|
||||||
* Created on: May 05, 2015
|
* Created on: May 05, 2015
|
||||||
* Last Updated on: Apr 01, 2018
|
* Last Updated on: Nov 03, 2021
|
||||||
* Author: Will Hedgecock
|
* Author: Will Hedgecock
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2020 Fazecast, Inc.
|
* Copyright (C) 2012-2021 Fazecast, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of jSerialComm.
|
* This file is part of jSerialComm.
|
||||||
*
|
*
|
||||||
|
@ -31,7 +31,8 @@ typedef struct charTupleVector
|
||||||
wchar_t **first, **second, **third;
|
wchar_t **first, **second, **third;
|
||||||
size_t length;
|
size_t length;
|
||||||
} charTupleVector;
|
} charTupleVector;
|
||||||
void push_back(struct charTupleVector* vector, const wchar_t* firstString, const wchar_t* secondString, const wchar_t* thirdString);
|
|
||||||
|
void pushBack(struct charTupleVector* vector, const wchar_t* key, const wchar_t* firstString, const wchar_t* secondString);
|
||||||
char keyExists(struct charTupleVector* vector, const wchar_t* key);
|
char keyExists(struct charTupleVector* vector, const wchar_t* key);
|
||||||
|
|
||||||
#endif // #ifndef __WINDOWS_HELPER_FUNCTIONS_HEADER_H__
|
#endif // #ifndef __WINDOWS_HELPER_FUNCTIONS_HEADER_H__
|
||||||
|
|
Loading…
Reference in New Issue