This is a bug report for GrStringGet in revision 2.1.3.156 of the Tiva Graphics Library; I already found a solution.
I am using a CSV file with translated strings. It gets converted to an uncompressed string table with "mkstringtable -u ...". In one line of the file I had something equivalent to
"1234567890abcd", "12345678", ...
The second string was getting encoded by mkstringtable by referring to the first string, of which it is the first eight characters. When requesting the second string using GrStringGet(), I was getting the correct eight characters followed by two more characters that changed somewhat randomly (probably leftover stuff on the stack). Also, when this happened, GrStringGet() returned zero rather than eight (the correct string length) or ten (the actual length reported by strlen() for the returned string).
The problematic string was being handled by the second place in GrStringGet() with the comment "Copy this portion of the string to the output buffer." Most of the other strings (which worked right) were handled by the following case, which is commented with "Now copy the last piece of the string." The latter (working) case ends with this code:
// If we had not copied any characters before hitting this case,
// initialize the output pointer (this keeps the code at the end of
// the function that returns the length happy). This will be the
// case if we are using an uncompressed string table.
//
if(!pui8BufferOut)
{
pui8BufferOut = (uint8_t *)pcData + (i32Idx + i32Buf);
}
I think adding that code to the problematic section would fix it, but I accomplished the same thing without adding code by rearranging how the "if" statements were nested to make both cases execute that code. I don't see a way to attach a file; if I can't find one I will follow up with at least a snippet of the code.
Steve