-
-
Notifications
You must be signed in to change notification settings - Fork 494
ffmpeg: fix build failure with gbk encoding #8812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @choyy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a persistent build failure in FFmpeg when compiled within a MinGW64 environment, specifically targeting issues arising from Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a build failure for ffmpeg on systems with GBK encoding by introducing uchardet to detect and convert a configuration file to UTF-8. The changes are logical and well-targeted. I've provided a couple of suggestions for improvement: one to ensure the fix is applied consistently across all Windows build paths, and another to improve the robustness of the shell script by quoting a file path variable. Overall, this is a good fix for the reported issue.
| io.replace("configure", "cp_if_changed $TMPH config.h", [[ | ||
| config_encodings=$(uchardet $TMPH) | ||
| case "$config_encodings" in GB18030|GBK|GB2312) | ||
| { printf '\xEF\xBB\xBF'; iconv -f "$config_encodings" -t UTF-8 -c $TMPH; } > config.h;; | ||
| *) cp_if_changed $TMPH config.h;; | ||
| esac]], {plain = true}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great fix for the encoding issue. However, this io.replace call is inside an if path.cygwin then block. There is another code path for Windows builds in the else block (starting on line 283) which also invokes the ./configure script. This fix should also be applied there to ensure consistent behavior for all Windows builds. You could move this block of code to before the if path.cygwin then check (e.g., after line 274) to apply it to both paths.
| config_encodings=$(uchardet $TMPH) | ||
| case "$config_encodings" in GB18030|GBK|GB2312) | ||
| { printf '\xEF\xBB\xBF'; iconv -f "$config_encodings" -t UTF-8 -c $TMPH; } > config.h;; | ||
| *) cp_if_changed $TMPH config.h;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For robustness, it's a good practice to quote the $TMPH variable in shell scripts to handle potential spaces or special characters in the file path.
config_encodings=$(uchardet "$TMPH")
case "$config_encodings" in GB18030|GBK|GB2312)
{ printf '\xEF\xBB\xBF'; iconv -f "$config_encodings" -t UTF-8 -c "$TMPH"; } > config.h;;
*) cp_if_changed "$TMPH" config.h;;
fix #6167, and maybe #8499