Remove superfluous trailing white space from C files

This commit is contained in:
Douglas Clowes
2014-05-16 15:48:41 +10:00
parent 1881907e00
commit 4c65f82116
91 changed files with 1313 additions and 1313 deletions

View File

@@ -1,18 +1,18 @@
/*
This is a histogram memory driver for the 2005-6 version of the
histogram memory software based on RTAI-Linux and an embedded WWW-server
for communications. For all http work the ghttp library from the gnome
for communications. For all http work the ghttp library from the gnome
project is used.
This HM is meant to be used in conjunction with a counter module
chained through the hmcontrol module. No need to handle counters here
when hmcontrol can do the chaining.
copyright: see file COPYRIGHT
Mark Koennecke, January 2005 (original SINQ version)
Mark Lesha, 9 October 2006 (ANSTO version)
----------------------------------------------------------------------*/
#include <stdlib.h>
#include <assert.h>
@@ -57,7 +57,7 @@ static char devName[32] = "histmem";
#define BADSTATUS -707
#define BADAUTH -708
/*=====================================================================
our driver private data structure
our driver private data structure
======================================================================*/
typedef struct {
ghttp_request *syncRequest;
@@ -81,14 +81,14 @@ typedef struct {
static int anstoHttpGetPrepare(pAnstoHttp self, char *request){
char url[512];
ghttp_status httpStatus;
if(self->asyncRunning){
while((httpStatus = ghttp_process(self->syncRequest))
== ghttp_not_done){
}
self->asyncRunning = 0;
self->asyncRunning = 0;
}
self->errorCode = 0;
ghttp_clean(self->syncRequest);
memset(self->hmError,0,512*sizeof(char));
@@ -153,7 +153,7 @@ static int anstoHttpGet(pAnstoHttp self, char *request){
return 0; // MJL return here if failed
ghttp_prepare(self->syncRequest); // MJL be sure to call ghttp_prepare before each ghttp_process
httpStatus = ghttp_process(self->syncRequest);
}
}
if(httpStatus != ghttp_done){
strncpy(self->hmError,"Reconnect", 511);
self->errorCode = SERVERERROR;
@@ -173,10 +173,10 @@ static int AnstoHttpConfigure(pHistDriver self, SConnection *pCon,
int i;
char *confData = NULL;
ghttp_status httpStatus;
pPriv = (pAnstoHttp)self->pPriv;
assert(pPriv != NULL);
/*
* The HM computer address
*/
@@ -187,7 +187,7 @@ static int AnstoHttpConfigure(pHistDriver self, SConnection *pCon,
return 0;
}
/*
/*
* looser credentials
*/
if(StringDictGet(pOpt,"username",pPriv->userName, 131) != 1){
@@ -202,11 +202,11 @@ static int AnstoHttpConfigure(pHistDriver self, SConnection *pCon,
eError);
return 0;
}
/* actual configuration. Check for flag INIT in
options. We do not need to configure, if the HM has configured
itself already. What is does, these days.
*/
*/
status = StringDictGetAsNumber(pOpt,"init",&fVal);
iInit = 0;
if(status == 1) {
@@ -214,7 +214,7 @@ static int AnstoHttpConfigure(pHistDriver self, SConnection *pCon,
iInit = 1;
}
}
/*
actually do configure
*/
@@ -283,16 +283,16 @@ static int AnstoHttpConfigure(pHistDriver self, SConnection *pCon,
}
return 1;
}
}
}
}
}
}
// MJL NOTE: Added extra init parameters here, these get committed
// regardless of whether we are doing the first init or not
// (i.e. will get committed even if init=1).
// Need to do init on the histogram object (e.g. 'hm init')
// in order to commit changed settings during operation.
// Specifically, this is important if FAT settings need to be
// Specifically, this is important if FAT settings need to be
// modified during operation. To do this, the command
// 'hm configure FAT_Xxxx vvv' needs to be performed,
// where Xxxx is the name of the item in the FAT, and vvv is the desired value.
@@ -326,8 +326,8 @@ static int AnstoHttpConfigure(pHistDriver self, SConnection *pCon,
}
}
} while(pItem);
return 1;
return 1;
}
/*--------------------------------------------------------------------*/
static int readStatus(pHistDriver pDriv){
@@ -335,10 +335,10 @@ static int readStatus(pHistDriver pDriv){
char line[132];
char name[80], value[80];
pAnstoHttp self = NULL;
self = (pAnstoHttp)pDriv->pPriv;
assert(self != NULL);
pPtr = ghttp_get_body(self->syncRequest);
if(pPtr == NULL){
strncpy(self->hmError,"No body in status response",131);
@@ -386,7 +386,7 @@ static int AnstoHttpStatus_Base(pHistDriver self,SConnection *pCon,int *pextrast
int status;
pAnstoHttp pInternal = NULL;
static int last_known_status=HWIdle; // assume idle initially
pPriv = (pAnstoHttp)self->pPriv;
assert(pPriv != NULL);
@@ -438,8 +438,8 @@ static int AnstoHttpStatus_Base(pHistDriver self,SConnection *pCon,int *pextrast
}
break;
}
status = readStatus(self);
if(status != 1){
if (pextrastatus) *pextrastatus=ANSTO_HS_STATUS_INVALID;
@@ -532,7 +532,7 @@ static int AnstoHttpStatusWithRetries(pHistDriver self, int requiredstate,SConne
// Retry after a delay if status hasn't changed yet
// (DAE takes time to start up / shut down)
if (retcode != HWPause && runloop) // Only wait if we're going to loop, otherwise drop out immediately
{
{
long long start_time_us=get_localtime_us();
do // make sure the yield in this loop gets called at least once
{
@@ -557,7 +557,7 @@ static int AnstoHttpStart(pHistDriver self, SConnection *pCon){
assert(pPriv != NULL);
status = anstoHttpGet(pPriv,startdaq);
if(status != 1){
return HWFault;
}
@@ -577,14 +577,14 @@ static int AnstoHttpHalt(pHistDriver self){ // hmm, why isn't there a pCon like
if(status != 1){
return HWFault;
}
//TODO check statuscheck flag
StringDictGet(self->pOption,"statuscheck",checkstatus,20);
StringDictGet(self->pOption,"statuscheck",checkstatus,20);
if (strcmp(checkstatus,"true") == 0) {
AnstoHttpStatusWithRetries(self,ANSTO_HS_STATUS_STOPPED,NULL); // no pCon available :(
}
return OKOK;
}
/*---------------------------------------------------------------------*/
@@ -611,9 +611,9 @@ static int AnstoHttpVeto(pHistDriver self,SConnection *pCon)
return HWFault;
}
pPriv->pause = 1;
AnstoHttpStatusWithRetries(self,ANSTO_HS_STATUS_PAUSED,pCon);
return OKOK;
}
static int AnstoHttpNoVeto(pHistDriver self,SConnection *pCon)
@@ -653,9 +653,9 @@ int AnstoHttpPause(pHistDriver self,SConnection *pCon){
/*ffr AnstoHttpVeto now provides pause()
pPriv->pause = 1;
*/
AnstoHttpStatusWithRetries(self,ANSTO_HS_STATUS_PAUSED,pCon);
return OKOK;
}
static int AnstoHttpPauseNoCon(pHistDriver self) {
@@ -678,7 +678,7 @@ static int AnstoHttpContinue(pHistDriver self, SConnection *pCon){
return OKOK;
}
/*---------------------------------------------------------------------*/
static int AnstoHttpError(pHistDriver self, int *code,
static int AnstoHttpError(pHistDriver self, int *code,
char *error, int errLen){
pAnstoHttp pPriv = NULL;
@@ -768,7 +768,7 @@ static int AnstoHttpGetHistogram(pHistDriver self, SConnection *pCon,
{
int size=((end-start)>(MAX_HTTP_REQUEST_BYTES/sizeof(int)))
?(MAX_HTTP_REQUEST_BYTES/sizeof(int)):(end-start);
// Send traditional SICS bank,start,end parameters to the server
// bank is now ignored by the server though, and start and end
// may be overridden by supplementary settings (see below).
@@ -794,27 +794,27 @@ static int AnstoHttpGetHistogram(pHistDriver self, SConnection *pCon,
}
}
} while(pItem);
// Send our request
status = anstoHttpGet(pPriv,command);
if(status != 1){
return HWFault;
}
len = ghttp_get_body_len(pPriv->syncRequest);
if(len < (int) (size*sizeof(int))){
pPriv->errorCode = BODYSHORT;
strncpy(pPriv->hmError,"Not enough data received from HM",511);
return HWFault;
}
hmdata = (HistInt *)ghttp_get_body(pPriv->syncRequest);
if(hmdata == NULL){ // MJL check ghttp_get_body for NULL return
pPriv->errorCode = NOBODY;
strncpy(pPriv->hmError,"No body in HM data response",511);
return HWFault;
}
// MJL removed the ntohl, our histogram server doesn't apply htonl,
// so the data arrives in LE format. (Would have to buffer data
// at the server otherwise...)
@@ -836,10 +836,10 @@ static int AnstoHttpSetHistogram(pHistDriver self, SConnection *pCon,
pPriv = (pAnstoHttp)self->pPriv;
assert(pPriv != NULL);
pPriv->errorCode = NOTIMPLEMENTED;
strncpy(pPriv->hmError,"Not implemented",511);
return HWFault;
strncpy(pPriv->hmError,"Not implemented",511);
return HWFault;
}
/*---------------------------------------------------------------------*/
static long AnstoHttpGetMonitor(pHistDriver self, int i,
@@ -874,7 +874,7 @@ static int AnstoHttpFreePrivate(pHistDriver self){
if(pPriv == NULL){
return 1;
}
if(pPriv->syncRequest != NULL){
ghttp_request_destroy(pPriv->syncRequest);
}
@@ -882,7 +882,7 @@ static int AnstoHttpFreePrivate(pHistDriver self){
DeleteCallBackInterface(pPriv->pCall);
}
free(pPriv);
return 1;
return 1;
}
/*-------------------------------------------------------------------*/
@@ -890,12 +890,12 @@ pHistDriver CreateAnstoHttpDriver(pStringDict pOption){
pHistDriver pNew = NULL;
pAnstoHttp pInternal = NULL;
pICallBack pCallNew = NULL;
/* create the general driver */
pNew = CreateHistDriver(pOption);
if(!pNew){
return NULL;
}
}
/* add our options */
StringDictAddPair(pOption,"hmaddress","http://localhost:8080");
@@ -922,7 +922,7 @@ pHistDriver CreateAnstoHttpDriver(pStringDict pOption){
free(pInternal);
return NULL;
}
// Save a pointer to the string dictionary internally,
// for the use of those functions that require it and
// don't get a pOption passed in via the argument list.
@@ -945,7 +945,7 @@ pHistDriver CreateAnstoHttpDriver(pStringDict pOption){
pNew->FreePrivate = AnstoHttpFreePrivate;
pNew->Pause = AnstoHttpVeto;
pNew->Continue = AnstoHttpContinue;
return pNew;
}
@@ -1006,7 +1006,7 @@ pHistDriver CreateAnstoHttpDriver(pStringDict pOption){
pHistMem pNew = NULL;
char pBueffel[512];
int iRet;
/* check no of arguments */
if(argc < 3)
{
@@ -1014,7 +1014,7 @@ pHistDriver CreateAnstoHttpDriver(pStringDict pOption){
SCWrite(pCon,pBueffel,eError);
return 0;
}
/* make new HM */
strtolower(argv[2]);
pNew = CreateHistMemory(argv[2]);
@@ -1023,11 +1023,11 @@ pHistDriver CreateAnstoHttpDriver(pStringDict pOption){
sprintf(pBueffel,"ERROR: failed to create Histogram Memory %s, driver %s may be invalid or no memory",
argv[1], argv[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
return 0;
}
StringDictAddPair(pNew->pDriv->pOption,"name",argv[1]);
/* install HM as command */
iRet = AddCommand(pSics,argv[1],ANSTO_HistAction,DeleteHistMemory,(void *)pNew);
if(!iRet)