Opened 11 years ago
Closed 11 years ago
#3472 closed defect (fixed)
MSVC uses %Id for size_t and ptrdiff_t
Reported by: | cyril | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | msvc |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug: A badly formatted log in mjpegdec.c just make ffmpeg throw an exception when log is at DEBUG level.
In mjpegdec.c at line 1861:
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
%td should be replaced by %d
Attachments (1)
Change History (20)
comment:1 by , 11 years ago
comment:3 by , 11 years ago
You'll have to develop a Visual C++ 2010 application using FFmpeg dlls, which is redirecting avlog() streams to _vsntprintf_s().
As VC++ 2010 doesn't support %td, _vsntprintf_s just raise an invalid formatter exception.
comment:4 by , 11 years ago
Do I understand correctly that this is not reproducible with newer versions of Visual Studio? A "fix" is possible but this is not a regression and if newer MS compilers do not show this behaviour, I wonder if a possible change is worth the effort.
comment:5 by , 11 years ago
I've just checked MSDN and VC++ 2013 still have the same issue: %td and %ti aren't supported at all.
Anyway as I stated in "comment 1", I don't think it's worth the effort as it can easily be fixed with a workaround, so feel free to close this track.
comment:7 by , 11 years ago
Quite simple: I replace all those %td by %ld before passing them to VC++ printf functions
comment:8 by , 11 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:9 by , 11 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
I intend to work on this issue.
comment:10 by , 11 years ago
Summary: | Badly formatted DEBUG log in mjpegdec.c → MSVC uses %ld for size_t and ptrdiff_t |
---|
comment:12 by , 11 years ago
I'll test it later but if it works it won't be enough as %ti is also used in FFmpeg.
by , 11 years ago
Attachment: | patchptrdiff.diff added |
---|
comment:15 by , 11 years ago
Summary: | MSVC uses %ld for size_t and ptrdiff_t → MSVC uses %Id for size_t and ptrdiff_t |
---|
comment:17 by , 11 years ago
Replying to nikolaynnov:
Thanks for a fix!
Sorry if I misunderstand: Did you test the patch and it fixes an issue for you?
I unfortunately cannot test...
comment:18 by , 11 years ago
Sorry for the late reply.
I've just tested your patch on a few problematic files and now it's working fine with MSVC, the debug output doesn't cause any crash anymore.
comment:19 by , 11 years ago
Keywords: | msvc added |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Should be fixed in ced0d6c1 - thank you for the report and the testing!
I didn't know that %td was one of the new formatting rules of printf().
I don't have the rights to close a track, please feel free to do so.