Skip to content

Commit 061d84e

Browse files
committed
fix: overflows int on 32-bit platform
Close #11
1 parent 0df3178 commit 061d84e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tencentyun/TLSSigAPI.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func GenPrivateMapKeyWithStringRoomID(sdkappid int, key string, userid string, e
161161

162162
func genUserBuf(account string, dwSdkappid int, dwAuthID uint32,
163163
dwExpTime int, dwPrivilegeMap uint32, dwAccountType uint32, roomStr string) []byte {
164-
164+
appid := uint32(dwSdkappid)
165165
offset := 0
166166
length := 1 + 2 + len(account) + 20 + len(roomStr)
167167
if len(roomStr) > 0 {
@@ -188,13 +188,13 @@ func genUserBuf(account string, dwSdkappid int, dwAuthID uint32,
188188
}
189189

190190
//dwSdkAppid
191-
userBuf[offset] = (byte)((dwSdkappid & 0xFF000000) >> 24)
191+
userBuf[offset] = (byte)((appid & 0xFF000000) >> 24)
192192
offset++
193-
userBuf[offset] = (byte)((dwSdkappid & 0x00FF0000) >> 16)
193+
userBuf[offset] = (byte)((appid & 0x00FF0000) >> 16)
194194
offset++
195-
userBuf[offset] = (byte)((dwSdkappid & 0x0000FF00) >> 8)
195+
userBuf[offset] = (byte)((appid & 0x0000FF00) >> 8)
196196
offset++
197-
userBuf[offset] = (byte)(dwSdkappid & 0x000000FF)
197+
userBuf[offset] = (byte)(appid & 0x000000FF)
198198
offset++
199199

200200
//dwAuthId

0 commit comments

Comments
 (0)