Skip to content
Snippets Groups Projects
Commit 9c9590e1 authored by Jonathan Schöbel's avatar Jonathan Schöbel
Browse files

Text: fetch a substring

The function SH_Text_get_string returns a substring of text beginning at
index and of length offset. If index is out of bounds, NULL is returned
and an error is set. If offset is out of bounds, the existent part is
returned. Also the length of the returned string can be set (optionally)
to the out parameter length.
If the original behaviour of SH_Text_get_string is achieved,
SH_Text_get_string (text, length, error) has to be changed to
SH_Text_get_string (text, 0, SIZE_MAX, length, error). The only
difference will be that the function won't fail, when the text is longer
than SIZE_MAX, because it is told to stop there. A text that is longer
than SIZE_MAX is not possible to be returned, but that wasn't possible
at anytime. Also I don't think handling char[] longer than SIZE_MAX is
possible with the standard C library. Those in this case the text can
only be returned in parts (By now only possible till 2*SIZE_MAX-1 with
calling SH_Text_get_string (text, SIZE_MAX, SIZE_MAX, length, error))
or has to be manipulated using the appropiate SH_Text methods, which are
not implemented yet.
parent 0cf7d0b6
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment