From 99b0ea47b0ec002b01c1df75c51ac6a078d71b65 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 13 Sep 2013 07:01:36 +0000 Subject: [PATCH] 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 --- .../commonFiles/communication_funcs.c | 15 +++++++++------ .../commonFiles/communication_funcs.h | 5 ----- .../commonFiles/sls_detector_defs.h | 8 ++++---- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/slsDetectorSoftware/commonFiles/communication_funcs.c b/slsDetectorSoftware/commonFiles/communication_funcs.c index a74c1536f..e703b90f8 100755 --- a/slsDetectorSoftware/commonFiles/communication_funcs.c +++ b/slsDetectorSoftware/commonFiles/communication_funcs.c @@ -9,7 +9,10 @@ #include #include - +char lastClientIP[INET_ADDRSTRLEN]; +char thisClientIP[INET_ADDRSTRLEN]; +int lockStatus; +int differentClients; //int socketDescriptor, file_des; 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) ts+=receiveData(file_des,myChip->chanregs, sizeof(int)*nChans,INT32); else { - ptr=malloc(chdiff*sizeof(int)); + ptr=(int*)malloc(chdiff*sizeof(int)); myChip->nchan=nchanold; ts+=receiveData(file_des,myChip->chanregs, sizeof(int)*nchanold,INT32); ts+=receiveData(file_des,ptr, sizeof(int)*chdiff,INT32); @@ -584,7 +587,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) { #endif } else { - dacptr=malloc(ndacdiff*sizeof(dacs_t)); + dacptr=(dacs_t*)malloc(ndacdiff*sizeof(dacs_t)); myMod->ndac=ndold; ts+=receiveData(file_des,myMod->dacs, sizeof(dacs_t)*ndold,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"); #endif } else { - adcptr=malloc(nadcdiff*sizeof(dacs_t)); + adcptr=(dacs_t*)malloc(nadcdiff*sizeof(dacs_t)); myMod->nadc=naold; ts+=receiveData(file_des,myMod->adcs, sizeof(dacs_t)*naold,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"); #endif } else { - chipptr=malloc(nchipdiff*sizeof(int)); + chipptr=(int*)malloc(nchipdiff*sizeof(int)); myMod->nchip=nchipold; ts+=receiveData(file_des,myMod->chipregs, sizeof(int)*nchipold,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"); #endif } else { - chanptr=malloc(nchandiff*sizeof(int)); + chanptr=(int*)malloc(nchandiff*sizeof(int)); myMod->nchan=nchanold; ts+=receiveData(file_des,myMod->chanregs, sizeof(int)*nchanold,INT32); ts+=receiveData(file_des,chanptr, sizeof(int)*nchandiff,INT32); diff --git a/slsDetectorSoftware/commonFiles/communication_funcs.h b/slsDetectorSoftware/commonFiles/communication_funcs.h index c7b9d0829..7ed8bf28b 100755 --- a/slsDetectorSoftware/commonFiles/communication_funcs.h +++ b/slsDetectorSoftware/commonFiles/communication_funcs.h @@ -16,11 +16,6 @@ - -char lastClientIP[INET_ADDRSTRLEN]; -char thisClientIP[INET_ADDRSTRLEN]; -int lockStatus; -int differentClients; typedef enum{ INT16, INT32, diff --git a/slsDetectorSoftware/commonFiles/sls_detector_defs.h b/slsDetectorSoftware/commonFiles/sls_detector_defs.h index 150109dbc..27192d7c9 100755 --- a/slsDetectorSoftware/commonFiles/sls_detector_defs.h +++ b/slsDetectorSoftware/commonFiles/sls_detector_defs.h @@ -62,11 +62,10 @@ $Revision$ /** get flag form most functions */ #define GET_FLAG -1 -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(EIGERD) /** @short class containing all the structures, constants and enum definitions */ class slsDetectorDefs { - public: slsDetectorDefs(){}; @@ -565,7 +564,7 @@ enum angleConversionParameter { //} angleConversionConstant; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(EIGERD) protected: #endif @@ -575,7 +574,8 @@ enum angleConversionParameter { #include "sls_detector_funcs.h" #endif -#ifdef __cplusplus + +#if defined(__cplusplus) && !defined(EIGERD) }; #endif ;