189 char *header =
malloc(len);
196 if (strncmp(header,
"root", 4)) {
201 char *buffer = header + 4;
211 int seekfree, seekinfo;
234 int nk =
sizeof(
int)+
sizeof(
short)+2*
sizeof(
int)+2*
sizeof(
short)+2*
sizeof(
int);
239 if (nbytes + fh->
begin > 300) {
243 if (
ReadBuffer(fd, header, nbytes) != nbytes) {
253 short dversion, versiondir;
255 versiondir = dversion%1000;
262 if (dversion > 1000) {
275 fh->
uuid = strdup(
"-");
277 buffer = header + nk;
284 NSLog(
@"ReadHeader: %s, version = %d, begin = %d, end = %lld, units = %hhd, compress = %d",
288 [html appendFormat: @"<center><h3>%s</h3></center>\n", fh->name];
289 [html appendString: @"<center>Header Summary</center><p>\n"];
290 [html appendString: @"<table width=\"80%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">\n"];
291 [html appendFormat: @"<tr><td>Title:</td><td><b>%s</b></td></tr>\n", fh->title];
292 [html appendFormat: @"<tr><td>Creation date:</td><td><b>%d/%d</b></td></tr>\n", fh->dateC, fh->timeC];
293 [html appendFormat: @"<tr><td>Modification date:</td><td><b>%d/%d</b></td></tr>\n", fh->dateM, fh->timeM];
294 [html appendFormat: @"<tr><td>File size (bytes):</td><td><b>%lld</b></td></tr>\n", fh->end];
295 [html appendFormat: @"<tr><td>Compression level:</td><td><b>%d</b></td></tr>\n", fh->compress];
296 [html appendFormat: @"<tr><td>UUID:</td><td><b>%s</b></td></tr>\n", fh->uuid];
297 [html appendFormat: @"<tr><td>File version:</td><td><b>%d</b></td></tr>\n", fh->version];
298 [html appendString: @"</table>\n"];
323 char *header, *buffer;
325 NSDate *startDate = [NSDate date];
327 long long idcur = fh->
begin;
329 [html appendString: @"<br>\n"];
330 [html appendString: @"<table width=\"100%\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\">\n"];
331 [html appendString: @"<tr>\n"];
332 [html appendString: @"<th colspan=\"7\">List of Keys</th>\n"];
333 [html appendString: @"</tr>\n"];
334 [html appendString: @"<tr>\n"];
335 [html appendString: @"<th>Name</th>\n"];
336 [html appendString: @"<th>Title</th>\n"];
337 [html appendString: @"<th>Class</th>\n"];
338 [html appendString: @"<th>Date</th>\n"];
339 [html appendString: @"<th>Offset</th>\n"];
340 [html appendString: @"<th>Size</th>\n"];
341 [html appendString: @"<th>CX</th>\n"];
342 [html appendString: @"</tr>\n"];
345 while (idcur < fh->end) {
349 if (idcur+nread > fh->
end) nread = fh->
end-idcur-1;
357 [html appendString: @"<tr>\n"];
358 [html appendString: @"<td colspan=\"7\" style=\"color:red\"><center><b>ERROR</b></center></td>\n"];
359 [html appendString: @"</tr>\n"];
364 [html appendString: @"<tr>\n"];
365 [html appendString: @"<td colspan=\"4\" style=\"color:red\"><center><b>GAP</b></center></td>\n"];
366 [html appendFormat: @"<td>%lld</td>\n", idcur];
367 [html appendFormat: @"<td>%d</td>\n", -nbytes];
368 [html appendFormat: @"<td>%5.2f</td>\n", 1.0];
369 [html appendString: @"<tr>\n"];
381 if (versionkey > 1000) {
390 if (keylen > nread) {
400 classname = strdup(
"FreeSegments");
406 classname = strdup(
"StreamerInfo");
412 classname = strdup(
"KeysList");
417 if (objlen != nbytes-keylen)
418 cx = (float)(objlen+keylen)/(float)nbytes;
422 [html appendString: @"<tr>\n"];
423 [html appendFormat: @"<td>%s</td>\n", name];
424 [html appendFormat: @"<td>%s</td>\n", title];
425 [html appendFormat: @"<td>%s</td>\n", classname];
426 [html appendFormat: @"<td>%d/%d</td>\n", date, time];
427 [html appendFormat: @"<td>%lld</td>\n", idcur];
428 [html appendFormat: @"<td>%d</td>\n", nbytes];
429 [html appendFormat: @"<td>%5.2f</td>\n", cx];
430 [html appendString: @"</tr>\n"];
441 if ([startDate timeIntervalSinceNow] < -0.1) {
444 NSLog(
@"ReadKeys: checking for cancel %.3f", [startDate timeIntervalSinceNow]);
446 if (QLPreviewRequestIsCancelled(preview)) {
448 NSLog(
@"ReadKeys: cancelled");
452 startDate = [startDate dateByAddingTimeInterval: 0.1];
456 [html appendString: @"</table>\n"];