Skip to content

Commit

Permalink
Removing remaining macros from udaDefines.h
Browse files Browse the repository at this point in the history
  • Loading branch information
jholloc committed Nov 5, 2024
1 parent 1a0c225 commit 4904d07
Show file tree
Hide file tree
Showing 63 changed files with 796 additions and 800 deletions.
2 changes: 1 addition & 1 deletion source/authentication/udaClientSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ int uda::authentication::readUdaClientSSL(void* iohandle, char* buf, int count)

udaUpdateSelectParms(g_sslSocket, &rfds, &tv);

while (((rc = select(g_sslSocket + 1, &rfds, nullptr, nullptr, &tv)) <= 0) && maxloop++ < MAXLOOP) {
while (((rc = select(g_sslSocket + 1, &rfds, nullptr, nullptr, &tv)) <= 0) && maxloop++ < MaxLoop) {

if (rc < 0) { // Error
int serrno = errno;
Expand Down
38 changes: 19 additions & 19 deletions source/c_api/accAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void udaSetProperty(const char* property)
set_log_level(UDA_LOG_DEBUG);
}
if (STR_IEQUALS(property, "altData")) {
client_flags->flags = client_flags->flags | CLIENTFLAG_ALTDATA;
client_flags->flags = client_flags->flags | client_flags::AltData;
}
if (!strncasecmp(property, "altRank", 7)) {
copy_string(property, name, 56);
Expand All @@ -247,13 +247,13 @@ void udaSetProperty(const char* property)
}
}
if (STR_IEQUALS(property, "reuseLastHandle")) {
client_flags->flags = client_flags->flags | CLIENTFLAG_REUSELASTHANDLE;
client_flags->flags = client_flags->flags | client_flags::ReuseLastHandle;
}
if (STR_IEQUALS(property, "freeAndReuseLastHandle")) {
client_flags->flags = client_flags->flags | CLIENTFLAG_FREEREUSELASTHANDLE;
client_flags->flags = client_flags->flags | client_flags::FreeReuseLastHandle;
}
if (STR_IEQUALS(property, "fileCache")) {
client_flags->flags = client_flags->flags | CLIENTFLAG_FILECACHE;
client_flags->flags = client_flags->flags | client_flags::FileCache;
}
}
}
Expand Down Expand Up @@ -314,10 +314,10 @@ int udaGetProperty(const char* property)
return client_flags->alt_rank;
}
if (STR_IEQUALS(property, "reuseLastHandle")) {
return (int)(client_flags->flags & CLIENTFLAG_REUSELASTHANDLE);
return (int)(client_flags->flags & client_flags::ReuseLastHandle);
}
if (STR_IEQUALS(property, "freeAndReuseLastHandle")) {
return (int)(client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE);
return (int)(client_flags->flags & client_flags::FreeReuseLastHandle);
}
if (STR_IEQUALS(property, "verbose")) {
return get_log_level() == UDA_LOG_INFO;
Expand All @@ -326,10 +326,10 @@ int udaGetProperty(const char* property)
return get_log_level() == UDA_LOG_DEBUG;
}
if (STR_IEQUALS(property, "altData")) {
return (int)(client_flags->flags & CLIENTFLAG_ALTDATA);
return (int)(client_flags->flags & client_flags::AltData);
}
if (STR_IEQUALS(property, "fileCache")) {
return (int)(client_flags->flags & CLIENTFLAG_FILECACHE);
return (int)(client_flags->flags & client_flags::FileCache);
}
}
return 0;
Expand Down Expand Up @@ -392,19 +392,19 @@ void udaResetProperty(const char* property)
set_log_level(UDA_LOG_NONE);
}
if (STR_IEQUALS(property, "altData")) {
client_flags->flags &= !CLIENTFLAG_ALTDATA;
client_flags->flags &= !client_flags::AltData;
}
if (STR_IEQUALS(property, "altRank")) {
client_flags->alt_rank = 0;
}
if (STR_IEQUALS(property, "reuseLastHandle")) {
client_flags->flags &= !CLIENTFLAG_REUSELASTHANDLE;
client_flags->flags &= !client_flags::ReuseLastHandle;
}
if (STR_IEQUALS(property, "freeAndReuseLastHandle")) {
client_flags->flags &= !CLIENTFLAG_FREEREUSELASTHANDLE;
client_flags->flags &= !client_flags::FreeReuseLastHandle;
}
if (STR_IEQUALS(property, "fileCache")) {
client_flags->flags &= !CLIENTFLAG_FILECACHE;
client_flags->flags &= !client_flags::FileCache;
}
}
}
Expand Down Expand Up @@ -432,7 +432,7 @@ void udaResetProperties()
client_flags->get_bytes = 0;
client_flags->get_nodimdata = 0;
set_log_level(UDA_LOG_NONE);
client_flags->user_timeout = TIMEOUT;
client_flags->user_timeout = TimeOut;
if (getenv("UDA_TIMEOUT")) {
client_flags->user_timeout = atoi(getenv("UDA_TIMEOUT"));
}
Expand Down Expand Up @@ -507,8 +507,8 @@ void udaPutErrorModel(int handle, int model, int param_n, const float* params)
data_block->error_model = model; // Model ID
data_block->error_param_n = param_n; // Number of parameters

