1
1
mirror of https://github.com/wader/fq.git synced 2024-12-24 05:41:38 +03:00

postgres: change AssertPosBytes to AssertPos (bits)

This commit is contained in:
Pavel Safonov 2022-09-21 13:36:15 +03:00
parent edb565028d
commit 9f1adb2d81
14 changed files with 16 additions and 18 deletions

View File

@ -213,7 +213,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("crc")
/* total size (bytes): 288 */
d.AssertPosBytes(288)
d.AssertPos(288 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -213,7 +213,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("crc")
/* total size (bytes): 296 */
d.AssertPosBytes(296)
d.AssertPos(296 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -209,7 +209,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("crc")
/* total size (bytes): 296 */
d.AssertPosBytes(296)
d.AssertPos(296 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -209,7 +209,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("crc")
/* total size (bytes): 296 */
d.AssertPosBytes(296)
d.AssertPos(296 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -229,7 +229,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("hole11")
/* total size (bytes): 344 */
d.AssertPosBytes(344)
d.AssertPos(344 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -231,7 +231,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("crc")
/* total size (bytes): 344 */
d.AssertPosBytes(344)
d.AssertPos(344 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -230,7 +230,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("crc")
/* total size (bytes): 344 */
d.AssertPosBytes(344)
d.AssertPos(344 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -222,7 +222,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("padding0")
/* total size (bytes): 336 */
d.AssertPosBytes(336)
d.AssertPos(336 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -221,7 +221,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("padding0")
/* total size (bytes): 336 */
d.AssertPosBytes(336)
d.AssertPos(336 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -213,7 +213,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("padding1")
/* total size (bytes): 288 */
d.AssertPosBytes(288)
d.AssertPos(288 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -212,7 +212,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("padding1")
/* total size (bytes): 296 */
d.AssertPosBytes(296)
d.AssertPos(296 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -209,7 +209,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("padding1")
/* total size (bytes): 296 */
d.AssertPosBytes(296)
d.AssertPos(296 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -209,7 +209,7 @@ func DecodePgControl(d *decode.D, in any) any {
d.FieldU32("padding1")
/* total size (bytes): 296 */
d.AssertPosBytes(296)
d.AssertPos(296 * 8)
d.FieldRawLen("unused", d.BitsLeft())
return nil

View File

@ -816,11 +816,9 @@ func (d *D) FieldRangeFn(name string, firstBit int64, nBits int64, fn func() *Va
return v
}
func (d *D) AssertPosBytes(nBytes int64) {
nBits := nBytes * 8
if d.Pos() != nBits {
// TODO:
panic(DecoderError{Reason: fmt.Sprintf("expected position bytes %d, bits %d", nBytes, nBits), Pos: d.Pos()})
func (d *D) AssertPos(pos int64) {
if d.Pos() != pos {
panic(DecoderError{Reason: fmt.Sprintf("expected bits position %d", pos), Pos: d.Pos()})
}
}