Skip to content

Commit

Permalink
fixing some compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-dixon committed Jan 25, 2024
1 parent 9112b1a commit 65eb45e
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 150 deletions.
47 changes: 24 additions & 23 deletions source/c_api/accAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ void unlockUdaThread()
*/
void udaFreeThread()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
udaLockThread(client_flags);
udaLockThread();
# ifdef __GNUC__
thread_t threadId = pthread_self();
# else
Expand All @@ -217,7 +216,7 @@ void udaFreeThread()
initServerBlock(&(idamState[threadCount].server_block), 0);
threadList[threadCount] = 0;
}
unlockUdaThread(client_flags);
unlockUdaThread();
}

#else
Expand Down Expand Up @@ -426,8 +425,9 @@ void reudaSetClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag)
* @param property the name of the property to set true or a name value pair.
* @return Void.
*/
void udaSetProperty(const char* property, CLIENT_FLAGS* client_flags)
void udaSetProperty(const char* property)
{
CLIENT_FLAGS* client_flags = udaClientFlags();
// User settings for Client and Server behaviour

char name[56];
Expand Down Expand Up @@ -526,8 +526,9 @@ void udaSetProperty(const char* property, CLIENT_FLAGS* client_flags)
* @param property the name of the property.
* @return Void.
*/
int udaGetProperty(const char* property, const CLIENT_FLAGS* client_flags)
int udaGetProperty(const char* property)
{
const CLIENT_FLAGS* client_flags = udaClientFlags();
// User settings for Client and Server behaviour

if (property[0] == 'g') {
Expand Down Expand Up @@ -602,8 +603,9 @@ int udaGetProperty(const char* property, const CLIENT_FLAGS* client_flags)
* @return Void.
*/

void udaResetProperty(const char* property, CLIENT_FLAGS* client_flags)
void udaResetProperty(const char* property)
{
CLIENT_FLAGS* client_flags = udaClientFlags();
// User settings for Client and Server behaviour

if (property[0] == 'g') {
Expand Down Expand Up @@ -993,8 +995,7 @@ int udaGetDataStatus(int handle)
*/
int udaGetLastHandle()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
return udaGetCurrentDataBlockIndex(client_flags);
return udaGetCurrentDataBlockIndex();
}

//! returns the number of data items in the data object
Expand Down Expand Up @@ -1338,21 +1339,21 @@ int udaGetErrorModelId(const char* model)
return 0;
}

char* udaGetSyntheticData(int handle)
{
if (handle < 0 || (unsigned int)handle >= data_blocks.size()) {
return nullptr;
}
return data_blocks[handle].synthetic;
}

char* udaGetSyntheticDimData(int handle, int ndim)
{
if (handle < 0 || (unsigned int)handle >= data_blocks.size()) {
return nullptr;
}
return data_blocks[handle].dims[ndim].synthetic;
}
// char* udaGetSyntheticData(int handle)
// {
// if (handle < 0 || (unsigned int)handle >= data_blocks.size()) {
// return nullptr;
// }
// return data_blocks[handle].synthetic;
// }

// char* udaGetSyntheticDimData(int handle, int ndim)
// {
// if (handle < 0 || (unsigned int)handle >= data_blocks.size()) {
// return nullptr;
// }
// return data_blocks[handle].dims[ndim].synthetic;
// }

void udaSetSyntheticData(int handle, char* data)
{
Expand Down
16 changes: 8 additions & 8 deletions source/c_api/udaGetAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int udaGetAPIWithHost(const char* data_object, const char* data_source, const ch
CLIENT_FLAGS* client_flags = udaClientFlags();

// Lock the thread
udaLockThread(client_flags);
udaLockThread();

if (host != nullptr) {
udaPutServerHost(host);
Expand Down Expand Up @@ -174,7 +174,7 @@ int udaGetAPIWithHost(const char* data_object, const char* data_source, const ch
static bool reopen_logs = true;

if (udaStartup(0, client_flags, &reopen_logs) != 0) {
unlockUdaThread(client_flags);
udaUnlockThread();
return PROBLEM_OPENING_LOGS;
}

Expand Down Expand Up @@ -217,7 +217,7 @@ int udaGetAPIWithHost(const char* data_object, const char* data_source, const ch
UDA_LOG(UDA_LOG_ERROR, "Error identifying the Data Source [%s]\n", data_source);
udaAddError(UDA_CODE_ERROR_TYPE, __func__, 999, "Error identifying the Data Source");
}
unlockUdaThread(client_flags);
udaUnlockThread();
return -err;
}

Expand Down Expand Up @@ -246,7 +246,7 @@ int udaGetAPIWithHost(const char* data_object, const char* data_source, const ch

freeClientRequestBlock(&request_block);
// Unlock the thread
unlockUdaThread(client_flags);
udaUnlockThread();
return handle;
}

Expand All @@ -261,7 +261,7 @@ int udaGetBatchAPIWithHost(const char** signals, const char** sources, int count
CLIENT_FLAGS* client_flags = udaClientFlags();

// Lock the thread
udaLockThread(client_flags);
udaLockThread();

if (host != nullptr) {
udaPutServerHost(host);
Expand All @@ -288,7 +288,7 @@ int udaGetBatchAPIWithHost(const char** signals, const char** sources, int count
static bool reopen_logs = true;

if (udaStartup(0, client_flags, &reopen_logs) != 0) {
unlockUdaThread(client_flags);
udaUnlockThread();
return PROBLEM_OPENING_LOGS;
}

Expand Down Expand Up @@ -331,7 +331,7 @@ int udaGetBatchAPIWithHost(const char** signals, const char** sources, int count
if (udaNumErrors() == 0) {
udaAddError(UDA_CODE_ERROR_TYPE, __func__, 999, "Error identifying the Data Source");
}
unlockUdaThread(client_flags);
udaUnlockThread();
return -err;
}

Expand All @@ -356,6 +356,6 @@ int udaGetBatchAPIWithHost(const char** signals, const char** sources, int count
#endif

// Unlock the thread
unlockUdaThread(client_flags);
udaUnlockThread();
return err;
}
26 changes: 13 additions & 13 deletions source/client/generateErrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ int generateIdamSyntheticData(int handle)
//--------------------------------------------------------------------------------------------------------------
// Return the Synthetic Data

if (udaSetSyntheticData(handle) == nullptr) {
if (udaGetSyntheticData(handle) == nullptr) {
if ((err = allocArray(udaGetDataType(handle), udaGetDataNum(handle), &synthetic))) {
udaAddError(UDA_CODE_ERROR_TYPE, "generateIdamSyntheticData", err,
"Problem Allocating Heap Memory for Synthetic Data");
Expand All @@ -301,84 +301,84 @@ int generateIdamSyntheticData(int handle)

switch (udaGetDataType(handle)) {
case UDA_TYPE_FLOAT: {
auto fp = (float*)udaSetSyntheticData(handle);
auto fp = (float*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
fp[i] = data[i]; // Overwrite the Data
}
break;
}
case UDA_TYPE_DOUBLE: {
auto dp = (double*)udaSetSyntheticData(handle);
auto dp = (double*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
dp[i] = (double)data[i];
}
break;
}
case UDA_TYPE_SHORT: {
auto sp = (short*)udaSetSyntheticData(handle);
auto sp = (short*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
sp[i] = (short)data[i];
}
break;
}
case UDA_TYPE_INT: {
auto ip = (int*)udaSetSyntheticData(handle);
auto ip = (int*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
ip[i] = (int)data[i];
}
break;
}
case UDA_TYPE_LONG: {
auto lp = (long*)udaSetSyntheticData(handle);
auto lp = (long*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
lp[i] = (long)data[i];
}
break;
}
case UDA_TYPE_LONG64: {
auto lp = (long long int*)udaSetSyntheticData(handle);
auto lp = (long long int*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
lp[i] = (long long int)data[i];
}
break;
}
case UDA_TYPE_UNSIGNED_SHORT: {
auto sp = (unsigned short*)udaSetSyntheticData(handle);
auto sp = (unsigned short*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
sp[i] = (unsigned short)data[i];
}
break;
}
case UDA_TYPE_UNSIGNED_INT: {
auto up = (unsigned int*)udaSetSyntheticData(handle);
auto up = (unsigned int*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
up[i] = (unsigned int)data[i];
}
break;
}
case UDA_TYPE_UNSIGNED_LONG: {
auto lp = (unsigned long*)udaSetSyntheticData(handle);
auto lp = (unsigned long*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
lp[i] = (unsigned long)data[i];
}
break;
}
case UDA_TYPE_UNSIGNED_LONG64: {
auto lp = (unsigned long long int*)udaSetSyntheticData(handle);
auto lp = (unsigned long long int*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
lp[i] = (unsigned long long int)data[i];
}
break;
}
case UDA_TYPE_CHAR: {
auto cp = (char*)udaSetSyntheticData(handle);
auto cp = (char*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
cp[i] = (char)data[i];
}
break;
}
case UDA_TYPE_UNSIGNED_CHAR: {
auto cp = (unsigned char*)udaSetSyntheticData(handle);
auto cp = (unsigned char*)udaGetSyntheticData(handle);
for (int i = 0; i < udaGetDataNum(handle); i++) {
cp[i] = (unsigned char)data[i];
}
Expand Down
12 changes: 5 additions & 7 deletions source/client/udaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int check_file_cache(const REQUEST_DATA* request_data, DATA_BLOCK** p_data_block

if (data != nullptr) {
// Success
int data_block_idx = udaGetNewDataHandle(client_flags);
int data_block_idx = udaGetNewDataHandle();

if (data_block_idx < 0) { // Error
return -data_block_idx;
Expand Down Expand Up @@ -167,7 +167,7 @@ int check_mem_cache(uda::cache::UdaCache* cache, REQUEST_DATA* request_data, DAT

if (data != nullptr) {
// Success
int data_block_idx = udaGetNewDataHandle(client_flags);
int data_block_idx = udaGetNewDataHandle();

if (data_block_idx < 0) { // Error
return -data_block_idx;
Expand Down Expand Up @@ -936,7 +936,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices)
//------------------------------------------------------------------------------
// Allocate memory for the Data Block Structure
// Re-use existing stale Data Blocks
int data_block_idx = udaGetNewDataHandle(client_flags);
int data_block_idx = udaGetNewDataHandle();

if (data_block_idx < 0) { // Error
data_block_indices[i] = -data_block_idx;
Expand Down Expand Up @@ -1010,7 +1010,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices)
for (int i = 0; i < data_block_list0.count; ++i) {
DATA_BLOCK* data_block0 = &data_block_list0.data[i];

int data_block_idx = udaGetNewDataHandle(client_flags);
int data_block_idx = udaGetNewDataHandle();
DATA_BLOCK* data_block = udaGetDataBlock(data_block_idx); // data blocks may have been realloc'ed
copyDataBlock(data_block, data_block0);

Expand Down Expand Up @@ -1433,9 +1433,7 @@ void udaFreeAll()
uda::cache::free_cache();
#endif

CLIENT_FLAGS* client_flags = udaClientFlags();

for (int i = 0; i < udaGetCurrentDataBlockIndex(client_flags); ++i) {
for (int i = 0; i < udaGetCurrentDataBlockIndex(); ++i) {
#ifndef FATCLIENT
freeDataBlock(udaGetDataBlock(i));
#else
Expand Down
18 changes: 9 additions & 9 deletions source/clientserver/protocolXML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC
SARRAY* psarray = &sarray;
int shape = data_block->data_n; // rank 1 array of dimension lengths
auto udt = (USERDEFINEDTYPE*)data_block->opaque_block; // The data's structure definition
USERDEFINEDTYPE* u = findUserDefinedType(userdefinedtypelist, "SARRAY",
USERDEFINEDTYPE* u = udaFindUserDefinedType(userdefinedtypelist, "SARRAY",
0); // Locate the carrier structure definition

UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Sending to Client\n");
Expand Down Expand Up @@ -235,12 +235,12 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC
}
#endif
// send the full set of known named structures
rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag);
rc = rc && udaXDRUserdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag);

UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Structure Definitions sent: rc = %d\n", rc);

// send the Data
rc = rc && udaXdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data,
rc = rc && udaXDRUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data,
protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source);

UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Data sent: rc = %d\n", rc);
Expand Down Expand Up @@ -429,7 +429,7 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC
}
#endif // !FATCLIENT
// receive the full set of known named structures
rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag);
rc = rc && udaXDRUserdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag);

UDA_LOG(UDA_LOG_DEBUG, "protocolXML: xdr_userdefinedtypelist #B\n");

Expand All @@ -439,14 +439,14 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC
"Failure receiving Structure Definitions");
break;
}
UDA_LOG(UDA_LOG_DEBUG, "protocolXML: udaXdrUserDefinedTypeData #A\n");
UDA_LOG(UDA_LOG_DEBUG, "protocolXML: udaXDRUserDefinedTypeData #A\n");
udaInitUserDefinedType(udt_received);

rc = rc && udaXdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data,
rc = rc && udaXDRUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data,
protocolVersion, xdr_stdio_flag, log_struct_list,
malloc_source); // receive the Data

UDA_LOG(UDA_LOG_DEBUG, "protocolXML: udaXdrUserDefinedTypeData #B\n");
UDA_LOG(UDA_LOG_DEBUG, "protocolXML: udaXDRUserDefinedTypeData #B\n");
if (!rc) {
err = 999;
udaAddError(UDA_CODE_ERROR_TYPE, "protocolXML", err,
Expand Down Expand Up @@ -589,7 +589,7 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC
xdrs = &XDRInput;

// receive the full set of known named structures
rc = xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag);
rc = udaXDRUserdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag);

if (!rc) {
err = 999;
Expand All @@ -600,7 +600,7 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC

udaInitUserDefinedType(udt_received);

rc = rc && udaXdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received,
rc = rc && udaXDRUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received,
&data, protocolVersion, xdr_stdio_flag, log_struct_list,
malloc_source); // receive the Data

Expand Down
Loading

0 comments on commit 65eb45e

Please sign in to comment.