Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for blockPadding (0.51 sec)

  1. src/archive/tar/format.go

    	// This matches the limit used by libarchive.
    	maxSpecialFileSize = 1 << 20
    )
    
    // blockPadding computes the number of bytes needed to pad offset up to the
    // nearest block edge where 0 <= n < blockSize.
    func blockPadding(offset int64) (n int64) {
    	return -offset & (blockSize - 1)
    }
    
    var zeroBlock block
    
    type block [blockSize]byte
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Oct 13 18:36:46 GMT 2023
    - 11.3K bytes
    - Viewed (0)
  2. src/archive/tar/writer.go

    			for _, s := range spd {
    				hdr.Size += s.Length
    				spb = append(strconv.AppendInt(spb, s.Offset, 10), '\n')
    				spb = append(strconv.AppendInt(spb, s.Length, 10), '\n')
    			}
    			pad := blockPadding(int64(len(spb)))
    			spb = append(spb, zeroBlock[:pad]...)
    			hdr.Size += int64(len(spb)) // Accounts for encoded sparse map
    
    			// Add and modify appropriate PAX records.
    			dir, file := path.Split(realName)
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Oct 13 18:36:46 GMT 2023
    - 19.6K bytes
    - Viewed (0)
  3. src/archive/tar/common.go

    func alignSparseEntries(src []sparseEntry, size int64) []sparseEntry {
    	dst := src[:0]
    	for _, s := range src {
    		pos, end := s.Offset, s.endOffset()
    		pos += blockPadding(+pos) // Round-up to nearest blockSize
    		if end != size {
    			end -= blockPadding(-end) // Round-down to nearest blockSize
    		}
    		if pos < end {
    			dst = append(dst, sparseEntry{Offset: pos, Length: end - pos})
    		}
    	}
    	return dst
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Mar 15 16:01:50 GMT 2024
    - 24.7K bytes
    - Viewed (2)
  4. src/archive/tar/reader.go

    func (tr *Reader) handleRegularFile(hdr *Header) error {
    	nb := hdr.Size
    	if isHeaderOnlyType(hdr.Typeflag) {
    		nb = 0
    	}
    	if nb < 0 {
    		return ErrHeader
    	}
    
    	tr.pad = blockPadding(nb)
    	tr.curr = &regFileReader{r: tr.r, nb: nb}
    	return nil
    }
    
    // handleSparseFile checks if the current file is a sparse format of any type
    // and sets the curr reader appropriately.
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Mar 08 01:59:14 GMT 2024
    - 26.8K bytes
    - Viewed (0)
  5. src/archive/tar/reader_test.go

    			t.Errorf("test %d, Header.Size = %d, want %d", i, hdr.Size, v.wantSize)
    		}
    	}
    }
    
    func TestReadGNUSparsePAXHeaders(t *testing.T) {
    	padInput := func(s string) string {
    		return s + string(zeroBlock[:blockPadding(int64(len(s)))])
    	}
    
    	vectors := []struct {
    		inputData string
    		inputHdrs map[string]string
    		wantMap   sparseDatas
    		wantSize  int64
    		wantName  string
    		wantErr   error
    	}{{
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Nov 21 21:14:38 GMT 2022
    - 47.1K bytes
    - Viewed (0)
Back to top