Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
f52fcaa4
Commit
f52fcaa4
authored
Nov 15, 2007
by
Andreas Schwab
Browse files
(Fformat): Correctly format EMACS_INT values.
parent
3b58b873
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
src/ChangeLog
src/ChangeLog
+4
-0
src/editfns.c
src/editfns.c
+26
-14
No files found.
src/ChangeLog
View file @
f52fcaa4
2007-11-15 Andreas Schwab <schwab@suse.de>
* editfns.c (Fformat): Correctly format EMACS_INT values.
2007-11-15 Juanma Barranquero <lekktu@gmail.com>
* macfns.c (Fx_create_frame, Fx_display_pixel_width)
...
...
src/editfns.c
View file @
f52fcaa4
...
...
@@ -3803,23 +3803,35 @@ usage: (format STRING &rest OBJECTS) */)
format
-
this_format_start
);
this_format
[
format
-
this_format_start
]
=
0
;
if
(
INTEGERP
(
args
[
n
]))
if
(
format
[
-
1
]
==
'e'
||
format
[
-
1
]
==
'f'
||
format
[
-
1
]
==
'g'
)
sprintf
(
p
,
this_format
,
XFLOAT_DATA
(
args
[
n
]));
else
{
if
(
format
[
-
1
]
==
'd'
)
sprintf
(
p
,
this_format
,
XINT
(
args
[
n
]));
/* Don't sign-extend for octal or hex printing. */
if
(
sizeof
(
EMACS_INT
)
>
sizeof
(
int
))
{
/* Insert 'l' before format spec. */
this_format
[
format
-
this_format_start
]
=
this_format
[
format
-
this_format_start
-
1
];
this_format
[
format
-
this_format_start
-
1
]
=
'l'
;
this_format
[
format
-
this_format_start
+
1
]
=
0
;
}
if
(
INTEGERP
(
args
[
n
]))
{
if
(
format
[
-
1
]
==
'd'
)
sprintf
(
p
,
this_format
,
XINT
(
args
[
n
]));
/* Don't sign-extend for octal or hex printing. */
else
sprintf
(
p
,
this_format
,
XUINT
(
args
[
n
]));
}
else
if
(
format
[
-
1
]
==
'd'
)
/* Maybe we should use "%1.0f" instead so it also works
for values larger than MAXINT. */
sprintf
(
p
,
this_format
,
(
EMACS_INT
)
XFLOAT_DATA
(
args
[
n
]));
else
sprintf
(
p
,
this_format
,
XUINT
(
args
[
n
]));
/* Don't sign-extend for octal or hex printing. */
sprintf
(
p
,
this_format
,
(
EMACS_UINT
)
XFLOAT_DATA
(
args
[
n
]));
}
else
if
(
format
[
-
1
]
==
'e'
||
format
[
-
1
]
==
'f'
||
format
[
-
1
]
==
'g'
)
sprintf
(
p
,
this_format
,
XFLOAT_DATA
(
args
[
n
]));
else
if
(
format
[
-
1
]
==
'd'
)
/* Maybe we should use "%1.0f" instead so it also works
for values larger than MAXINT. */
sprintf
(
p
,
this_format
,
(
EMACS_INT
)
XFLOAT_DATA
(
args
[
n
]));
else
/* Don't sign-extend for octal or hex printing. */
sprintf
(
p
,
this_format
,
(
EMACS_UINT
)
XFLOAT_DATA
(
args
[
n
]));
if
(
p
>
buf
&&
multibyte
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment