fixes weird \0 issue
This commit is contained in:
parent
1d322705d0
commit
dcc00780cc
@ -7,8 +7,7 @@
|
||||
|
||||
extern struct flags flags;
|
||||
|
||||
void init_flags(struct flags* flags)
|
||||
{
|
||||
void init_flags(struct flags* flags) {
|
||||
flags->files[0] = NULL;
|
||||
flags->files[1] = NULL;
|
||||
|
||||
@ -31,7 +30,8 @@ void add_text_to_chunk(char* src, char** dst)
|
||||
*dst = malloc(sizeof(char) * (flags.cols + 1));
|
||||
|
||||
strncpy(*dst, src, flags.cols);
|
||||
(*dst)[TEXT_LINE_LEN] = '\0';
|
||||
|
||||
(*dst)[flags.cols] = '\0';
|
||||
}
|
||||
|
||||
void convert_text_to_hex(hex_chunk_t* chunk)
|
||||
|
@ -96,9 +96,9 @@ int main(int argc, char* argv[])
|
||||
|
||||
hex_chunk_t* lines = malloc(sizeof(hex_chunk_t) * hex_lines);
|
||||
|
||||
|
||||
for (i = 0; i < hex_lines; i++) {
|
||||
lines[i].line = i;
|
||||
|
||||
add_text_to_chunk(file_content + (i * (flags.cols)), &(lines[i].text));
|
||||
convert_text_to_hex(&lines[i]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user