зеркало из https://github.com/mozilla/pjs.git
Fix problem with generated consts in .h files for OS/2 - also handle the internal const value more sensibly, and lose wrong 'is_long' distinction.
Thanks to Henry Sobotka <sobotka@axess.com> for finding this problem and suggesting a fix. r=mccabe
This commit is contained in:
Родитель
51e4afc749
Коммит
bb10474667
|
@ -516,7 +516,7 @@ do_const_dcl(TreeState *state)
|
|||
{
|
||||
struct _IDL_CONST_DCL *dcl = &IDL_CONST_DCL(state->tree);
|
||||
const char *name = IDL_IDENT(dcl->ident).str;
|
||||
gboolean success, is_signed, is_long;
|
||||
gboolean success, is_signed;
|
||||
|
||||
/* const -> list -> interface */
|
||||
if (!IDL_NODE_UP(IDL_NODE_UP(state->tree)) ||
|
||||
|
@ -529,27 +529,22 @@ do_const_dcl(TreeState *state)
|
|||
}
|
||||
|
||||
success = (IDLN_TYPE_INTEGER == IDL_NODE_TYPE(dcl->const_type));
|
||||
if(success) {
|
||||
if (success) {
|
||||
switch(IDL_TYPE_INTEGER(dcl->const_type).f_type) {
|
||||
case IDL_INTEGER_TYPE_SHORT:
|
||||
is_long = FALSE;
|
||||
break;
|
||||
case IDL_INTEGER_TYPE_LONG:
|
||||
is_long = TRUE;
|
||||
break;
|
||||
default:
|
||||
success = FALSE;
|
||||
break;
|
||||
}
|
||||
is_signed = IDL_TYPE_INTEGER(dcl->const_type).f_signed;
|
||||
}
|
||||
|
||||
if(success) {
|
||||
const char *const_format =
|
||||
is_long ? (is_signed ? "%ld" : "%lu")
|
||||
: (is_signed ? "%d" : "%u");
|
||||
if (success) {
|
||||
const char *const_format = is_signed ? "%" IDL_LL "d" : "%" IDL_LL "u";
|
||||
fprintf(state->file, "\n enum { %s = ", name);
|
||||
fprintf(state->file, const_format,
|
||||
(int)IDL_INTEGER(dcl->const_exp).value);
|
||||
fprintf(state->file, const_format, IDL_INTEGER(dcl->const_exp).value);
|
||||
fprintf(state->file, " };\n");
|
||||
} else {
|
||||
IDL_tree_error(state->tree,
|
||||
|
|
Загрузка…
Ссылка в новой задаче