Skip to content

Commit

Permalink
Fix #58, minor whitespace cleanup
Browse files Browse the repository at this point in the history
- Removes trailing whitespace
- Ensure all source files use UNIX (LF) line endings only
- Remove any stray tab characters

Note this does NOT do any "re-style" of existing code (like clang-format), as this
can create major merge issues.  This is only to make the source code consistent
with typical editor mode settings (e.g. Eclipse, VScode, etc).
  • Loading branch information
jphickey committed Oct 13, 2021
1 parent e6e43b3 commit 34c570e
Show file tree
Hide file tree
Showing 36 changed files with 1,169 additions and 1,169 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#

##############################################################################
## DEFINITIONS
## DEFINITIONS

# bplib repository root directory
ROOT := .
Expand Down Expand Up @@ -246,7 +246,7 @@ testcov:
## STATIC ANALYSIS RULES

CHECK_OPT = --enable=all --inconclusive --error-exitcode=1 -q
CHECK_OPT += --suppress=unusedFunction --suppress=missingInclude
CHECK_OPT += --suppress=unusedFunction --suppress=missingInclude
CHECK_OPT += --suppress=objectIndex:common/crc.c
CHECK_OPT += --suppress=redundantAssignment:v6/dacs.c
CHECK_OPT += --suppress=memleak:os/cfe.c
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# bplib

