Skip to content

Fix the conversions of section names #631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yutaro-sakamoto opened this issue May 7, 2025 · 0 comments
Open

Fix the conversions of section names #631

yutaro-sakamoto opened this issue May 7, 2025 · 0 comments
Assignees

Comments

@yutaro-sakamoto
Copy link
Contributor

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);
}
}

@yutaro-sakamoto yutaro-sakamoto self-assigned this May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant