diff mbox

[FFmpeg-devel] lavu/timestamp: Avoid C++-unfriendly code in installed header

Message ID 903556ed-01e0-4527-8368-490f64b3a9f3@jkqxz.net
State Accepted
Commit a2c912c3b6b833f2aacf414264c566f86f0a4e7c
Headers show

Commit Message

Mark Thompson Aug. 31, 2016, 8:01 p.m. UTC
Including this header in a C++11 program (inside extern "C") will
throw an error because it looks like a user-defined literal.  Add a
space between the two tokens to avoid the problem.
---
Noted by mcjack in #ffmpeg.

I think this is the only instance of the problem in all of the installed headers - it doesn't matter anywhere else because ffmpeg itself is built with a C compiler.

 libavutil/timestamp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Aug. 31, 2016, 8:31 p.m. UTC | #1
On Wed, Aug 31, 2016 at 09:01:57PM +0100, Mark Thompson wrote:
> Including this header in a C++11 program (inside extern "C") will
> throw an error because it looks like a user-defined literal.  Add a
> space between the two tokens to avoid the problem.
> ---
> Noted by mcjack in #ffmpeg.

LGTM

thx

[...]
Mark Thompson Sept. 1, 2016, 7:04 p.m. UTC | #2
On 31/08/16 21:31, Michael Niedermayer wrote:
> On Wed, Aug 31, 2016 at 09:01:57PM +0100, Mark Thompson wrote:
>> Including this header in a C++11 program (inside extern "C") will
>> throw an error because it looks like a user-defined literal.  Add a
>> space between the two tokens to avoid the problem.
>> ---
>> Noted by mcjack in #ffmpeg.
> 
> LGTM
> 
> thx

Pushed.

Thanks,

- Mark
diff mbox

Patch

diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
index f010a7e..e082f01 100644
--- a/libavutil/timestamp.h
+++ b/libavutil/timestamp.h
@@ -43,7 +43,7 @@ 
 static inline char *av_ts_make_string(char *buf, int64_t ts)
 {
     if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
-    else                      snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64, ts);
+    else                      snprintf(buf, AV_TS_MAX_STRING_SIZE, "%" PRId64, ts);
     return buf;
 }