Very new to B4A. Working on converting a VB6 product to the Andriod platform. I have a function changed to it to a sub.
This sub GetCRC is passed a few vairables calculates a checsum then direct calls a sum CRCtab to index into a lookup table. The problem is the last line of the GetCRC sub were I try to put the results into it to pass to the next sub. Compiler error attached.
Compiling code. Error
Error compiling program.
Error description: Syntax error (missing parameter).
Occurred on line: 38
GetCRC = s
Word: s
Code
Sub GetCRC( str As String, slen As Int, s As Long) As Long
'Sub GetCRC (v1 As myCrcType) As Long
Dim ss As Long
Dim i As Int
Dim sav_s As Long
Dim c As Int
Dim Index As Int
'On Error Resume Next
For i = 1 To slen
'c = Asc(Mid(str, i, 1)) 'original line
c = Asc(str.SubString2(i,1))
Index = Bit.And((Bit.xor(s, c)),0xFF)
sav_s = (s / 256) - ((s Mod 0xFF) / 0xFF)
sav_s = Bit.And(sav_s, 65535)
s = Bit.xor(CRCtab(Index), (sav_s))
s = Bit.And(s, 65535)
Next i
GetCRC = s ' here is the line
End Sub
Thanks in advance for any ideals.
This sub GetCRC is passed a few vairables calculates a checsum then direct calls a sum CRCtab to index into a lookup table. The problem is the last line of the GetCRC sub were I try to put the results into it to pass to the next sub. Compiler error attached.
Compiling code. Error
Error compiling program.
Error description: Syntax error (missing parameter).
Occurred on line: 38
GetCRC = s
Word: s
Code
Sub GetCRC( str As String, slen As Int, s As Long) As Long
'Sub GetCRC (v1 As myCrcType) As Long
Dim ss As Long
Dim i As Int
Dim sav_s As Long
Dim c As Int
Dim Index As Int
'On Error Resume Next
For i = 1 To slen
'c = Asc(Mid(str, i, 1)) 'original line
c = Asc(str.SubString2(i,1))
Index = Bit.And((Bit.xor(s, c)),0xFF)
sav_s = (s / 256) - ((s Mod 0xFF) / 0xFF)
sav_s = Bit.And(sav_s, 65535)
s = Bit.xor(CRCtab(Index), (sav_s))
s = Bit.And(s, 65535)
Next i
GetCRC = s ' here is the line
End Sub
Thanks in advance for any ideals.