[x265] [PATCH] replace comma with dot seperator from commandline when dumping to csv

Mario *LigH* Rohkrämer contact at ligh.de
Thu Oct 15 12:48:54 CEST 2015


IMHO the wrong "solution"; CSV supports string cells in double quotes, so  
I'd prefer wrapping string values in double quotes if they contain a comma  
(double quotes inside strings are to be escaped by doubling them).

There are also variants of CSV preferring semicola as cell separators.  
This is also safer for the Germal locale using a decimal comma instead of  
decimal dot (even though numeric values in CSV files will probably be  
saved in "English" notation instead of locale dependent).


Am 15.10.2015, 12:21 Uhr, schrieb <mahesh at multicorewareinc.com>:

> # HG changeset patch
> # User Mahesh Pittala <mahesh at multicorewareinc.com>
> # Date 1444904078 -19800
> #      Thu Oct 15 15:44:38 2015 +0530
> # Node ID 6e001b1e7bef6835b61d972977565d069690f65d
> # Parent  b6156a08b1def3584647f26096866c1a0c11e54a
> replace comma with dot seperator from commandline when dumping to csv
>
> When we add comma in commandline, commandline splitting into multiple  
> cells in csv
> so the header and data are mismatching
>
> diff -r b6156a08b1de -r 6e001b1e7bef source/common/threadpool.cpp
> --- a/source/common/threadpool.cpp	Fri Oct 09 20:45:59 2015 +0530
> +++ b/source/common/threadpool.cpp	Thu Oct 15 15:44:38 2015 +0530
> @@ -298,10 +298,10 @@
>                  nodeMaskPerPool[i] = ((uint64_t)1 << i);
>              }
> -            /* consume current node string, comma, and white-space */
> -            while (*nodeStr && *nodeStr != ',')
> +            /* consume current node string, comma, period, and  
> white-space */
> +            while (*nodeStr && *nodeStr != ',' && *nodeStr != '.')
>                 ++nodeStr;
> -            if (*nodeStr == ',' || *nodeStr == ' ')
> +            if (*nodeStr == ',' || *nodeStr == '.' || *nodeStr == ' ')
>                 ++nodeStr;
>          }
>      }
> diff -r b6156a08b1de -r 6e001b1e7bef source/x265-extras.cpp
> --- a/source/x265-extras.cpp	Fri Oct 09 20:45:59 2015 +0530
> +++ b/source/x265-extras.cpp	Thu Oct 15 15:44:38 2015 +0530
> @@ -201,7 +201,11 @@
>      for (int i = 1; i < argc; i++)
>      {
>          if (i) fputc(' ', csvfp);
> -        fputs(argv[i], csvfp);
> +        for (int j = 0; j < strlen(argv[i]); j++)
> +            if (argv[i][j] == ',')
> +                fputc ('.', csvfp);
> +            else
> +                fputc (argv[i][j], csvfp);
>      }
>     // current date and time
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel


-- 

Fun and success!
Mario *LigH* Rohkrämer
mailto:contact at ligh.de
 


More information about the x265-devel mailing list