- Oct 15, 2022
-
-
Jonathan Schöbel authored
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.
-
Jonathan Schöbel authored
The method SH_Text_get_char returns a single character by a given index. If the index is out of range, NULL is returned and error->type is set to VALUE_ERROR.
-
Jonathan Schöbel authored
The (intern) implementation of SH_Text was changed from an array of char, to a single linked list of arrays of char. This allows an easier implementation of (further) text manipulation. The API hasn't changed much, but SH_Text_join can't yield an error anymore, so it now doesn't support passing an error and returns nothing. The source has been adapted to splint, which still tells about some errors, but they are all checked to be false-positives.
-
Jonathan Schöbel authored
A method was added, that returns the generated text.
-
Jonathan Schöbel authored
The constructor SH_Text_new_from_string accepts a string, with that the text is initialized. This can replace the so far needed two calls SH_Text_new and SH_Text_append_string. When writing the test, it was neccessary to simulate an overflow. Thereby a bug was detected regarding another overflow test. The bug was, that when SIZE_MAX % CHUNK_SIZE == 0 (which is normally true, if 2^n is taken as the value for CHUNK_SIZE) there can't be an overflow, so the test for an overflow fails. Actually there wasn't a neccesity to check for an overflow, as this could easily be bypassed by just allocating the requested size instead of the next chunk size, if this would be greater then SIZE_MAX.
-
- Sep 21, 2022
-
-
Jonathan Schöbel authored
Sometimes a copy is needed.
-
- Sep 08, 2022
-
-
Jonathan Schöbel authored
When the wrap mode is used, after each tag a newline is started. Also the html is indented, which can be configured by the parameters indent_base, indent_base, indent_char. The parameter indent_base specifies the width the first tag should be indented with, while indent_step specifies the increment of the indent when switching to a child tag. The character, that is used for indenting is taken from indent_char. (It could also be a string longer than a single character). This aguments can't be set by the user, but are hardcoded (by now).
-
Jonathan Schöbel authored
Fragment can be copied, either recursive (copying also all childs) or nonrecursive (ignoring the childs, thus the copy has always no childs). Adding the same element twice in the tree (graph) isn't possible, as this leads to problems e.g. double free or similars.
-
- Sep 05, 2022
-
-
Jonathan Schöbel authored
The methods - SH_Fragment_get_child (by index) - SH_Fragment_is_child (non recursive) and - SH_Fragment_is_descendant (recursive) were added.
-
- Sep 04, 2022
-
-
Jonathan Schöbel authored
A Fragment can contain childs. When building the html, the childs html is generated where appropiate.
-
- Sep 01, 2022
-
-
Jonathan Schöbel authored
SH_Text_append_string can be used to append a string to the text, SH_Text_append_text can be used to append another text to the text. SH_Text_join is a wrapper for SH_Text_append_text, but also frees the second text, thus joining the texts to a single one.
-
Jonathan Schöbel authored
A Fragment can output it's html. If there is an error the method aborts and returns NULL.
-
Jonathan Schöbel authored
Changing sefht_validator_test so that no memory leaks occur.
-
- Jun 23, 2022
-
-
Jonathan Schöbel authored
The space a Text has for saving the string is allocated in chunks. To request additional space SH_Text_enlarge is called. If the requestad size fits inside the already allocated space or is even smaller than the current size, nothing is done. Otherwise a multiple of chunk size is allocated beeing equal or greater than the requested size. The chunk size can be changed by changing the macro CHUNK_SIZE in src/text.h. The default is 64. This adjustment is done automatically when a string is added.
-
- Jun 22, 2022
-
-
Jonathan Schöbel authored
Check in tests whether error really was written, by setting it to undefined before each call.
-
- Jun 21, 2022
-
-
Jonathan Schöbel authored
This is a data type to deal with frequently appending to a string.
-
Jonathan Schöbel authored
When a tag is made known to the Validator, which it already knows, the old id is returned and nothing is added. As this has to be checked by iterating over all known tags, a new helper function is written for both SH_Validator_check_tag and SH_Validator_register_tag: SH_Validator_get_tag. Because we want also to test this function, we have to include validator.c in the test file and override the static keyword by an empty macro. It isn't possible any more to check for correct overflowdetection by setting the index to UINT_MAX, because it will be iterated over all data, thus raising an SIGSEGV when doing so. This is solved by filling garbage unil UINT_MAX is really reached. As there would be an timeout and it would fill RAM with around 40 GB of garbage, UINT_MAX is overriden prior to inclusion of validator.c .
-
- Aug 31, 2022
-
-
Jonathan Schöbel authored
-
- Jun 21, 2022
-
-
Jonathan Schöbel authored
Validator serves as an syntax checker, i. e. it can be requested whether a tag is allowed.
-
- Jun 20, 2022
-
-
Jonathan Schöbel authored
-
Jonathan Schöbel authored
-
Jonathan Schöbel authored
Tests are done using check, allowing to integrate the tests into the Autotools. Methods that are part of another unit, but are called in this unit aren't tested as this would interfere with the idea of unittests. This also applies for purely wrapper functions, where a call is passed to another unit.
-