moved globals from commu.h to .c and used extern. This needed for eiger g++ server compiling. Also typecasted all the mallocs

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@664 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-09-13 07:01:36 +00:00
parent 23bbefd4a2
commit 99b0ea47b0
3 changed files with 13 additions and 15 deletions

View File

@ -9,7 +9,10 @@
#include <errno.h> #include <errno.h>
#include <sys/time.h> #include <sys/time.h>
char lastClientIP[INET_ADDRSTRLEN];
char thisClientIP[INET_ADDRSTRLEN];
int lockStatus;
int differentClients;
//int socketDescriptor, file_des; //int socketDescriptor, file_des;
const int send_rec_max_size=SEND_REC_MAX_SIZE; const int send_rec_max_size=SEND_REC_MAX_SIZE;
@ -486,7 +489,7 @@ int receiveChip(int file_des, sls_detector_chip* myChip) {
if (chdiff<=0) if (chdiff<=0)
ts+=receiveData(file_des,myChip->chanregs, sizeof(int)*nChans,INT32); ts+=receiveData(file_des,myChip->chanregs, sizeof(int)*nChans,INT32);
else { else {
ptr=malloc(chdiff*sizeof(int)); ptr=(int*)malloc(chdiff*sizeof(int));
myChip->nchan=nchanold; myChip->nchan=nchanold;
ts+=receiveData(file_des,myChip->chanregs, sizeof(int)*nchanold,INT32); ts+=receiveData(file_des,myChip->chanregs, sizeof(int)*nchanold,INT32);
ts+=receiveData(file_des,ptr, sizeof(int)*chdiff,INT32); ts+=receiveData(file_des,ptr, sizeof(int)*chdiff,INT32);
@ -584,7 +587,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
#endif #endif
} else { } else {
dacptr=malloc(ndacdiff*sizeof(dacs_t)); dacptr=(dacs_t*)malloc(ndacdiff*sizeof(dacs_t));
myMod->ndac=ndold; myMod->ndac=ndold;
ts+=receiveData(file_des,myMod->dacs, sizeof(dacs_t)*ndold,INT32); ts+=receiveData(file_des,myMod->dacs, sizeof(dacs_t)*ndold,INT32);
ts+=receiveData(file_des,dacptr, sizeof(dacs_t)*ndacdiff,INT32); ts+=receiveData(file_des,dacptr, sizeof(dacs_t)*ndacdiff,INT32);
@ -598,7 +601,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
printf("adcs received\n"); printf("adcs received\n");
#endif #endif
} else { } else {
adcptr=malloc(nadcdiff*sizeof(dacs_t)); adcptr=(dacs_t*)malloc(nadcdiff*sizeof(dacs_t));
myMod->nadc=naold; myMod->nadc=naold;
ts+=receiveData(file_des,myMod->adcs, sizeof(dacs_t)*naold,INT32); ts+=receiveData(file_des,myMod->adcs, sizeof(dacs_t)*naold,INT32);
ts+=receiveData(file_des,adcptr, sizeof(dacs_t)*nadcdiff,INT32); ts+=receiveData(file_des,adcptr, sizeof(dacs_t)*nadcdiff,INT32);
@ -612,7 +615,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
printf("chips received\n"); printf("chips received\n");
#endif #endif
} else { } else {
chipptr=malloc(nchipdiff*sizeof(int)); chipptr=(int*)malloc(nchipdiff*sizeof(int));
myMod->nchip=nchipold; myMod->nchip=nchipold;
ts+=receiveData(file_des,myMod->chipregs, sizeof(int)*nchipold,INT32); ts+=receiveData(file_des,myMod->chipregs, sizeof(int)*nchipold,INT32);
ts+=receiveData(file_des,chipptr, sizeof(int)*nchipdiff,INT32); ts+=receiveData(file_des,chipptr, sizeof(int)*nchipdiff,INT32);
@ -626,7 +629,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
printf("chans received\n"); printf("chans received\n");
#endif #endif
} else { } else {
chanptr=malloc(nchandiff*sizeof(int)); chanptr=(int*)malloc(nchandiff*sizeof(int));
myMod->nchan=nchanold; myMod->nchan=nchanold;
ts+=receiveData(file_des,myMod->chanregs, sizeof(int)*nchanold,INT32); ts+=receiveData(file_des,myMod->chanregs, sizeof(int)*nchanold,INT32);
ts+=receiveData(file_des,chanptr, sizeof(int)*nchandiff,INT32); ts+=receiveData(file_des,chanptr, sizeof(int)*nchandiff,INT32);

View File

@ -16,11 +16,6 @@
char lastClientIP[INET_ADDRSTRLEN];
char thisClientIP[INET_ADDRSTRLEN];
int lockStatus;
int differentClients;
typedef enum{ typedef enum{
INT16, INT16,
INT32, INT32,

View File

@ -62,11 +62,10 @@ $Revision$
/** get flag form most functions */ /** get flag form most functions */
#define GET_FLAG -1 #define GET_FLAG -1
#ifdef __cplusplus #if defined(__cplusplus) && !defined(EIGERD)
/** @short class containing all the structures, constants and enum definitions */ /** @short class containing all the structures, constants and enum definitions */
class slsDetectorDefs { class slsDetectorDefs {
public: public:
slsDetectorDefs(){}; slsDetectorDefs(){};
@ -565,7 +564,7 @@ enum angleConversionParameter {
//} angleConversionConstant; //} angleConversionConstant;
#ifdef __cplusplus #if defined(__cplusplus) && !defined(EIGERD)
protected: protected:
#endif #endif
@ -575,7 +574,8 @@ enum angleConversionParameter {
#include "sls_detector_funcs.h" #include "sls_detector_funcs.h"
#endif #endif
#ifdef __cplusplus
#if defined(__cplusplus) && !defined(EIGERD)
}; };
#endif #endif
; ;