@@ -157,7 +157,7 @@ func (d *decoder) decodeFromType(
157
157
}
158
158
}
159
159
160
- func (d * decoder ) unmarshalBool (size uint , offset uint , result reflect.Value ) (uint , error ) {
160
+ func (d * decoder ) unmarshalBool (size , offset uint , result reflect.Value ) (uint , error ) {
161
161
if size > 1 {
162
162
return 0 , newInvalidDatabaseError ("the MaxMind DB file's data section contains bad data (bool size of %v)" , size )
163
163
}
@@ -206,7 +206,7 @@ func (d *decoder) indirect(result reflect.Value) reflect.Value {
206
206
207
207
var sliceType = reflect .TypeOf ([]byte {})
208
208
209
- func (d * decoder ) unmarshalBytes (size uint , offset uint , result reflect.Value ) (uint , error ) {
209
+ func (d * decoder ) unmarshalBytes (size , offset uint , result reflect.Value ) (uint , error ) {
210
210
value , newOffset := d .decodeBytes (size , offset )
211
211
212
212
switch result .Kind () {
@@ -224,7 +224,7 @@ func (d *decoder) unmarshalBytes(size uint, offset uint, result reflect.Value) (
224
224
return newOffset , newUnmarshalTypeError (value , result .Type ())
225
225
}
226
226
227
- func (d * decoder ) unmarshalFloat32 (size uint , offset uint , result reflect.Value ) (uint , error ) {
227
+ func (d * decoder ) unmarshalFloat32 (size , offset uint , result reflect.Value ) (uint , error ) {
228
228
if size != 4 {
229
229
return 0 , newInvalidDatabaseError ("the MaxMind DB file's data section contains bad data (float32 size of %v)" , size )
230
230
}
@@ -243,8 +243,7 @@ func (d *decoder) unmarshalFloat32(size uint, offset uint, result reflect.Value)
243
243
return newOffset , newUnmarshalTypeError (value , result .Type ())
244
244
}
245
245
246
- func (d * decoder ) unmarshalFloat64 (size uint , offset uint , result reflect.Value ) (uint , error ) {
247
-
246
+ func (d * decoder ) unmarshalFloat64 (size , offset uint , result reflect.Value ) (uint , error ) {
248
247
if size != 8 {
249
248
return 0 , newInvalidDatabaseError ("the MaxMind DB file's data section contains bad data (float 64 size of %v)" , size )
250
249
}
@@ -266,7 +265,7 @@ func (d *decoder) unmarshalFloat64(size uint, offset uint, result reflect.Value)
266
265
return newOffset , newUnmarshalTypeError (value , result .Type ())
267
266
}
268
267
269
- func (d * decoder ) unmarshalInt32 (size uint , offset uint , result reflect.Value ) (uint , error ) {
268
+ func (d * decoder ) unmarshalInt32 (size , offset uint , result reflect.Value ) (uint , error ) {
270
269
if size > 4 {
271
270
return 0 , newInvalidDatabaseError ("the MaxMind DB file's data section contains bad data (int32 size of %v)" , size )
272
271
}
@@ -319,7 +318,7 @@ func (d *decoder) unmarshalMap(
319
318
}
320
319
}
321
320
322
- func (d * decoder ) unmarshalPointer (size uint , offset uint , result reflect.Value , depth int ) (uint , error ) {
321
+ func (d * decoder ) unmarshalPointer (size , offset uint , result reflect.Value , depth int ) (uint , error ) {
323
322
pointer , newOffset , err := d .decodePointer (size , offset )
324
323
if err != nil {
325
324
return 0 , err
@@ -349,7 +348,7 @@ func (d *decoder) unmarshalSlice(
349
348
return 0 , newUnmarshalTypeError ("array" , result .Type ())
350
349
}
351
350
352
- func (d * decoder ) unmarshalString (size uint , offset uint , result reflect.Value ) (uint , error ) {
351
+ func (d * decoder ) unmarshalString (size , offset uint , result reflect.Value ) (uint , error ) {
353
352
value , newOffset := d .decodeString (size , offset )
354
353
355
354
switch result .Kind () {
@@ -363,10 +362,9 @@ func (d *decoder) unmarshalString(size uint, offset uint, result reflect.Value)
363
362
}
364
363
}
365
364
return newOffset , newUnmarshalTypeError (value , result .Type ())
366
-
367
365
}
368
366
369
- func (d * decoder ) unmarshalUint (size uint , offset uint , result reflect.Value , uintType uint ) (uint , error ) {
367
+ func (d * decoder ) unmarshalUint (size , offset uint , result reflect.Value , uintType uint ) (uint , error ) {
370
368
if size > uintType / 8 {
371
369
return 0 , newInvalidDatabaseError ("the MaxMind DB file's data section contains bad data (uint%v size of %v)" , uintType , size )
372
370
}
@@ -396,7 +394,7 @@ func (d *decoder) unmarshalUint(size uint, offset uint, result reflect.Value, ui
396
394
397
395
var bigIntType = reflect .TypeOf (big.Int {})
398
396
399
- func (d * decoder ) unmarshalUint128 (size uint , offset uint , result reflect.Value ) (uint , error ) {
397
+ func (d * decoder ) unmarshalUint128 (size , offset uint , result reflect.Value ) (uint , error ) {
400
398
if size > 16 {
401
399
return 0 , newInvalidDatabaseError ("the MaxMind DB file's data section contains bad data (uint128 size of %v)" , size )
402
400
}
@@ -417,30 +415,30 @@ func (d *decoder) unmarshalUint128(size uint, offset uint, result reflect.Value)
417
415
return newOffset , newUnmarshalTypeError (value , result .Type ())
418
416
}
419
417
420
- func (d * decoder ) decodeBool (size uint , offset uint ) (bool , uint ) {
418
+ func (d * decoder ) decodeBool (size , offset uint ) (bool , uint ) {
421
419
return size != 0 , offset
422
420
}
423
421
424
- func (d * decoder ) decodeBytes (size uint , offset uint ) ([]byte , uint ) {
422
+ func (d * decoder ) decodeBytes (size , offset uint ) ([]byte , uint ) {
425
423
newOffset := offset + size
426
424
bytes := make ([]byte , size )
427
425
copy (bytes , d .buffer [offset :newOffset ])
428
426
return bytes , newOffset
429
427
}
430
428
431
- func (d * decoder ) decodeFloat64 (size uint , offset uint ) (float64 , uint ) {
429
+ func (d * decoder ) decodeFloat64 (size , offset uint ) (float64 , uint ) {
432
430
newOffset := offset + size
433
431
bits := binary .BigEndian .Uint64 (d .buffer [offset :newOffset ])
434
432
return math .Float64frombits (bits ), newOffset
435
433
}
436
434
437
- func (d * decoder ) decodeFloat32 (size uint , offset uint ) (float32 , uint ) {
435
+ func (d * decoder ) decodeFloat32 (size , offset uint ) (float32 , uint ) {
438
436
newOffset := offset + size
439
437
bits := binary .BigEndian .Uint32 (d .buffer [offset :newOffset ])
440
438
return math .Float32frombits (bits ), newOffset
441
439
}
442
440
443
- func (d * decoder ) decodeInt (size uint , offset uint ) (int , uint ) {
441
+ func (d * decoder ) decodeInt (size , offset uint ) (int , uint ) {
444
442
newOffset := offset + size
445
443
var val int32
446
444
for _ , b := range d .buffer [offset :newOffset ] {
@@ -540,7 +538,7 @@ func (d *decoder) decodeSlice(
540
538
return offset , nil
541
539
}
542
540
543
- func (d * decoder ) decodeString (size uint , offset uint ) (string , uint ) {
541
+ func (d * decoder ) decodeString (size , offset uint ) (string , uint ) {
544
542
newOffset := offset + size
545
543
return string (d .buffer [offset :newOffset ]), newOffset
546
544
}
@@ -628,7 +626,7 @@ func cachedFields(result reflect.Value) *fieldsType {
628
626
return fields
629
627
}
630
628
631
- func (d * decoder ) decodeUint (size uint , offset uint ) (uint64 , uint ) {
629
+ func (d * decoder ) decodeUint (size , offset uint ) (uint64 , uint ) {
632
630
newOffset := offset + size
633
631
bytes := d .buffer [offset :newOffset ]
634
632
@@ -639,7 +637,7 @@ func (d *decoder) decodeUint(size uint, offset uint) (uint64, uint) {
639
637
return val , newOffset
640
638
}
641
639
642
- func (d * decoder ) decodeUint128 (size uint , offset uint ) (* big.Int , uint ) {
640
+ func (d * decoder ) decodeUint128 (size , offset uint ) (* big.Int , uint ) {
643
641
newOffset := offset + size
644
642
val := new (big.Int )
645
643
val .SetBytes (d .buffer [offset :newOffset ])
@@ -685,7 +683,7 @@ func (d *decoder) decodeKey(offset uint) ([]byte, uint, error) {
685
683
// This function is used to skip ahead to the next value without decoding
686
684
// the one at the offset passed in. The size bits have different meanings for
687
685
// different data types
688
- func (d * decoder ) nextValueOffset (offset uint , numberToSkip uint ) (uint , error ) {
686
+ func (d * decoder ) nextValueOffset (offset , numberToSkip uint ) (uint , error ) {
689
687
if numberToSkip == 0 {
690
688
return offset , nil
691
689
}
0 commit comments