// ToCorrectPageSize makes sure page size is in allowed range.
19063
func ToCorrectPageSize(size int) int {
	if size <= 0 {
		size = 10
	} else if size > setting.API.MaxResponseItems {
		size = setting.API.MaxResponseItems
	}
	return size
}
1000003
func (s *SearchProvisionedProductsInput) SetPageSize(v int64) *SearchProvisionedProductsInput {
	s.PageSize = &v
	return s
}
650972
func (s *ListPrincipalsForPortfolioInput) SetPageSize(v int64) *ListPrincipalsForPortfolioInput {
	s.PageSize = &v
	return s
}
714764
func (s *ListDomainsInput) SetMaximumPageSize(v int64) *ListDomainsInput {
	s.MaximumPageSize = &v
	return s
}
153711
func pageOffset(pos, pageSize int64) int64 {
	rem := pos % pageSize
	if rem != 0 {
		return pos - rem
	}
	return pos
}
32701
func AppendAvatarSize(url string, size int) string {
	if strings.Contains(url, "?") {
		return url + "&s=" + com.ToStr(size)
	}
	return url + "?s=" + com.ToStr(size)
}
64876
func (s *SearchProductsInput) SetPageSize(v int64) *SearchProductsInput {
	s.PageSize = &v
	return s
}
947979
func HugePageResourceName(pageSize resource.Quantity) core.ResourceName {
	return core.ResourceName(fmt.Sprintf("%s%s", core.ResourceHugePagesPrefix, pageSize.String()))
}
811729
func (s *GetSegmentVersionsInput) SetPageSize(v string) *GetSegmentVersionsInput {
	s.PageSize = &v
	return s
}
1184402
func ConvertPages(r io.Reader) (string, map[string]string, error) {
	meta := make(map[string]string)
	var textBody string

	b, err := ioutil.ReadAll(r)
	if err != nil {
		return "", nil, fmt.Errorf("error reading data: %v", err)
	}

	zr, err := zip.NewReader(bytes.NewReader(b), int64(len(b)))
	if err != nil {
		return "", nil, fmt.Errorf("error unzipping data: %v", err)
	}

	for _, f := range zr.File {
		if strings.HasSuffix(f.Name, "Preview.pdf") {
			// There is a preview PDF version we can use
			if rc, err := f.Open(); err == nil {
				return ConvertPDF(rc)
			}
		}
		if f.Name == "index.xml" {
			// There's an XML version we can use
			if rc, err := f.Open(); err == nil {
				return ConvertXML(rc)
			}
		}
		if f.Name == "Index/Document.iwa" {
			rc, _ := f.Open()
			defer rc.Close()
			bReader := bufio.NewReader(snappy.NewReader(io.MultiReader(strings.NewReader("\xff\x06\x00\x00sNaPpY"), rc)))
			archiveLength, err := binary.ReadVarint(bReader)
			archiveInfoData, err := ioutil.ReadAll(io.LimitReader(bReader, archiveLength))
			archiveInfo := &TSP.ArchiveInfo{}
			err = proto.Unmarshal(archiveInfoData, archiveInfo)
			fmt.Println("archiveInfo:", archiveInfo, err)
		}
	}

	return textBody, meta, nil
}
1264682
func HugePageLimits(resourceList v1.ResourceList) map[int64]int64 {
	hugePageLimits := map[int64]int64{}
	for k, v := range resourceList {
		if v1helper.IsHugePageResourceName(k) {
			pageSize, _ := v1helper.HugePageSizeFromResourceName(k)
			if value, exists := hugePageLimits[pageSize.Value()]; exists {
				hugePageLimits[pageSize.Value()] = value + v.Value()
			} else {
				hugePageLimits[pageSize.Value()] = v.Value()
			}
		}
	}
	return hugePageLimits
}
20987
func (s *DescribeAccountLimitsInput) SetPageSize(v int64) *DescribeAccountLimitsInput {
	s.PageSize = &v
	return s
}
283106
func (s *ListCACertificatesInput) SetPageSize(v int64) *ListCACertificatesInput {
	s.PageSize = &v
	return s
}
458995
func (s *GetSegmentImportJobsInput) SetPageSize(v string) *GetSegmentImportJobsInput {
	s.PageSize = &v
	return s
}
764454
func (s *ListActivityTypesInput) SetMaximumPageSize(v int64) *ListActivityTypesInput {
	s.MaximumPageSize = &v
	return s
}
525018
func (s *ListRoleAliasesInput) SetPageSize(v int64) *ListRoleAliasesInput {
	s.PageSize = &v
	return s
}
227788
func (d *DisplayBuffer) Size() int {
	return (d.width * d.height) / d.pageSize
}