summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-02-09 20:03:33 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-02-09 20:03:33 +0100
commit7af295b2ec22f06b24079bf895ac97079f64b6d7 (patch)
tree84a554fc2c169956e3ee975152332c39f6c3615a /src/sequence/sequence_to_string.c
parent9ca43c73ba29d6b42cd771f1567074418c883c3e (diff)
It's starting to "properly" reply...
The ACSL coverage is far behind though.
Diffstat (limited to 'src/sequence/sequence_to_string.c')
-rw-r--r--src/sequence/sequence_to_string.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/sequence/sequence_to_string.c b/src/sequence/sequence_to_string.c
index 96bd521..919ef0b 100644
--- a/src/sequence/sequence_to_string.c
+++ b/src/sequence/sequence_to_string.c
@@ -6,7 +6,7 @@
#include "../core/char.h"
#include "../core/index.h"
-#include "../pipe/pipe.h"
+#include "../error/error.h"
#include "../knowledge/knowledge.h"
@@ -20,7 +20,7 @@ static int ensure_string_capacity
ZoO_char * string [const restrict static 1],
size_t string_capacity [const restrict static 1],
const size_t string_required_capacity,
- const struct ZoO_pipe io [const restrict static 1]
+ FILE io [const restrict static 1]
)
{
ZoO_char * new_string;
@@ -61,10 +61,10 @@ static int increment_required_capacity
(
size_t current_capacity [const restrict static 1],
const size_t increase_factor,
- const struct ZoO_pipe io [const restrict static 1]
+ FILE io [const restrict static 1]
)
{
- if ((ZoO_INDEX_MAX - increase_factor) > *current_capacity)
+ if ((ZoO_INDEX_MAX - increase_factor) < *current_capacity)
{
ZoO_S_ERROR
(
@@ -78,7 +78,7 @@ static int increment_required_capacity
*current_capacity += increase_factor;
- if ((SIZE_MAX / sizeof(ZoO_char)) > *current_capacity)
+ if ((SIZE_MAX / sizeof(ZoO_char)) < *current_capacity)
{
*current_capacity -= increase_factor;
@@ -102,13 +102,18 @@ static int add_word
ZoO_char * destination [const restrict static 1],
size_t destination_capacity [const restrict static 1],
size_t destination_length [const restrict static 1],
- const struct ZoO_pipe io [const restrict static 1]
+ FILE io [const restrict static 1]
)
{
const ZoO_char * word;
ZoO_index word_size;
size_t insertion_point;
+ if (word_id < ZoO_RESERVED_IDS_COUNT)
+ {
+ return 0;
+ }
+
(void) ZoO_knowledge_lock_access(k, io);
ZoO_knowledge_get_word(k, word_id, &word, &word_size);
(void) ZoO_knowledge_unlock_access(k, io);
@@ -155,15 +160,17 @@ int ZoO_sequence_to_undercase_string
(
const ZoO_index sequence [const restrict static 1],
const size_t sequence_length,
- ZoO_char * destination [const restrict static 1],
struct ZoO_knowledge k [const restrict static 1],
+ ZoO_char * destination [const restrict static 1],
size_t destination_capacity [const restrict static 1],
size_t destination_length [const restrict static 1],
- const struct ZoO_pipe io [const restrict static 1]
+ FILE io [const restrict static 1]
)
{
size_t i;
+ *destination_length = 0;
+
for (i = 0; i < sequence_length; ++i)
{
if