… | |
… | |
272 | |
272 | |
273 | int |
273 | int |
274 | avail_in(self) |
274 | avail_in(self) |
275 | File::Rdiff::Buffers self |
275 | File::Rdiff::Buffers self |
276 | CODE: |
276 | CODE: |
277 | RETVAL = self->in ? SvCUR (self->in) - self->in_ofs : 0; |
277 | RETVAL = self->in ? SvCUR (self->in) - self->in_ofs |
|
|
278 | : self->rs.eof_in ? -1 |
|
|
279 | : 0; |
278 | OUTPUT: |
280 | OUTPUT: |
279 | RETVAL |
281 | RETVAL |
280 | |
282 | |
281 | int |
283 | int |
282 | avail_out(self) |
284 | avail_out(self) |
… | |
… | |
365 | |
367 | |
366 | SV * |
368 | SV * |
367 | signature(self) |
369 | signature(self) |
368 | File::Rdiff::Job self |
370 | File::Rdiff::Job self |
369 | CODE: |
371 | CODE: |
370 | RETVAL = self->sig; |
372 | RETVAL = SvREFCNT_inc (self->sig); |
371 | OUTPUT: |
373 | OUTPUT: |
372 | RETVAL |
374 | RETVAL |
373 | |
375 | |
374 | int |
376 | int |
375 | iter(self,buffers) |
377 | iter(self,buffers) |
… | |
… | |
388 | { |
390 | { |
389 | buffers->rs.next_in = 0; |
391 | buffers->rs.next_in = 0; |
390 | buffers->rs.avail_in = 0; |
392 | buffers->rs.avail_in = 0; |
391 | } |
393 | } |
392 | |
394 | |
|
|
395 | if (buffers->outsize) |
|
|
396 | { |
393 | if (!buffers->out) |
397 | if (!buffers->out) |
394 | { |
398 | { |
395 | buffers->out = NEWSV (0, buffers->outsize); |
399 | buffers->out = NEWSV (0, buffers->outsize); |
396 | SvPOK_on (buffers->out); |
400 | SvPOK_on (buffers->out); |
397 | } |
401 | } |
398 | |
402 | |
399 | buffers->rs.next_out = SvEND (buffers->out); |
403 | buffers->rs.next_out = SvEND (buffers->out); |
400 | buffers->rs.avail_out = buffers->outsize - SvCUR (buffers->out); |
404 | buffers->rs.avail_out = buffers->outsize - SvCUR (buffers->out); |
|
|
405 | } |
|
|
406 | else |
|
|
407 | { |
|
|
408 | buffers->rs.next_out = 0; |
|
|
409 | buffers->rs.avail_out = 0; |
|
|
410 | } |
401 | |
411 | |
402 | RETVAL = rs_job_iter (self->rs, &buffers->rs); |
412 | RETVAL = rs_job_iter (self->rs, &buffers->rs); |
403 | |
413 | |
404 | buffers->in_ofs = in_len - buffers->rs.avail_in; |
414 | buffers->in_ofs = in_len - buffers->rs.avail_in; |
|
|
415 | |
|
|
416 | if (buffers->out) |
405 | SvCUR_set (buffers->out, buffers->outsize - buffers->rs.avail_out); |
417 | SvCUR_set (buffers->out, buffers->outsize - buffers->rs.avail_out); |
406 | } |
418 | } |
407 | OUTPUT: |
419 | OUTPUT: |
408 | RETVAL |
420 | RETVAL |
409 | |
421 | |
410 | # void rs_hexify(char *to_buf, void const *from_buf, int from_len); |
422 | # void rs_hexify(char *to_buf, void const *from_buf, int from_len); |
… | |
… | |
435 | # |
447 | # |
436 | # char *rs_format_stats(rs_stats_t const *, char *, size_t); |
448 | # char *rs_format_stats(rs_stats_t const *, char *, size_t); |
437 | # |
449 | # |
438 | # int rs_log_stats(rs_stats_t const *stats); |
450 | # int rs_log_stats(rs_stats_t const *stats); |
439 | # |
451 | # |
440 | # |
|
|
441 | # /** |
|
|
442 | # * Stream through which the calling application feeds data to and from the |
|
|
443 | # * library. |
|
|
444 | # * |
|
|
445 | # * On each call to rs_job_iter, the caller can make available |
|
|
446 | # * |
|
|
447 | # * - avail_in bytes of input data at next_in |
|
|
448 | # * - avail_out bytes of output space at next_out |
|
|
449 | # * - some of both |
|
|
450 | # * |
|
|
451 | # * Buffers must be allocated and passed in by the caller. This |
|
|
452 | # * routine never allocates, reallocates or frees buffers. |
|
|
453 | # * |
|
|
454 | # * Pay attention to the meaning of the returned pointer and length |
|
|
455 | # * values. They do \b not indicate the location and amount of |
|
|
456 | # * returned data. Rather, if \p *out_ptr was originally set to \p |
|
|
457 | # * out_buf, then the output data begins at \p out_buf, and has length |
|
|
458 | # * \p *out_ptr - \p out_buf. |
|
|
459 | # * |
|
|
460 | # * Note also that if \p *avail_in is nonzero on return, then not all of |
|
|
461 | # * the input data has been consumed. The caller should either provide |
|
|
462 | # * more output buffer space and call rs_work() again passing the same |
|
|
463 | # * \p next_in and \p avail_in, or put the remaining input data into some |
|
|
464 | # * persistent buffer and call rs_work() with it again when there is |
|
|
465 | # * more output space. |
|
|
466 | # * |
|
|
467 | # * \param next_in References a pointer which on entry should point to |
|
|
468 | # * the start of the data to be encoded. Updated to point to the byte |
|
|
469 | # * after the last one consumed. |
|
|
470 | # * |
|
|
471 | # * \param avail_in References the length of available input. Updated to |
|
|
472 | # * be the number of unused data bytes, which will be zero if all the |
|
|
473 | # * input was consumed. May be zero if there is no new input, but the |
|
|
474 | # * caller just wants to drain output. |
|
|
475 | # * |
|
|
476 | # * \param next_out References a pointer which on entry points to the |
|
|
477 | # * start of the output buffer. Updated to point to the byte after the |
|
|
478 | # * last one filled. |
|
|
479 | # * |
|
|
480 | # * \param avail_out References the size of available output buffer. |
|
|
481 | # * Updated to the size of unused output buffer. |
|
|
482 | # * |
|
|
483 | # * \return The ::rs_result that caused iteration to stop. |
|
|
484 | # * |
|
|
485 | # * \sa rs_buffers_t |
|
|
486 | # * \sa \ref api_buffers |
|
|
487 | # */ |
|
|
488 | # struct rs_buffers_s { |
|
|
489 | # char *next_in; /**< Next input byte */ |
|
|
490 | # size_t avail_in; /**< Number of bytes available at next_in */ |
|
|
491 | # int eof_in; /**< True if there is no more data |
|
|
492 | # * after this. */ |
|
|
493 | # |
|
|
494 | # char *next_out; /**< Next output byte should be put there */ |
|
|
495 | # size_t avail_out; /**< Remaining free space at next_out */ |
|
|
496 | # }; |
|
|
497 | # |
|
|
498 | # /** |
|
|
499 | # * Stream through which the calling application feeds data to and from the |
|
|
500 | # * library. |
|
|
501 | # * |
|
|
502 | # * \sa struct rs_buffers_s |
|
|
503 | # * \sa \ref api_buffers |
|
|
504 | # */ |
|
|
505 | # typedef struct rs_buffers_s rs_buffers_t; |
|
|
506 | # |
|
|
507 | # /** Default length of strong signatures, in bytes. The MD4 checksum |
|
|
508 | # * is truncated to this size. */ |
|
|
509 | # #define RS_DEFAULT_STRONG_LEN 8 |
|
|
510 | # |
|
|
511 | # /** Default block length, if not determined by any other factors. */ |
|
|
512 | # #define RS_DEFAULT_BLOCK_LEN 2048 |
|
|
513 | # |
|
|
514 | # |
|
|
515 | # |
|
|
516 | # /** \typedef struct rs_job rs_job_t |
|
|
517 | # * |
|
|
518 | # * \brief Job of work to be done. |
|
|
519 | # * |
|
|
520 | # * Created by functions such as rs_sig_begin(), and then iterated |
|
|
521 | # * over by rs_job_iter(). */ |
|
|
522 | # typedef struct rs_job rs_job_t; |
|
|
523 | # |
|
|
524 | # /** |
|
|
525 | # * Bitmask values that may be passed to the options parameter of |
|
|
526 | # * rs_work(). |
|
|
527 | # */ |
|
|
528 | # typedef enum rs_work_options { |
|
|
529 | # RS_END = 0x01 /**< End of input file; please finish |
|
|
530 | # * up. */ |
|
|
531 | # } rs_work_options; |
|
|
532 | # |
|
|
533 | # |
|
|
534 | # rs_result rs_job_iter(rs_job_t *, rs_buffers_t *); |
|
|
535 | # |
|
|
536 | # const rs_stats_t * rs_job_statistics(rs_job_t *job); |
452 | # const rs_stats_t * rs_job_statistics(rs_job_t *job); |
537 | # |
|
|
538 | # rs_result rs_job_free(rs_job_t *); |
|
|
539 | # |
453 | # |
540 | # int rs_accum_value(rs_job_t *, char *sum, size_t sum_len); |
454 | # int rs_accum_value(rs_job_t *, char *sum, size_t sum_len); |
541 | # |
455 | # |
542 | |
456 | |
543 | MODULE = File::Rdiff PACKAGE = File::Rdiff |
457 | MODULE = File::Rdiff PACKAGE = File::Rdiff |