Skip to content

Commit

Permalink
Make clang-format happy
Browse files Browse the repository at this point in the history
Adapting changed lines:

```
git clang-format-14 --style=file master
```
  • Loading branch information
rettichschnidi committed Mar 31, 2023
1 parent 6b3b347 commit 1166233
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 27 deletions.
10 changes: 3 additions & 7 deletions core/observe.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,15 +746,12 @@ void observe_step(lwm2m_context_t * contextP,
{
LOG_ARG("Checking minimal period (%d s)", watcherP->parameters->minPeriod);

if ((time_t)(watcherP->lastTime + watcherP->parameters->minPeriod) > currentTime)
{
if ((time_t)(watcherP->lastTime + watcherP->parameters->minPeriod) > currentTime) {
// Minimum Period did not elapse yet
interval = watcherP->lastTime + watcherP->parameters->minPeriod - currentTime;
if (*timeoutP > interval) *timeoutP = interval;
notify = false;
}
else
{
} else {
LOG("Notify on minimal period");
notify = true;
}
Expand All @@ -768,8 +765,7 @@ void observe_step(lwm2m_context_t * contextP,
{
LOG_ARG("Checking maximal period (%d s)", watcherP->parameters->maxPeriod);

if ((time_t)(watcherP->lastTime + watcherP->parameters->maxPeriod) <= currentTime)
{
if ((time_t)(watcherP->lastTime + watcherP->parameters->maxPeriod) <= currentTime) {
LOG("Notify on maximal period");
notify = true;
}
Expand Down
4 changes: 1 addition & 3 deletions examples/bootstrap_server/bootstrap_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ typedef struct
#endif
} read_server_t;

static int prv_find_next_section(FILE * fd,
const char * tag)
{
static int prv_find_next_section(FILE *fd, const char *tag) {
char * line;
size_t length;
int found;
Expand Down
10 changes: 4 additions & 6 deletions examples/bootstrap_server/bootstrap_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ void handle_sigint(int signum)
prv_quit(NULL, NULL, NULL);
}

void print_usage(const char * filename,
const char * port)
{
void print_usage(const char *filename, const char *port) {
fprintf(stdout, "Usage: bootstap_server [OPTION]\r\n");
fprintf(stderr, "Launch a LWM2M Bootstrap Server.\r\n\n");
fprintf(stdout, "Options:\r\n");
Expand Down Expand Up @@ -486,7 +484,7 @@ static void prv_bootstrap_client(lwm2m_context_t *lwm2mH,
{
internal_data_t * dataP = (internal_data_t *)user_data;
char * uri;
const char * name = "";
const char *name = "";
char * end = NULL;
char * host;
char * port;
Expand Down Expand Up @@ -558,9 +556,9 @@ int main(int argc, char *argv[])
fd_set readfds;
struct timeval tv;
int result;
const char * port = "5685";
const char *port = "5685";
internal_data_t data;
const char * filename = "bootstrap_server.ini";
const char *filename = "bootstrap_server.ini";
int opt;
FILE * fd;
lwm2m_context_t * lwm2mH;
Expand Down
2 changes: 1 addition & 1 deletion examples/client/lwm2mclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ int main(int argc, char *argv[])
const char * localPort = "56830";
const char * server = NULL;
const char * serverPort = LWM2M_STANDARD_PORT_STR;
const char * name = "testlwm2mclient";
const char *name = "testlwm2mclient";
int lifetime = 300;
int batterylevelchanging = 0;
time_t reboot_time = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/lightclient/lightclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ int main(int argc, char *argv[])
lwm2m_object_t * objArray[OBJ_COUNT];

const char * localPort = "56830";
const char * name = "testlwm2mclient";
const char *name = "testlwm2mclient";

int result;
int opt;
Expand Down
4 changes: 2 additions & 2 deletions examples/lightclient/object_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ static uint8_t prv_get_value(lwm2m_data_t * dataP,
case LWM2M_SECURITY_SMS_KEY_PARAM_ID:
// Here we return an opaque of 6 bytes containing a buggy value
{
const char * value = "12345";
const char *value = "12345";
lwm2m_data_encode_opaque((uint8_t *)value, 6, dataP);
}
return COAP_205_CONTENT;

case LWM2M_SECURITY_SMS_SECRET_KEY_ID:
// Here we return an opaque of 32 bytes containing a buggy value
{
const char * value = "1234567890abcdefghijklmnopqrstu";
const char *value = "1234567890abcdefghijklmnopqrstu";
lwm2m_data_encode_opaque((uint8_t *)value, 32, dataP);
}
return COAP_205_CONTENT;
Expand Down
6 changes: 3 additions & 3 deletions examples/shared/commandline.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ typedef void (*command_handler_t) (lwm2m_context_t *lwm2mH, char * args, void *

typedef struct
{
const char * name;
const char * shortDesc;
const char * longDesc;
const char *name;
const char *shortDesc;
const char *longDesc;
command_handler_t callback;
void * userData;
} command_desc_t;
Expand Down
8 changes: 4 additions & 4 deletions examples/shared/dtlsconnection.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ typedef struct _dtls_app_context_
} dtls_app_context_t;

/********************* Security Obj Helpers **********************/
char * security_get_uri(lwm2m_context_t * lwm2mH, lwm2m_object_t * obj, int instanceId, char * uriBuffer, size_t bufferSize){
char *security_get_uri(lwm2m_context_t *lwm2mH, lwm2m_object_t *obj, int instanceId, char *uriBuffer,
size_t bufferSize) {
int size = 1;
lwm2m_data_t * dataP = lwm2m_data_new(size);
dataP->id = 0; // security server uri
Expand Down Expand Up @@ -74,7 +75,7 @@ int64_t security_get_mode(lwm2m_context_t * lwm2mH, lwm2m_object_t * obj, int in
return LWM2M_SECURITY_MODE_NONE;
}

char * security_get_public_id(lwm2m_context_t * lwm2mH, lwm2m_object_t * obj, int instanceId, size_t * length){
char *security_get_public_id(lwm2m_context_t *lwm2mH, lwm2m_object_t *obj, int instanceId, size_t *length) {
int size = 1;
lwm2m_data_t * dataP = lwm2m_data_new(size);
dataP->id = 3; // public key or id
Expand All @@ -99,8 +100,7 @@ char * security_get_public_id(lwm2m_context_t * lwm2mH, lwm2m_object_t * obj, in
}
}


char * security_get_secret_key(lwm2m_context_t * lwm2mH, lwm2m_object_t * obj, int instanceId, size_t * length){
char *security_get_secret_key(lwm2m_context_t *lwm2mH, lwm2m_object_t *obj, int instanceId, size_t *length) {
int size = 1;
lwm2m_data_t * dataP = lwm2m_data_new(size);
dataP->id = 5; // secret key
Expand Down

0 comments on commit 1166233

Please sign in to comment.