You are here

function PclZipUtilCopyBlock in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php \PclZipUtilCopyBlock()
1 call to PclZipUtilCopyBlock()
PclZip::privDeleteByRule in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php, line 5554

Code

function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) {
  $v_result = 1;
  if ($p_mode == 0) {
    while ($p_size != 0) {
      $v_read_size = $p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE;
      $v_buffer = @fread($p_src, $v_read_size);
      @fwrite($p_dest, $v_buffer, $v_read_size);
      $p_size -= $v_read_size;
    }
  }
  else {
    if ($p_mode == 1) {
      while ($p_size != 0) {
        $v_read_size = $p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE;
        $v_buffer = @gzread($p_src, $v_read_size);
        @fwrite($p_dest, $v_buffer, $v_read_size);
        $p_size -= $v_read_size;
      }
    }
    else {
      if ($p_mode == 2) {
        while ($p_size != 0) {
          $v_read_size = $p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE;
          $v_buffer = @fread($p_src, $v_read_size);
          @gzwrite($p_dest, $v_buffer, $v_read_size);
          $p_size -= $v_read_size;
        }
      }
      else {
        if ($p_mode == 3) {
          while ($p_size != 0) {
            $v_read_size = $p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE;
            $v_buffer = @gzread($p_src, $v_read_size);
            @gzwrite($p_dest, $v_buffer, $v_read_size);
            $p_size -= $v_read_size;
          }
        }
      }
    }
  }

  // ----- Return
  return $v_result;
}