diff mbox

[FFmpeg-devel] Remove carriage return ('\r') in Windows CC_IDENT

Message ID CAF1j9YO48GWn53C2Xw9+jfH3DqFh7CPnO5OqDN-kgFubJtdJ=w@mail.gmail.com
State New
Headers show

Commit Message

Xiaohan Wang (王消寒) Jan. 31, 2018, 10:35 p.m. UTC

Comments

Michael Niedermayer Feb. 1, 2018, 9:45 p.m. UTC | #1
On Wed, Jan 31, 2018 at 02:35:29PM -0800, Xiaohan Wang (王消寒) wrote:
> 

>  configure |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> f8dfee52e94f632ac5803332e2fe050c9a880254  0001-Remove-carriage-return-r-in-Windows-CC_IDENT.patch
> From 07e33b2aa09b8b224ac35a5b56b29490a6486bdf Mon Sep 17 00:00:00 2001
> From: Xiaohan Wang <xhwang@chromium.org>
> Date: Wed, 31 Jan 2018 14:20:02 -0800
> Subject: [PATCH] Remove carriage return ('\r') in Windows CC_IDENT
> 
> Currently the Windows CC_IDENT is ended with '\r\n'. "head -n1" will not
> remove the '\r' and this is causing building error in Chromium.
> 
> This CL adds "tr -d '\r'" to remove '\r' in the CC_IDENT string. Since in
> most cases '\r' only appears at the end of a string/line, this should
> work in most cases.
> 
> See example:
> 
> printf "hello\r\nworld\r\n" | head -n1 | hd
> 00000000  68 65 6c 6c 6f 0d 0a                              |hello..|
> 
> printf "hello\r\nworld\r\n" | head -n1 | tr -d '\r' | hd
> 00000000  68 65 6c 6c 6f 0a                                 |hello.|
> 
> Also note a similar previous change at:
> https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2013-October/069950.html
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

[...]
diff mbox

Patch

From 07e33b2aa09b8b224ac35a5b56b29490a6486bdf Mon Sep 17 00:00:00 2001
From: Xiaohan Wang <xhwang@chromium.org>
Date: Wed, 31 Jan 2018 14:20:02 -0800
Subject: [PATCH] Remove carriage return ('\r') in Windows CC_IDENT

Currently the Windows CC_IDENT is ended with '\r\n'. "head -n1" will not
remove the '\r' and this is causing building error in Chromium.

This CL adds "tr -d '\r'" to remove '\r' in the CC_IDENT string. Since in
most cases '\r' only appears at the end of a string/line, this should
work in most cases.

See example:

printf "hello\r\nworld\r\n" | head -n1 | hd
00000000  68 65 6c 6c 6f 0d 0a                              |hello..|

printf "hello\r\nworld\r\n" | head -n1 | tr -d '\r' | hd
00000000  68 65 6c 6c 6f 0a                                 |hello.|

Also note a similar previous change at:
https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2013-October/069950.html
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index a83581ea98..4a68c6364d 100755
--- a/configure
+++ b/configure
@@ -4289,7 +4289,7 @@  probe_cc(){
         _ld_path='-libpath:'
     elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
         _type=msvc
-        _ident=$($_cc 2>&1 | head -n1)
+        _ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
         _cflags_speed="-O2"
-- 
2.16.0.rc1.238.g530d649a79-goog