Steven Liu (12020-04-08): > I cannot get the mean of BPrint where should or when should use it, maybe you > can introduce it, > I always think BPrint is used to instead of av_[a]sprintf, > because I saw mkver submit 3 patches to modify from snprintf to BPrint
BPrint brings three benefits: - It keeps track of the string length. It is therefore useful when you have several snprintf(). If you have only one, this benefit is negated. - It switches to dynamic allocation if the buffer is too small. If your string does not have a bounded size and keeping it entirely is important, then replacing a buffer with an arbitrary high limit with BPrint is useful. - Before switching to dynamic allocation, it uses a local buffer in the structure (probably on stack). If the string does not need to outlive its creation very far, it works. If we need to keep the string, a dynamic allocation is necessary anyway. For this case: (1) there is only one snprintf(), (2) we don't use a fixed-size buffer and (3) we'll keep the string. Regards, -- Nicolas George
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".