summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 021072e)
raw | patch | inline | side by side (parent: 021072e)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 3 Mar 2017 23:15:06 +0000 (02:15 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 3 Mar 2017 23:15:06 +0000 (02:15 +0300) |
mpc/.gitignore | [new file with mode: 0644] | patch | blob |
mpc/Makefile | patch | blob | history | |
mpc/structures/block.c | patch | blob | history |
diff --git a/mpc/.gitignore b/mpc/.gitignore
--- /dev/null
+++ b/mpc/.gitignore
@@ -0,0 +1 @@
+mp3CC
diff --git a/mpc/Makefile b/mpc/Makefile
index 61e8c9d63918a1fba92ef7b2c46f11da35e44359..e12def34f2d70f81765462a11181323123990e66 100644 (file)
--- a/mpc/Makefile
+++ b/mpc/Makefile
CC = gcc
-CFLAGS = -DLINUX -DUNIX -DNDEBUG -D_CONSOLE
+CFLAGS = -g -DLINUX -DUNIX -DNDEBUG -D_CONSOLE
LDFLAGS = -lm
OUTPUT = mp3CC
SOURCES = */*.c
diff --git a/mpc/structures/block.c b/mpc/structures/block.c
index cb7b9d4bdf085b1e561905672b59464d49f72aef..1b55eeae2479366bf16c2474d8e1981b4ad7c303 100644 (file)
--- a/mpc/structures/block.c
+++ b/mpc/structures/block.c
method->container_unit = library_unit;
method_name = string_create();
method_name->length = constant_pool[method_name_index].data_len;
- method_name->cstr = malloc(method_name->length + 1);
- strcpy(method_name->cstr, constant_pool[method_name_index].data);
- method_name->cstr[method_name->length] = '\0';
+ // Strings in class has no null char
+ method_name->cstr = malloc(method_name->length + 2);
+ strncpy(method_name->cstr, constant_pool[method_name_index].data, method_name->length);
+ method_name->cstr[method_name->length + 1] = '\0';
name_table_insert(library_unit->names, method_name, method);
}