Skip to content

Commit

Permalink
running clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-dixon committed Jan 26, 2024
1 parent 4af76f7 commit 0556b96
Show file tree
Hide file tree
Showing 47 changed files with 366 additions and 360 deletions.
2 changes: 1 addition & 1 deletion source/authentication/udaClientSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ int readUdaClientSSL(void* iohandle, char* buf, int count)
}
err = 999;
udaAddError(UDA_CODE_ERROR_TYPE, "readUdaClientSSL", err,
"Socket is Closed! Data request failed. Restarting connection.");
"Socket is Closed! Data request failed. Restarting connection.");
UDA_LOG(UDA_LOG_DEBUG, "Socket is Closed! Data request failed. Restarting connection.\n");
return -1;
}
Expand Down
27 changes: 13 additions & 14 deletions source/c_api/accAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "clientserver/protocol.h"
#include "clientserver/stringUtils.h"
#include "clientserver/xdrlib.h"
#include "initStructs.h"
#include "include/logging.h"
#include "initStructs.h"
#include "struct.h"
#include "version.h"

Expand Down Expand Up @@ -100,7 +100,7 @@ int getThreadId(thread_t id)
// Lock the thread and set the previous STATE
void udaLockThread()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
CLIENT_FLAGS* client_flags = udaClientFlags();
static unsigned int mutex_initialised = 0;

