Changeset 30448 for branches/eam_branches/ipp-20101205/Ohana
- Timestamp:
- Jan 31, 2011, 2:54:06 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101205/Ohana/src
- Files:
-
- 2 edited
-
libdvo/src/dvo_util.c (modified) (3 diffs)
-
tools/src/roc.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/Ohana/src/libdvo/src/dvo_util.c
r27435 r30448 255 255 dvo_catalog_free (&catalog); 256 256 } 257 size_t NInvalidDetID = 0; 257 258 if (Ndetect) { 258 259 dvoDetection *sorted; … … 262 263 off_t i; 263 264 for (i = 0; i < Ndetect; i++) { 264 sorted[detections[i].meas.detID] = detections[i]; 265 266 if (detections[i].meas.detID < 0 || detections[i].meas.detID > (*pMaxDetID + 1)) 267 NInvalidDetID++; 268 else 269 sorted[detections[i].meas.detID] = detections[i]; 265 270 } 266 271 *results = sorted; … … 271 276 FREE(detections); 272 277 278 if (NInvalidDetID) fprintf (stderr, "ERROR: Encountered %ld invalid detection IDs\n", NInvalidDetID); 279 273 280 return (Ndetect); 274 281 -
branches/eam_branches/ipp-20101205/Ohana/src/tools/src/roc.c
r30252 r30448 33 33 34 34 usage(); 35 exit ( 1);35 exit (2); 36 36 } 37 37 38 38 int roc_create (int argc, char **argv) { 39 39 40 int i, j, n, Ninput, result, Nblocks, header_size, size_off, Noff, Nbytes, Nread; 40 int i, j, n, Ninput, result, Nblocks, header_size, size_off; 41 int status, Noff, Nbytes, Nread, Nwrite; 41 42 off_t maxSize, *sizes, *bytes_read; 42 43 char value; … … 124 125 myAssert (target, "failed to open output"); 125 126 126 fwrite (header, 1, header_size, target); 127 Nwrite = fwrite (header, 1, header_size, target); 128 myAssert (Nwrite == header_size, "failed to write header"); 127 129 128 130 ALLOCATE (inputData, char *, Ninput); … … 137 139 Nbytes = fread (inputData[i], 1, Nread, input[i]); 138 140 myAssert (Nbytes == Nread, "failed to read data"); 141 139 142 if (Nread < ROC_BLOCKSIZE) { 140 143 // if we have reached the end of the file, fill in the rest with NULLs … … 152 155 } 153 156 154 fwrite (outputData, 1, ROC_BLOCKSIZE, target); 155 } 157 Nwrite = fwrite (outputData, 1, ROC_BLOCKSIZE, target); 158 myAssert (Nwrite == ROC_BLOCKSIZE, "failed to write data block"); 159 } 160 161 status = fclose (target); 162 myAssert (!status, "failed to close rocfile"); 156 163 157 164 exit (0); … … 160 167 int roc_repair (int argc, char **argv) { 161 168 162 int i, j, n, Ninput, Nblocks, header_size, Nbytes, Nread, Nfile, Nwrite; 169 int i, j, n, Ninput, Nblocks, header_size, Nbytes; 170 int status, Nread, Nfile, Nwrite; 163 171 off_t *sizes, *bytes_read; 164 172 char value; … … 204 212 // read the full header 205 213 fseeko (target, 0, SEEK_SET); 206 fread (header, 1, header_size, target); 214 Nread = fread (header, 1, header_size, target); 215 myAssert (Nread == header_size, "failed to read header"); 207 216 208 217 ptr = header; … … 255 264 Nbytes = fread (inputData[i], 1, Nread, input[i]); 256 265 myAssert (Nbytes == Nread, "failed to read data"); 266 257 267 if (Nread < ROC_BLOCKSIZE) { 258 268 // if we have reached the end of the file, fill in the rest with NULLs … … 261 271 bytes_read[i] += Nread; 262 272 } 263 fread (targetData, 1, ROC_BLOCKSIZE, target); 273 Nread = fread (targetData, 1, ROC_BLOCKSIZE, target); 274 myAssert (Nread == ROC_BLOCKSIZE, "failed to read from target"); 264 275 265 276 for (j = 0; j < ROC_BLOCKSIZE; j++) { … … 281 292 for (i = 0; i < Ninput; i++) { 282 293 if (i == Nfile) continue; 283 fclose(input[i]); 284 } 285 fclose (output); 286 fclose (target); 294 status = fclose(input[i]); 295 myAssert (!status, "failed to close input"); 296 } 297 status = fclose (output); 298 myAssert (!status, "failed to close output file"); 299 300 status = fclose (target); 301 myAssert (!status, "failed to close rocfile"); 287 302 288 303 exit (0);
Note:
See TracChangeset
for help on using the changeset viewer.