if (param_n > MAXERRPARAMS) {
data_block->error_param_n = MAXERRPARAMS;
if (param_n > MaxErrParams) {
data_block->error_param_n = MaxErrParams;
}

for (int i = 0; i < data_block->error_param_n; i++) {
Expand All @@ -532,8 +532,8 @@ void udaPutDimErrorModel(int handle, int ndim, int model, int param_n, const flo
data_block->dims[ndim].error_model = model; // Model ID
data_block->dims[ndim].error_param_n = param_n; // Number of parameters

if (param_n > MAXERRPARAMS) {
data_block->dims[ndim].error_param_n = MAXERRPARAMS;
if (param_n > MaxErrParams) {
data_block->dims[ndim].error_param_n = MaxErrParams;
}
for (int i = 0; i < data_block->dims[ndim].error_param_n; i++) {
data_block->dims[ndim].errparams[i] = params[i];
Expand Down Expand Up @@ -690,7 +690,7 @@ int udaGetDataStatus(int handle)
if (data_block == nullptr) {
return 0;
}
if (udaGetSignalStatus(handle) == DEFAULT_STATUS) {
if (udaGetSignalStatus(handle) == DefaultStatus) {
// Signal Status Not Changed from Default - use Data Source Value
return data_block->source_status;
} else {
Expand Down Expand Up @@ -753,7 +753,7 @@ unsigned int udaGetCachePermission(int handle)
// Permission to cache?
auto data_block = getDataBlock(handle);
if (data_block == nullptr) {
return UDA_PLUGIN_NOT_OK_TO_CACHE;
return (int)PluginCachePermission::NotOkToCache;
}
return data_block->cachePermission;
}
Expand Down
2 changes: 1 addition & 1 deletion source/cache/memcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ std::string generate_cache_key(const RequestData* request, Environment environme
unsigned int private_flags)
{
// Check Properties for permission and requested method
if (!(flags & CLIENTFLAG_CACHE)) {
if (!(flags & client_flags::Cache)) {
return {};
}

Expand Down
25 changes: 13 additions & 12 deletions source/client/clientXDRStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ using namespace uda::authentication;
#endif

using namespace uda::logging;
using namespace uda::client_server;

std::pair<XDR*, XDR*> uda::client::clientCreateXDRStream()
{
Expand All @@ -30,57 +31,57 @@ std::pair<XDR*, XDR*> uda::client::clientCreateXDRStream()
if (getUdaClientSSLDisabled()) {

# if defined(__APPLE__) || defined(__TIRPC__)
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_output, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientWriteout));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_input, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientWriteout));
# else
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_output, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(clientReadin),
reinterpret_cast<int (*)(char*, char*, int)>(clientWriteout));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_input, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(clientReadin),
reinterpret_cast<int (*)(char*, char*, int)>(clientWriteout));
# endif
} else {
# if defined(__APPLE__) || defined(__TIRPC__)
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_output, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(readUdaClientSSL),
reinterpret_cast<int (*)(void*, void*, int)>(writeUdaClientSSL));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_input, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(readUdaClientSSL),
reinterpret_cast<int (*)(void*, void*, int)>(writeUdaClientSSL));
# else
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_output, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(readUdaClientSSL),
reinterpret_cast<int (*)(char*, char*, int)>(writeUdaClientSSL));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_input, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(readUdaClientSSL),
reinterpret_cast<int (*)(char*, char*, int)>(writeUdaClientSSL));
# endif
}
#else

# if defined(__APPLE__) || defined(__TIRPC__)
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_output, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientWriteout));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_input, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientWriteout));
# else
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_output, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(char*, char*, int)>(uda::client::clientWriteout));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
xdrrec_create(&client_input, DBReadBlockSize, DBWriteBlockSize, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(char*, char*, int)>(uda::client::clientWriteout));
# endif
Expand Down
4 changes: 2 additions & 2 deletions source/client/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void setHints(struct addrinfo* hints, const char* hostname)

