Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2017-12-25 15:01:12 -0500
committerEugene Tarassov2017-12-25 15:01:12 -0500
commit1bc0abf2d2fae08c55e6f2bb8e737a4c85f8104a (patch)
tree0fc7b3194a866473d81cd69cf69075e2e9f6ff13
parentc7dfa951feb13280ad69ecceac0a67d7a5c60047 (diff)
downloadorg.eclipse.tcf.agent-1bc0abf2d2fae08c55e6f2bb8e737a4c85f8104a.tar.gz
org.eclipse.tcf.agent-1bc0abf2d2fae08c55e6f2bb8e737a4c85f8104a.tar.xz
org.eclipse.tcf.agent-1bc0abf2d2fae08c55e6f2bb8e737a4c85f8104a.zip
TCF Agent: fixed compilation warning: ā€˜%sā€™ directive output may be truncated ...
-rw-r--r--agent/tcf/framework/cpudefs.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/agent/tcf/framework/cpudefs.c b/agent/tcf/framework/cpudefs.c
index 4dd55191..83f4f11c 100644
--- a/agent/tcf/framework/cpudefs.c
+++ b/agent/tcf/framework/cpudefs.c
@@ -166,24 +166,26 @@ int id2frame(const char * id, Context ** ctx, int * frame) {
}
const char * frame2id(Context * ctx, int frame) {
- char id[256];
+ size_t l = strlen(ctx->id) + 20;
+ char * id = tmp_alloc(l);
assert(frame >= 0);
- snprintf(id, sizeof(id), "FP%d.%s", frame, ctx->id);
- return tmp_strdup(id);
+ snprintf(id, l, "FP%d.%s", frame, ctx->id);
+ return id;
}
const char * register2id(Context * ctx, int frame, RegisterDefinition * reg) {
- char id[256];
RegisterDefinition * defs = get_reg_definitions(ctx);
+ size_t l = strlen(ctx->id) + 30;
+ char * id = tmp_alloc(l);
assert(defs != NULL);
assert(reg >= defs);
if (frame < 0) {
- snprintf(id, sizeof(id), "R%d.%s", (int)(reg - defs), ctx->id);
+ snprintf(id, l, "R%d.%s", (int)(reg - defs), ctx->id);
}
else {
- snprintf(id, sizeof(id), "R%d@%d.%s", (int)(reg - defs), frame, ctx->id);
+ snprintf(id, l, "R%d@%d.%s", (int)(reg - defs), frame, ctx->id);
}
- return tmp_strdup(id);
+ return id;
}
int id2reg_num(const char * id, const char ** ctx_id, int * frame, unsigned * reg_num) {

Back to the top