From 93af09b71eced63a38dd9719d54e4e3e1cb56f51 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Thu, 3 Nov 2011 14:00:41 +0000 Subject: [PATCH] minor changes git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@41 951219d9-93cf-4727-9268-0efd64621fa3 --- slsDetectorSoftware/MySocketTCP/MySocketTCP.cxx | 15 +++++++++------ .../multiSlsDetector/multiSlsDetector.cpp | 5 +---- .../multiSlsDetector/multiSlsDetector.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/slsDetectorSoftware/MySocketTCP/MySocketTCP.cxx b/slsDetectorSoftware/MySocketTCP/MySocketTCP.cxx index 37acf731c..341a6259f 100644 --- a/slsDetectorSoftware/MySocketTCP/MySocketTCP.cxx +++ b/slsDetectorSoftware/MySocketTCP/MySocketTCP.cxx @@ -225,12 +225,14 @@ int MySocketTCP::SendDataOnly(void* buf,int length){//length in characters cout << "want to send "<< length << " Bytes" << endl; #endif - + int nsending; + int nsent; if (file_des<0) return -1; int total_sent=0; + while(length>0){ - int nsending = (length>send_rec_max_size) ? send_rec_max_size:length; - int nsent = write(file_des,(char*)buf+total_sent,nsending); + nsending = (length>send_rec_max_size) ? send_rec_max_size:length; + nsent = write(file_des,(char*)buf+total_sent,nsending); if(!nsent) break; length-=nsent; total_sent+=nsent; @@ -268,13 +270,14 @@ int MySocketTCP::ReceiveDataOnly(void* buf,int length){//length in characters #ifdef VERY_VERBOSE cout << "want to receive "<< length << " Bytes" << endl; #endif - + int nreceiving; + int nreceived; while(length>0){ - int nreceiving = (length>send_rec_max_size) ? send_rec_max_size:length; + nreceiving = (length>send_rec_max_size) ? send_rec_max_size:length; #ifdef VERY_VERBOSE cout << "start to receive "<< nreceiving << " Bytes" << endl; #endif - int nreceived = read(file_des,(char*)buf+total_received,nreceiving); + nreceived = read(file_des,(char*)buf+total_received,nreceiving); #ifdef VERY_VERBOSE cout << "received "<< nreceived << " Bytes on fd " << file_des << endl; #endif diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 3d4ea0ff8..aaaf990e6 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -141,7 +141,7 @@ int multiSlsDetector::setTCPSocket(int i, string const name, int const control_p char* multiSlsDetector::getHostname(int i) { if (i<0) - return FAIL; + return NULL; if (detectors[i]) return detectors[i]->getHostname(); else @@ -175,9 +175,6 @@ int multiSlsDetector::getControlPort(int i) { int multiSlsDetector::getDataPort(int i) { - - - int imin=0, imax=nDetectors; int ret=-1, err=0; if (i>=0) { diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h index e913891b2..e8e65e511 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h @@ -172,9 +172,9 @@ class multiSlsDetector : public slsDetector { /* I/O */ /** returns the detector trimbit directory \sa sharedSlsDetector */ - char* getTrimDir(int i=-1); + char* getSettingsDir(int i=-1); /** sets the detector trimbit directory \sa sharedSlsDetector */ - char* setTrimDir(string s, int i=-1); + char* setSettingsDir(string s, int i=-1); /** returns the number of trim energies and their value \sa sharedSlsDetector \param point to the array that will contain the trim energies (in ev) \returns number of trim energies