Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix some bad conversions #9703

Merged
merged 4 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auth/httptransport/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (f *httpFormat) SpanContextFromRequest(req *http.Request) (sc trace.SpanCon
if !strings.HasPrefix(h, "o=") {
return sc, true
}
o, err := strconv.ParseUint(h[2:], 10, 64)
o, err := strconv.ParseUint(h[2:], 10, 32)
if err != nil {
return trace.SpanContext{}, false
}
Expand Down
5 changes: 2 additions & 3 deletions pubsublite/pscompat/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,10 @@ func ParseMessageMetadata(id string) (*MessageMetadata, error) {
if len(parts) != 2 {
return nil, fmt.Errorf("pubsublite: invalid encoded message metadata %q", id)
}

partition, pErr := strconv.ParseInt(parts[0], 10, 64)
partition, pErr := strconv.Atoi(parts[0])
offset, oErr := strconv.ParseInt(parts[1], 10, 64)
if pErr != nil || oErr != nil {
return nil, fmt.Errorf("pubsublite: invalid encoded message metadata %q", id)
}
return &MessageMetadata{Partition: int(partition), Offset: offset}, nil
return &MessageMetadata{Partition: partition, Offset: offset}, nil
}
2 changes: 1 addition & 1 deletion spanner/spansql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ func (p *parser) consumeStringContent(delim string, raw, unicode bool, name stri
if !(i+1 < len(p.s) && isHexDigit(p.s[i]) && isHexDigit(p.s[i+1])) {
return "", p.errorf("illegal escape sequence: hex escape sequence must be followed by 2 hex digits")
}
c, err := strconv.ParseUint(p.s[i:i+2], 16, 64)
c, err := strconv.ParseUint(p.s[i:i+2], 16, 8)
if err != nil {
return "", p.errorf("illegal escape sequence: invalid hex digits: %q: %v", p.s[i:i+2], err)
}
Expand Down
Loading