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

metaid: use int64 for 32-bit compatibility #103

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
22 changes: 11 additions & 11 deletions pkg/metaid/ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import (
)

func MakeWAUserID(jid types.JID) networkid.UserID {
return networkid.UserID(strconv.Itoa(int(jid.UserInt())))
return networkid.UserID(strconv.FormatUint(jid.UserInt(), 10))
}

func MakeUserID(user int64) networkid.UserID {
return networkid.UserID(strconv.Itoa(int(user)))
return networkid.UserID(strconv.FormatInt(user, 10))
}

func ParseIDFromString(id string) (int64, error) {
i, err := strconv.Atoi(id)
i, err := strconv.ParseInt(id, 10, 64)
if err != nil {
return 0, err
}
return int64(i), nil
return i, nil
}

func MakeUserLoginID(user int64) networkid.UserLoginID {
Expand All @@ -34,22 +34,22 @@ func MakeWAPortalID(jid types.JID) networkid.PortalID {
}

func MakeFBPortalID(portal int64) networkid.PortalID {
return networkid.PortalID(strconv.Itoa(int(portal)))
return networkid.PortalID(strconv.FormatInt(portal, 10))
}

func ParseUserID(user networkid.UserID) int64 {
i, _ := strconv.Atoi(string(user))
return int64(i)
i, _ := strconv.ParseInt(string(user), 10, 64)
return i
}

func ParseUserLoginID(user networkid.UserLoginID) int64 {
i, _ := strconv.Atoi(string(user))
return int64(i)
i, _ := strconv.ParseInt(string(user), 10, 64)
return i
}

func ParseFBPortalID(portal networkid.PortalID) int64 {
i, _ := strconv.Atoi(string(portal))
return int64(i)
i, _ := strconv.ParseInt(string(portal), 10, 64)
return i
}

func ParseWAPortalID(portal networkid.PortalID, server string) types.JID {
Expand Down