> Why do you use a 'do' loop? Can't you use the normal 2-step > approach, i.e. call the winapi function with a NULL buffer, > and then use the returned size to allocate the buffer. > This way you always need a single allocation only.
GetModuleFileNameW does not follow this convention: https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew > If the length of the path exceeds the size that the nSize parameter specifies, > the function succeeds and the string is truncated to nSize characters > including the terminating null character. MS does the looping too in their WIL library: https://github.com/microsoft/wil/blob/master/include/wil/win32_helpers.h#L339-L341. _______________________________________________ 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".