@@ -69,11 +69,10 @@ void dogma::DogmaFile::Close()
6969 fEOF = true ;
7070}
7171
72-
73-
7472bool dogma::DogmaFile::WriteBuffer (void * buf, uint32_t bufsize)
7573{
76- if (!isWriting () || !buf || (bufsize == 0 )) return false ;
74+ if (!isWriting () || !buf || (bufsize == 0 ))
75+ return false ;
7776
7877 if (io->fwrite (buf, bufsize, 1 , fd) != 1 ) {
7978 fprintf (stderr, " fail to write dogma buffer payload of size %u" , (unsigned ) bufsize);
@@ -95,27 +94,23 @@ bool dogma::DogmaFile::ReadBuffer(void* ptr, uint32_t* sz, bool onlyevent)
9594 size_t readsz = io->fread (ptr, 1 , (onlyevent ? sizeof (dogma::DogmaEvent) : maxsz), fd);
9695
9796 if (readsz < sizeof (dogma::DogmaEvent)) {
98- if (!io->feof (fd)) fprintf (stderr, " Fail to read next portion but no EOF detected\n " );
97+ if (!io->feof (fd))
98+ fprintf (stderr, " Fail to read next portion but no EOF detected\n " );
9999 fEOF = true ;
100100 return false ;
101101 }
102102
103103 auto hdr = (dogma::DogmaEvent *) ptr;
104104
105-
106105 if (onlyevent) {
107106
108107 if (hdr->GetEventLen () > maxsz) {
109108 fprintf (stderr, " Buffer %u too small to read next event %u from dogma file\n " , (unsigned ) maxsz, (unsigned ) hdr->GetEventLen ());
110109 return false ;
111110 }
112111
113- // printf("Expect next event of size %u\n", (unsigned) hdr->GetPaddedSize());
114-
115112 readsz = io->fread ((char *) ptr + sizeof (dogma::DogmaEvent), 1 , hdr->GetPayloadLen ()*4 , fd);
116113
117- // printf("Read size %u expects %u \n", (unsigned) readsz, (unsigned) (hdr->GetPaddedSize() - sizeof(hadaq::HadTu)));
118-
119114 // not possible to read event completely
120115 if (readsz != hdr->GetPayloadLen ()*4 ) {
121116 fprintf (stderr, " DOGMA reading problem\n " );
@@ -145,7 +140,6 @@ bool dogma::DogmaFile::ReadBuffer(void* ptr, uint32_t* sz, bool onlyevent)
145140 }
146141
147142 if (not_enough_place_for_next_event) {
148-
149143 if (readsz < maxsz)
150144 fEOF = true ;
151145
0 commit comments