if (!mutex_initialised) {
Expand Down Expand Up @@ -167,7 +167,7 @@ void udaLockThread()
*/
void udaUnlockThread()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
CLIENT_FLAGS* client_flags = udaClientFlags();
# ifdef __GNUC__
thread_t threadId = pthread_self();
# else
Expand Down Expand Up @@ -246,7 +246,7 @@ void udaFreeDataBlocks()

DATA_BLOCK* udaGetCurrentDataBlock()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
CLIENT_FLAGS* client_flags = udaClientFlags();
if ((client_flags->flags & CLIENTFLAG_REUSELASTHANDLE || client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE) &&
udaGetThreadLastHandle() >= 0) {
return &data_blocks[udaGetThreadLastHandle()];
Expand All @@ -256,7 +256,7 @@ DATA_BLOCK* udaGetCurrentDataBlock()

int udaGetCurrentDataBlockIndex()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
CLIENT_FLAGS* client_flags = udaClientFlags();
if ((client_flags->flags & CLIENTFLAG_REUSELASTHANDLE || client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE) &&
udaGetThreadLastHandle() >= 0) {
return udaGetThreadLastHandle();
Expand All @@ -266,7 +266,7 @@ int udaGetCurrentDataBlockIndex()

int udaGrowDataBlocks()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
CLIENT_FLAGS* client_flags = udaClientFlags();
if ((client_flags->flags & CLIENTFLAG_REUSELASTHANDLE || client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE) &&
udaGetThreadLastHandle() >= 0) {
return 0;
Expand All @@ -293,7 +293,7 @@ static int findNewHandleIndex()

int udaGetNewDataHandle()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
CLIENT_FLAGS* client_flags = udaClientFlags();
int newHandleIndex = -1;

if ((client_flags->flags & CLIENTFLAG_REUSELASTHANDLE || client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE) &&
Expand Down Expand Up @@ -429,7 +429,7 @@ void udaResetClientFlag(unsigned int flag)
*/
void udaSetProperty(const char* property)
{
CLIENT_FLAGS* client_flags = udaClientFlags();
CLIENT_FLAGS* client_flags = udaClientFlags();
// User settings for Client and Server behaviour

char name[56];
Expand Down Expand Up @@ -530,7 +530,7 @@ void udaSetProperty(const char* property)
*/
int udaGetProperty(const char* property)
{
const CLIENT_FLAGS* client_flags = udaClientFlags();
const CLIENT_FLAGS* client_flags = udaClientFlags();
// User settings for Client and Server behaviour

if (property[0] == 'g') {
Expand Down Expand Up @@ -607,7 +607,7 @@ int udaGetProperty(const char* property)

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

if (property[0] == 'g') {
Expand Down Expand Up @@ -678,7 +678,7 @@ void udaResetProperty(const char* property)
*/
void udaResetProperties()
{
CLIENT_FLAGS* client_flags = udaClientFlags();
CLIENT_FLAGS* client_flags = udaClientFlags();
// Reset on Both Client and Server

client_flags->get_datadble = 0;
Expand Down Expand Up @@ -3068,8 +3068,7 @@ void udaGetGenericDimData(int handle, int ndim, void* data)
memcpy(data, (void*)udaGetDimData(handle, ndim), (size_t)udaGetDimNum(handle, ndim) * sizeof(char));
break;
case UDA_TYPE_UNSIGNED_INT:
memcpy(data, (void*)udaGetDimData(handle, ndim),
(size_t)udaGetDimNum(handle, ndim) * sizeof(unsigned int));
memcpy(data, (void*)udaGetDimData(handle, ndim), (size_t)udaGetDimNum(handle, ndim) * sizeof(unsigned int));
break;
case UDA_TYPE_UNSIGNED_LONG:
memcpy(data, (void*)udaGetDimData(handle, ndim),
Expand Down Expand Up @@ -3823,7 +3822,7 @@ int udaGetDimDataCheckSum(int handle, int ndim)
}

return (udaDataCheckSum((void*)data_blocks[handle].dims[ndim].dim, data_blocks[handle].dims[ndim].dim_n,
data_blocks[handle].dims[ndim].data_type));
data_blocks[handle].dims[ndim].data_type));
}

//===========================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion source/c_api/clientAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#endif

#include "include/errorLog.h"
#include "initStructs.h"
#include "include/logging.h"
#include "initStructs.h"

#include "client.h"
#include "client/makeClientRequestBlock.h"
Expand Down
2 changes: 1 addition & 1 deletion source/c_api/clientMDS.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "clientMDS.h"

#include "clientserver/protocol.h"
#include "initStructs.h"
#include "include/logging.h"
#include "initStructs.h"

#include "client.h"
#include "client/startup.h"
Expand Down
6 changes: 3 additions & 3 deletions source/c_api/udaGetAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# include <strings.h>
#endif

#include "include/errorLog.h"
#include "clientserver/printStructs.h"
#include "initStructs.h"
#include "include/errorLog.h"
#include "include/logging.h"
#include "initStructs.h"

#include "accAPI.h"
#include "client.h"
Expand Down Expand Up @@ -256,7 +256,7 @@ int udaGetBatchAPI(const char** signals, const char** sources, int count, int* h
}

int udaGetBatchAPIWithHost(const char** signals, const char** sources, int count, int* handles, const char* host,
int port)
int port)
{
CLIENT_FLAGS* client_flags = udaClientFlags();

Expand Down
4 changes: 2 additions & 2 deletions source/c_api/udaPutAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include "udaPutAPI.h"

#include "clientserver/allocData.h"
#include "include/errorLog.h"
#include "clientserver/printStructs.h"
#include "initStructs.h"
#include "include/errorLog.h"
#include "include/logging.h"
#include "initStructs.h"

#include "client/makeClientRequestBlock.h"
#include "client/udaClient.h"
Expand Down
2 changes: 1 addition & 1 deletion source/cache/fileCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ int udaFileCacheWrite(const DATA_BLOCK* data_block, const REQUEST_BLOCK* request
# include <string>
# include <vector>

# include <include/errorLog.h>
# include <clientserver/stringUtils.h>
# include <include/errorLog.h>
# include <sstream>

constexpr int CACHE_MAXCOUNT = 100; // Max Attempts at obtaining a database table lock
Expand Down
2 changes: 1 addition & 1 deletion source/cache/memcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ DATA_BLOCK* uda::cache::cache_read(uda::cache::UdaCache* cache, const REQUEST_DA
// needed for GCC 12.0 - do not delete
# include <algorithm>

# include <include/errorLog.h>
# include <clientserver/initStructs.h>
# include <clientserver/memstream.h>
# include <clientserver/xdrlib.h>
# include <include/errorLog.h>
# include <include/logging.h>

# define UDA_CACHE_HOST "localhost" // Override these with environment variables with the same name
Expand Down
8 changes: 4 additions & 4 deletions source/client/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

#include "client.h"
#include <client/udaClientHostList.h>
#include <include/errorLog.h>
#include <clientserver/manageSockets.h>
#include <include/errorLog.h>
#include <include/logging.h>

#include "getEnvironment.h"
Expand Down Expand Up @@ -265,7 +265,7 @@ int createConnection(XDR* client_input, XDR* client_output, time_t* tv_server_st
if (host != nullptr) {
if (host->host_name.empty()) {
udaAddError(UDA_CODE_ERROR_TYPE, __func__, -1,
"The host_name is not recognised for the host alias provided!");
"The host_name is not recognised for the host alias provided!");
return -1;
}
hostname = host->host_name.c_str();
Expand Down Expand Up @@ -408,7 +408,7 @@ int createConnection(XDR* client_input, XDR* client_output, time_t* tv_server_st
if (host != nullptr) {
if (host->host_name.empty()) {
udaAddError(UDA_CODE_ERROR_TYPE, __func__, -1,
"The hostname2 is not recognised for the host alias provided!");
"The hostname2 is not recognised for the host alias provided!");
return -1;
}
hostname = host->host_name.c_str();
Expand Down Expand Up @@ -605,7 +605,7 @@ int clientWriteout(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int count)
if (errno == ECONNRESET) {
UDA_LOG(UDA_LOG_DEBUG, "ECONNRESET error!\n");
udaAddError(UDA_CODE_ERROR_TYPE, __func__, -2,
"ECONNRESET: The server program has crashed or closed the socket unexpectedly");
"ECONNRESET: The server program has crashed or closed the socket unexpectedly");
return -2;
} else {
if (errno == ENETUNREACH) {
Expand Down
21 changes: 10 additions & 11 deletions source/client/generateErrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int idamSyntheticModel(int model, int param_n, float* params, int data_n, float*
#ifdef NO_GSL_LIB
int err = 999;
udaAddError(UDA_CODE_ERROR_TYPE, "idamSyntheticModel", err,
"Random Number Generators from the GSL library required.");
"Random Number Generators from the GSL library required.");
return 999;
#else

Expand Down Expand Up @@ -176,7 +176,7 @@ int generateIdamSyntheticData(int handle)
if (udaGetDataType(handle) == UDA_TYPE_DCOMPLEX || udaGetDataType(handle) == UDA_TYPE_COMPLEX) {
err = 999;
udaAddError(UDA_CODE_ERROR_TYPE, "generateIdamSyntheticData", err,
"Not configured to Generate Complex Type Synthetic Data");
"Not configured to Generate Complex Type Synthetic Data");
return 999;
}

Expand Down Expand Up @@ -293,7 +293,7 @@ int generateIdamSyntheticData(int handle)
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");
"Problem Allocating Heap Memory for Synthetic Data");
return err;
}
udaSetSyntheticData(handle, synthetic);
Expand Down Expand Up @@ -431,14 +431,14 @@ int generateIdamSyntheticDimData(int handle, int ndim)
if (udaGetDataType(handle) == UDA_TYPE_DCOMPLEX || udaGetDataType(handle) == UDA_TYPE_COMPLEX) {
err = 999;
udaAddError(UDA_CODE_ERROR_TYPE, "generateIdamSyntheticDimData", err,
"Not configured to Generate Complex Type Synthetic Data");
"Not configured to Generate Complex Type Synthetic Data");
return 999;
}

float* data;
if ((data = (float*)malloc(udaGetDimNum(handle, ndim) * sizeof(float))) == nullptr) {
udaAddError(UDA_CODE_ERROR_TYPE, "generateIdamSyntheticDimData", 1,
"Problem Allocating Heap Memory for Synthetic Dimensional Data");
"Problem Allocating Heap Memory for Synthetic Dimensional Data");
return 1;
}

Expand Down Expand Up @@ -539,7 +539,7 @@ int generateIdamSyntheticDimData(int handle, int ndim)

if (err != 0) {
udaAddError(UDA_CODE_ERROR_TYPE, "generateIdamSyntheticDimData", err,
"Unable to Generate Synthetic Dimensional Data");
"Unable to Generate Synthetic Dimensional Data");
free(data);
return err;
}
Expand All @@ -550,7 +550,7 @@ int generateIdamSyntheticDimData(int handle, int ndim)
if (udaGetSyntheticDimData(handle, ndim) == nullptr) {
if ((err = allocArray(udaGetDimType(handle, ndim), udaGetDimNum(handle, ndim), &synthetic))) {
udaAddError(UDA_CODE_ERROR_TYPE, "generateIdamSyntheticDimData", err,
"Problem Allocating Heap Memory for Synthetic Dimensional Data");
"Problem Allocating Heap Memory for Synthetic Dimensional Data");
return err;
}

Expand Down Expand Up @@ -685,7 +685,7 @@ int generateIdamDataError(int handle)
if (udaGetDataType(handle) == UDA_TYPE_DCOMPLEX || udaGetDataType(handle) == UDA_TYPE_COMPLEX) {
err = 999;
udaAddError(UDA_CODE_ERROR_TYPE, "generateIdamDataError", err,
"Not configured to Generate Complex Type Synthetic Data");
"Not configured to Generate Complex Type Synthetic Data");
return 999;
}

Expand Down Expand Up @@ -798,8 +798,7 @@ int generateIdamDataError(int handle)
//--------------------------------------------------------------------------------------------------------------
// Generate Error Data

err =
idamErrorModel(model, param_n, params, udaGetDataNum(handle), data, &asymmetry, (float*)errhi, (float*)errlo);
err = idamErrorModel(model, param_n, params, udaGetDataNum(handle), data, &asymmetry, (float*)errhi, (float*)errlo);

if (err != 0) {
free(data);
Expand Down Expand Up @@ -1004,7 +1003,7 @@ int generateIdamDimDataError(int handle, int ndim)
if (udaGetDataType(handle) == UDA_TYPE_DCOMPLEX || udaGetDataType(handle) == UDA_TYPE_COMPLEX) {
err = 999;
udaAddError(UDA_CODE_ERROR_TYPE, "generateIdamDimDataError", err,
"Not configured to Generate Complex Type Synthetic Data");
"Not configured to Generate Complex Type Synthetic Data");
return 999;
}

Expand Down
2 changes: 1 addition & 1 deletion source/client/makeClientRequestBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Interprets the API arguments and assembles a Request data structure.

#include "initStructs.h"
#include "udaErrors.h"
#include <include/errorLog.h>
#include <clientserver/expand_path.h>
#include <clientserver/makeRequestBlock.h>
#include <clientserver/stringUtils.h>
#include <fmt/format.h>
#include <include/errorLog.h>
#include <include/logging.h>

int makeRequestData(const char* data_object, const char* data_source, REQUEST_DATA* request)
Expand Down
Loading

0 comments on commit 0556b96

Please sign in to comment.