Skip to content

Fix the conversions of section names #631

Open
@yutaro-sakamoto

Description

@yutaro-sakamoto

The following process may fail if section names contain non-ASCII characters

static void joutput_label_variable_name(char *s, int key,
struct cb_label *section) {
joutput(CB_PREFIX_LABEL);
if (s) {
if (section && section->name) {
const char *c;
for (c = (const char *)section->name; *c; ++c) {
if (*c == ' ') {
joutput("_");
} else if (*c == '-') {
joutput("_");
} else {
joutput("%c", *c);
}
}
joutput("__");
}
char buf[COB_SMALL_BUFF];
strcpy_identifier_cobol_to_java(buf, s);
char *p = buf;
while (*p) {
if (*p < 0x80) {
if (*p == '-') {
*p = '_';
} else if (*p == ' ') {
*p = '_';
}
p++;
} else {
if (*(p + 1) == '\0') {
break;
} else {
p = p + 2;
}
}
}
joutput("%s", buf);
} else {
joutput("anonymous__%d", key);
}
}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions