Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
greubel
Visitor

2.6 SDK crashes Roku

Problem with new SDK.
This was working in 2.4, now with 2.6 it crashes the Roku.

Function Byte_2_String( in as object, idx as integer, sz as integer) as string
str = CreateObject( "roString" )
if sz = 0 return str
for i=0 to sz-1
if in[idx+i] = 0 exit for
c = Chr( in[idx+i] )
str = str + c
end for
return str
End Function

* Modified routine so it would work.

Function Byte_2_String( in as object, idx as integer, sz as integer) as string
str = ""
if sz = 0 return str
for i=0 to sz-1
if in[idx+i] = 0
exit for
end if
j = in[idx+i]
str = str+Chr(j)
end for
return str
End Function

*
The reason I didn't notice it, is because something else changed.
The status from GetToFile() used to return the http status now it returns a 1 for completed.
I was never getting to the code that crashes the Roku.

sock = Socket( url )
hdr = 128 + 228
beg = size - hdr
sock.AddHeader( "Range", "bytes="+beg.tostr()+"-"+size.tostr() )
st = sock.GetToFile( "tmp:/ID3-tail" )
? "get = " st
if st <> 206 and st <> 1 return
0 Kudos
3 REPLIES 3
kbenson
Visitor

Re: 2.6 SDK crashes Roku

I also noticed getToFile returns 1, but not just for completed. It returns 1 for failures as well. I tested a missing file URL (404) and a non-existent IP, and both returned 1 even though it failed.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
RokuKevin
Visitor

Re: 2.6 SDK crashes Roku

greubel,

I assume you meant a BrightScript crash not a firmware crash.... Your script would crash because although the '+' operator does string concatenation, it cannot concatenate the character to the end of a string.

kbenson,

roUrlTransfer.GetToFile() returning 1 and not the http status is indeed a bug. We will fix it in an upcoming release.

--Kevin
0 Kudos
kbenson
Visitor

Re: 2.6 SDK crashes Roku

"RokuKevin" wrote:
roUrlTransfer.GetToFile() returning 1 and not the http status is indeed a bug. We will fix it in an upcoming release.


Thanks!
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.