mirror of
https://github.com/cubixle/iabtcfv2.git
synced 2026-04-24 18:44:46 +01:00
Compute MaxVendor and MaxVendorIdLI at encoding if not explicitly set
This commit is contained in:
@@ -43,6 +43,13 @@ func (a *AllowedVendors) Encode() string {
|
||||
}
|
||||
bitSize += entriesSize
|
||||
} else {
|
||||
if a.MaxVendorId == 0 {
|
||||
for id, _ := range a.AllowedVendors {
|
||||
if id > a.MaxVendorId {
|
||||
a.MaxVendorId = id
|
||||
}
|
||||
}
|
||||
}
|
||||
bitSize += a.MaxVendorId
|
||||
}
|
||||
|
||||
|
||||
@@ -180,6 +180,13 @@ func (c *CoreString) Encode() string {
|
||||
}
|
||||
bitSize += +entriesSize
|
||||
} else {
|
||||
if c.MaxVendorId == 0 {
|
||||
for id, _ := range c.VendorsConsent {
|
||||
if id > c.MaxVendorId {
|
||||
c.MaxVendorId = id
|
||||
}
|
||||
}
|
||||
}
|
||||
bitSize += c.MaxVendorId
|
||||
}
|
||||
|
||||
@@ -196,6 +203,13 @@ func (c *CoreString) Encode() string {
|
||||
}
|
||||
bitSize += entriesSize
|
||||
} else {
|
||||
if c.MaxVendorIdLI == 0 {
|
||||
for id, _ := range c.VendorsLITransparency {
|
||||
if id > c.MaxVendorIdLI {
|
||||
c.MaxVendorIdLI = id
|
||||
}
|
||||
}
|
||||
}
|
||||
bitSize += c.MaxVendorIdLI
|
||||
}
|
||||
|
||||
@@ -203,7 +217,7 @@ func (c *CoreString) Encode() string {
|
||||
for _, res := range c.PubRestrictions {
|
||||
entriesSize := 20
|
||||
for _, entry := range res.RangeEntries {
|
||||
entriesSize += 1
|
||||
entriesSize++
|
||||
if entry.EndVendorID > entry.StartVendorID {
|
||||
entriesSize += 16 * 2
|
||||
} else {
|
||||
|
||||
@@ -43,6 +43,13 @@ func (d *DisclosedVendors) Encode() string {
|
||||
}
|
||||
bitSize += entriesSize
|
||||
} else {
|
||||
if d.MaxVendorId == 0 {
|
||||
for id, _ := range d.DisclosedVendors {
|
||||
if id > d.MaxVendorId {
|
||||
d.MaxVendorId = id
|
||||
}
|
||||
}
|
||||
}
|
||||
bitSize += d.MaxVendorId
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user