Changeset 711 for trunk/gsdl/src/mgpp/text/mg_invf_rebuild.cpp
- Timestamp:
- 1999-10-18T12:43:31+13:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/mgpp/text/mg_invf_rebuild.cpp
r655 r711 50 50 /* 51 51 $Log$ 52 Revision 1.2 1999/10/17 23:43:26 cs025 53 Changes to eradicate Xmalloc 54 52 55 Revision 1.1 1999/10/11 02:57:58 cs025 53 56 Base install of MG-PP … … 355 358 for (i = 0; i < ifh_in.no_of_words; i++) 356 359 { 357 unsigned long blk, p;360 unsigned long blk, docCount; 358 361 unsigned long odn_blk = 0, olen_blk = 0; 359 362 unsigned long idn_blk = 0, ilen_blk = 0; … … 374 377 NTOHUL(bytes_out); /* [RPAP - Jan 97: Endian Ordering] */ 375 378 376 p= word.documents();377 blk = BIO_Bblock_Init (idh.static_num_of_docs, p);379 docCount = word.documents(); 380 blk = BIO_Bblock_Init (idh.static_num_of_docs, docCount); 378 381 switch (outmode) 379 382 { … … 381 384 { 382 385 unsigned long len; 383 if ( p<= ifh_out.params[0])386 if (docCount <= ifh_out.params[0]) 384 387 out_k = 0; 385 388 else 386 389 { 387 390 out_k = ifh_out.params[0]; 388 len = BIO_Bblock_Bound (N, p);391 len = BIO_Bblock_Bound (N, docCount); 389 392 if (ifh_in.InvfLevel >= 2) 390 393 len += word.words(); 391 odn_blk = BIO_Bblock_Init (idh.num_of_docs, ( p+ out_k - 1) / out_k);392 olen_blk = BIO_Bblock_Init (len, ( p+ out_k - 1) / out_k);394 odn_blk = BIO_Bblock_Init (idh.num_of_docs, (docCount + out_k - 1) / out_k); 395 olen_blk = BIO_Bblock_Init (len, (docCount + out_k - 1) / out_k); 393 396 } 394 397 break; … … 397 400 { 398 401 unsigned long len; 399 if ( p<= mins)402 if (docCount <= mins) 400 403 out_k = 0; 401 404 else 402 405 { 403 out_k = (int) (2 * sqrt ((double) p/ max_nodes));406 out_k = (int) (2 * sqrt ((double) docCount / max_nodes)); 404 407 if (out_k <= mins) 405 408 out_k = mins; 406 len = BIO_Bblock_Bound (N, p);409 len = BIO_Bblock_Bound (N, docCount); 407 410 if (ifh_in.InvfLevel >= 2) 408 411 len += word.words(); 409 412 odn_blk = BIO_Bblock_Init (idh.num_of_docs, 410 ( p+ out_k - 1) / out_k);411 olen_blk = BIO_Bblock_Init (len, ( p+ out_k - 1) / out_k);413 (docCount + out_k - 1) / out_k); 414 olen_blk = BIO_Bblock_Init (len, (docCount + out_k - 1) / out_k); 412 415 } 413 416 break; … … 422 425 { 423 426 unsigned long len; 424 if ( p<= ifh_in.params[0])427 if (docCount <= ifh_in.params[0]) 425 428 in_k = 0; 426 429 else 427 430 { 428 431 in_k = ifh_in.params[0]; 429 len = BIO_Bblock_Bound (N, p);432 len = BIO_Bblock_Bound (N, docCount); 430 433 if (ifh_in.InvfLevel >= 2) 431 434 len += word.words(); 432 idn_blk = BIO_Bblock_Init (idh.num_of_docs, ( p+ in_k - 1) / in_k);433 ilen_blk = BIO_Bblock_Init (len, ( p+ in_k - 1) / in_k);435 idn_blk = BIO_Bblock_Init (idh.num_of_docs, (docCount + in_k - 1) / in_k); 436 ilen_blk = BIO_Bblock_Init (len, (docCount + in_k - 1) / in_k); 434 437 } 435 438 break; … … 438 441 { 439 442 unsigned long len; 440 if ( p<= ifh_in.params[1])443 if (docCount <= ifh_in.params[1]) 441 444 { 442 445 in_k = 0; … … 444 447 else 445 448 { 446 in_k = (int) (2 * sqrt ((double) p/ ifh_in.params[0]));449 in_k = (int) (2 * sqrt ((double) docCount / ifh_in.params[0])); 447 450 if (in_k <= ifh_in.params[1]) 448 451 in_k = ifh_in.params[1]; 449 len = BIO_Bblock_Bound (N, p);452 len = BIO_Bblock_Bound (N, docCount); 450 453 if (ifh_in.InvfLevel >= 2) 451 454 len += word.words(); 452 455 idn_blk = BIO_Bblock_Init (idh.num_of_docs, 453 ( p+ in_k - 1) / in_k);454 ilen_blk = BIO_Bblock_Init (len, ( p+ in_k - 1) / in_k);456 (docCount + in_k - 1) / in_k); 457 ilen_blk = BIO_Bblock_Init (len, (docCount + in_k - 1) / in_k); 455 458 } 456 459 break; … … 460 463 } 461 464 462 if (!(ii = (invf_info *) Xmalloc (sizeof (invf_info) * p)))465 if (!(ii = (invf_info *) Xmalloc (sizeof (invf_info) * docCount))) 463 466 FatalError (1, "Unable to allocate memory for \"ii\"\n"); 464 467 … … 467 470 kd = 0; 468 471 DECODE_CONTINUE (in_buf) 469 for (j = 0; j < p; j++, kd++)472 for (j = 0; j < docCount; j++, kd++) 470 473 { 471 474 unsigned long doc_diff, count = 0; 472 475 if (kd == in_k) 473 476 kd = 0; 474 if (in_k && kd == 0 && j + in_k < p)477 if (in_k && kd == 0 && j + in_k < docCount) 475 478 { 476 479 int temp; … … 480 483 } 481 484 ii[j].bits_so_far = bits_so_far; 482 if (in_k && kd == in_k - 1 && j != p- 1)485 if (in_k && kd == in_k - 1 && j != docCount - 1) 483 486 { 484 487 int count; … … 517 520 kd = 0; 518 521 ENCODE_CONTINUE (out_buf) 519 for (j = 0; j < p; j++, kd++)522 for (j = 0; j < docCount; j++, kd++) 520 523 { 521 524 if (kd == out_k) … … 523 526 if (out_k && kd == 0) 524 527 { 525 if (j + out_k < p)528 if (j + out_k < docCount) 526 529 { 527 530 int num = ii[j + out_k - 1].doc_num - last_major; … … 535 538 } 536 539 } 537 if (!(out_k && kd == out_k - 1 && j != p- 1))540 if (!(out_k && kd == out_k - 1 && j != docCount - 1)) 538 541 buffer.bblock_encode (ii[j].doc_num - doc_num, blk, &bits_out); 539 542 doc_num = ii[j].doc_num;
Note:
See TracChangeset
for help on using the changeset viewer.