[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Apr 9 15:06:54 PDT 2015


 util/options.cc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a664810e38b479e05ea32cac263cb5730629f9d8
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 9 15:04:42 2015 -0700

    [util] Accept comma as well as space when separating components of args
    
    Applies to --font-size and --margin.
    
    Hopefully the scanf usage here doesn't have compatibility issues
    (star being counted in the return value, etc).

diff --git a/util/options.cc b/util/options.cc
index 7387a56..afb1900 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -174,7 +174,7 @@ parse_margin (const char *name G_GNUC_UNUSED,
 {
   view_options_t *view_opts = (view_options_t *) data;
   view_options_t::margin_t &m = view_opts->margin;
-  switch (sscanf (arg, "%lf %lf %lf %lf", &m.t, &m.r, &m.b, &m.l)) {
+  switch (sscanf (arg, "%lf%*[ ,]%lf%*[ ,]%lf%*[ ,]%lf", &m.t, &m.r, &m.b, &m.l)) {
     case 1: m.r = m.t;
     case 2: m.b = m.t;
     case 3: m.l = m.r;
@@ -361,7 +361,7 @@ parse_font_size (const char *name G_GNUC_UNUSED,
     font_opts->font_size_y = font_opts->font_size_x = FONT_SIZE_UPEM;
     return true;
   }
-  switch (sscanf (arg, "%lf %lf", &font_opts->font_size_x, &font_opts->font_size_y)) {
+  switch (sscanf (arg, "%lf%*[ ,]%lf", &font_opts->font_size_x, &font_opts->font_size_y)) {
     case 1: font_opts->font_size_y = font_opts->font_size_x;
     case 2: return true;
     default:


More information about the HarfBuzz mailing list