Skip to content

Commit

Permalink
Add string constant loading to parse_mob_constants_segment
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrown committed Aug 9, 2011
1 parent 4d5be65 commit 04a055e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/m0/c/m0_mob.c
Expand Up @@ -220,8 +220,18 @@ parse_mob_constants_segment( M0_Interp *interp, FILE *stream ) {

for (i = 0; i < const_count; i++) {
const unsigned long length = read_long_from_stream( stream );
const char *constant =
(const char *)read_from_stream( stream, length );
const char *constant = NULL;
if (length <= 8) {
constant = read_from_stream( stream, length );
} else {
int string_len = read_long_from_stream(stream);
int encoding = read_long_from_stream(stream);
if (encoding == 0) {
// TODO
} else {
constant = read_from_stream(stream, string_len);
}
}

if (constant)
segment->consts[i] = constant;
Expand Down

0 comments on commit 04a055e

Please sign in to comment.