Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
lestrrat committed May 13, 2024
1 parent 5a3d7f0 commit e72b823
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jwt/openid/birthdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,18 @@ func (b *BirthdateClaim) UnmarshalJSON(data []byte) error {
return nil
}

var intSize int

func init() {
intSize = 64
if math.MaxInt == math.MaxInt32 {
intSize = 32
}
}

func parseBirthdayInt(s string) int {
i, _ := strconv.ParseInt(s, 10, 64)
if i < 0 || (math.MaxInt == math.MaxInt32 && i > math.MaxInt32) {
i, err := strconv.ParseInt(s, 10, intSize)
if err != nil {
return 0
}
return int(i)
Expand Down

0 comments on commit e72b823

Please sign in to comment.