int uda::client::createConnection(XDR* client_input, XDR* client_output, time_t* tv_server_start, int user_timeout)
{
int window_size = DB_READ_BLOCK_SIZE; // 128K
int window_size = DBReadBlockSize; // 128K
int rc;

static int max_socket_delay = -1;
Expand Down Expand Up @@ -712,7 +712,7 @@ int uda::client::clientReadin(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int c

udaUpdateSelectParms(client_socket, &rfds, &tv);

while ((select(client_socket + 1, &rfds, nullptr, nullptr, &tv) <= 0) && maxloop++ < MAXLOOP) {
while ((select(client_socket + 1, &rfds, nullptr, nullptr, &tv) <= 0) && maxloop++ < MaxLoop) {
udaUpdateSelectParms(client_socket, &rfds, &tv); // Keep trying ...
}

Expand Down
8 changes: 4 additions & 4 deletions source/client/generateErrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int uda::client::generate_synthetic_data(int handle)

int model;
int param_n;
float params[MAXERRPARAMS];
float params[MaxErrParams];

udaGetErrorModel(handle, &model, &param_n, params);

Expand Down Expand Up @@ -417,7 +417,7 @@ int uda::client::generate_synthetic_dim_data(int handle, int ndim)

int model;
int param_n;
float params[MAXERRPARAMS];
float params[MaxErrParams];

udaGetErrorModel(handle, &model, &param_n, params);

Expand Down Expand Up @@ -671,7 +671,7 @@ int uda::client::generate_data_error(int handle)

int model;
int param_n;
float params[MAXERRPARAMS];
float params[MaxErrParams];

udaGetErrorModel(handle, &model, &param_n, params);

Expand Down Expand Up @@ -989,7 +989,7 @@ int uda::client::generate_dim_data_error(int handle, int ndim)

int model;
int param_n;
float params[MAXERRPARAMS];
float params[MaxErrParams];

udaGetErrorModel(handle, &model, &param_n, params);

Expand Down
16 changes: 7 additions & 9 deletions source/client/makeClientRequestBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ int make_request_data(const char* data_object, const char* data_source, RequestD
//------------------------------------------------------------------------------------------------------------------
//! Test Input Arguments comply with string length limits, then copy to the request structure without modification

if (strlen(data_object) >= MAXMETA) {
if (strlen(data_object) >= MaxMeta) {
UDA_THROW_ERROR(SIGNAL_ARG_TOO_LONG, "The Signal/Data Object Argument string is too long!");
} else {
strcpy(request->signal, data_object); // Passed to the server without modification
}

if (strlen(data_source) >= STRING_LENGTH) {
if (strlen(data_source) >= StringLength) {
UDA_THROW_ERROR(SOURCE_ARG_TOO_LONG, "The Data Source Argument string is too long!");
} else {
strcpy(request->source, data_source); // Passed to the server without modification
Expand Down Expand Up @@ -79,9 +79,8 @@ int make_request_data(const char* data_object, const char* data_source, RequestD
*/

if (!device.empty() && strstr(request->source, request->api_delim) == nullptr) {
int lstr =
(int) strlen(request->source) + (int) device.size() + (int) strlen(request->api_delim);
if (lstr >= STRING_LENGTH) {
size_t lstr = strlen(request->source) + device.size() + strlen(request->api_delim);
if (lstr >= StringLength) {
UDA_THROW_ERROR(SOURCE_ARG_TOO_LONG,
"The Data Source Argument, prefixed with the Device Name, is too long!");
}
Expand All @@ -90,9 +89,8 @@ int make_request_data(const char* data_object, const char* data_source, RequestD
}

if (!archive.empty() && strstr(request->signal, request->api_delim) == nullptr) {
int lstr =
(int) strlen(request->signal) + (int) archive.size() + (int) strlen(request->api_delim);
if (lstr >= STRING_LENGTH) {
size_t lstr = strlen(request->signal) + archive.size() + strlen(request->api_delim);
if (lstr >= StringLength) {
UDA_THROW_ERROR(SIGNAL_ARG_TOO_LONG,
"The Signal/Data Object Argument, prefixed with the Archive Name, is too long!");
}
Expand Down Expand Up @@ -185,7 +183,7 @@ int shotRequestTest(const char* source)
// Return 1 (TRUE) if the source is shot nuumber based , 0 (FALSE) otherwise

char* token = nullptr;
char work[STRING_LENGTH];
char work[StringLength];

if (source[0] == '\0') {
return 0;
Expand Down
Loading

0 comments on commit 4904d07

Please sign in to comment.