[1. Overview](#1-overview)
[2. Build with Make](#2-build-with-make)
[3. Application Design](#3-application-design)
[4. Application Programming Interface](#4-application-programming-interface)
[5. Storage Service](#5-storage-service)

[Note #1 - Bundle Protocol Version 6](doc/bpv6_notes.md)
[Note #2 - Library Development Guidelines](doc/dev_notes.md)
[Note #3 - Configuration Parameter Trades](doc/parm_notes.md)
[Note #4 - Bundle Flow Analysis for Intermittent Communication](doc/perf_analysis_ic.md)
[1. Overview](#1-overview)
[2. Build with Make](#2-build-with-make)
[3. Application Design](#3-application-design)
[4. Application Programming Interface](#4-application-programming-interface)
[5. Storage Service](#5-storage-service)

[Note #1 - Bundle Protocol Version 6](doc/bpv6_notes.md)
[Note #2 - Library Development Guidelines](doc/dev_notes.md)
[Note #3 - Configuration Parameter Trades](doc/parm_notes.md)
[Note #4 - Bundle Flow Analysis for Intermittent Communication](doc/perf_analysis_ic.md)

----------------------------------------------------------------------
## 1. Overview
Expand Down
4 changes: 2 additions & 2 deletions app/bpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
typedef struct {
bp_desc_t* bpc;
char data_ip_addr[PARM_STR_SIZE];
int data_port;
int data_port;
char dacs_ip_addr[PARM_STR_SIZE];
int dacs_port;
int dacs_port;
} thread_parm_t;

#endif /* __bpio_h__ */
26 changes: 13 additions & 13 deletions app/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static int sockkeepalive(int socket_fd, int idle, int cnt, int intvl)
display_error("Failed to set TCP_KEEPINTVL option on socket, %s\n", strerror(errno));
return SOCK_INVALID;
}

return 0;
}

Expand All @@ -115,7 +115,7 @@ static int sockreuse(int socket_fd)
display_error("Failed to set SO_REUSEADDR option on socket, %s\n", strerror(errno));
return SOCK_INVALID;
}

return 0;
}

Expand Down Expand Up @@ -150,30 +150,30 @@ int sockcreate(int type, const char* ip_addr, int port, int is_server, int* bloc
char portstr[SOCK_PORT_STR_LEN];
char host[SOCK_HOST_STR_LEN];
char serv[SOCK_SERV_STR_LEN];

/* Check Address */
if(!ip_addr) ip_addr = "0.0.0.0"; // wildcard

/* Initialize Port */
snprintf(portstr, SOCK_PORT_STR_LEN, "%d", port);

/* Get Destination Host */
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET; /* IPv4 */
hints.ai_socktype = type;
status = getaddrinfo(ip_addr, portstr, &hints, &result);
if(status != 0)
if(status != 0)
{
display_error("Failed to get address info for %s:%d, %s\n", ip_addr, port, gai_strerror(status));
return SOCK_INVALID;
}

/* Try each address until we successfully connect. */
for(rp = result; rp != NULL; rp = rp->ai_next)
for(rp = result; rp != NULL; rp = rp->ai_next)
{
/* Get address information */
status = getnameinfo(rp->ai_addr,rp->ai_addrlen, host, SOCK_HOST_STR_LEN, serv, SOCK_SERV_STR_LEN, NI_NUMERICHOST | NI_NUMERICSERV);

/* Create socket */
sock = socket(rp->ai_family, rp->ai_socktype, 0);
if(sock < 0)
Expand Down Expand Up @@ -208,13 +208,13 @@ int sockcreate(int type, const char* ip_addr, int port, int is_server, int* bloc
do {
/* Connect Socket */
status = connect(sock, rp->ai_addr, rp->ai_addrlen);
if(status < 0)
if(status < 0)
{
display_error("Failed to connect socket to %s:%s... %s\n", host, serv, strerror(errno));
sleep(1);
}
} while(status < 0 && block && *block);

/* Check Connection */
if(status < 0) close(sock);
else break;
Expand Down Expand Up @@ -247,7 +247,7 @@ int sockcreate(int type, const char* ip_addr, int port, int is_server, int* bloc
}

/* Return Client TcpSocket */
return sock;
return sock;
}

/*----------------------------------------------------------------------------*
Expand All @@ -258,7 +258,7 @@ int sockstream(const char* ip_addr, int port, int is_server, int* block)
/* Create initial socket */
int sock = sockcreate(SOCK_STREAM, ip_addr, port, is_server, block);
if(sock == SOCK_INVALID) return SOCK_INVALID;

if(!is_server) // client
{
return sock;
Expand Down Expand Up @@ -382,7 +382,7 @@ int socksend(int fd, const void* buf, int size, int timeout)
if(c == 0)
{
c = SOCK_INVALID;
}
}
else if(c < 0)
{
display_error("Failed (%d) to send data to ready socket [%0X]: %s\n", c, revents, strerror(errno));
Expand Down
10 changes: 5 additions & 5 deletions binding/lua/lua_bplib.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/************************************************************************
* File: lua_bplib.h
*
* Copyright 2019 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Other Rights Reserved.
* Copyright 2019 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Other Rights Reserved.
*
* This software was created at NASA's Goddard Space Flight Center.
* This software is governed by the NASA Open Source Agreement and may be
* used, distributed and modified only pursuant to the terms of that
* This software is governed by the NASA Open Source Agreement and may be
* used, distributed and modified only pursuant to the terms of that
* agreement.
*
* Maintainer(s):
Expand Down
22 changes: 11 additions & 11 deletions common/rb_tree.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/************************************************************************
* File: rb_tree.h
*
* Copyright 2019 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Other Rights Reserved.
* Copyright 2019 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Other Rights Reserved.
*
* This software was created at NASA's Goddard Space Flight Center.
* This software is governed by the NASA Open Source Agreement and may be
* used, distributed and modified only pursuant to the terms of that
* This software is governed by the NASA Open Source Agreement and may be
* used, distributed and modified only pursuant to the terms of that
* agreement.
*
* Maintainer(s):
Expand Down Expand Up @@ -39,9 +39,9 @@ typedef struct rb_range {
typedef struct rb_node {
rb_range_t range; /* The range of cids represented by the node. */
bool color; /* The color of the node where RED (True) and BLACK (False). */
bool traversal_state; /* Tracks when a node is visited in a tree traversal. */
bool traversal_state; /* Tracks when a node is visited in a tree traversal. */
/* The respective ancestors of the current node within the red black tree.
* Child nodes that are null are assumed to be black in color. The root node
* Child nodes that are null are assumed to be black in color. The root node
* of the red black tree has a null parent. */
struct rb_node* left;
struct rb_node* right;
Expand All @@ -56,21 +56,21 @@ typedef struct rb_tree {
rb_node_t* free_node_head; /* The memory location of the first unallocated rb_node. */
rb_node_t* free_node_tail; /* The memory location of the last unallocated rb_node. */
rb_node_t* iterator; /* The current node when using iterator functions */
/* The starting memory address of the allocated memory for rb_nodes.
/* The starting memory address of the allocated memory for rb_nodes.
* This value is tracked so that the nodes can be deallocated in a single call to free. */
rb_node_t* node_block;
rb_node_t* node_block;
} rb_tree_t;

/******************************************************************************
PROTOTYPES
******************************************************************************/

/* Red Black Tree API
/* Red Black Tree API
*
* NOTE: The rb_tree_t is limited by its maximum size data type, in this case a bp_val_t.
* Since ranges are being stored no range will ever exceed BP_MAX_ENCODED_VALUE nor will the tree be able
* to allocate more than BP_MAX_ENCODED_VALUE nodes even if the memory is available.
*
*
*/

int rb_tree_create (bp_val_t max_size, rb_tree_t* tree); /* Creates am empty rb_tree. */
Expand Down
2 changes: 1 addition & 1 deletion common/rh_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int rh_hash_create(rh_hash_t** rh_hash, int size)
if(size > 0)
{
int i;

/* Allocate Hash Table */
(*rh_hash)->table = (rh_hash_node_t*)bplib_os_calloc(size * sizeof(rh_hash_node_t));
if((*rh_hash)->table == NULL) return BP_ERROR;
Expand Down
10 changes: 5 additions & 5 deletions common/rh_hash.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/************************************************************************
* File: rh_hash.h
*
* Copyright 2019 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Other Rights Reserved.
* Copyright 2019 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Other Rights Reserved.
*
* This software was created at NASA's Goddard Space Flight Center.
* This software is governed by the NASA Open Source Agreement and may be
* used, distributed and modified only pursuant to the terms of that
* This software is governed by the NASA Open Source Agreement and may be
* used, distributed and modified only pursuant to the terms of that
* agreement.
*
* Maintainer(s):
Expand Down
Loading

0 comments on commit 34c570e

Please sign in to comment.