Changeset 7214


Ignore:
Timestamp:
03/24/12 09:43:04 (15 months ago)
Author:
anthony
Message:

Syntax error checks 'f' to 'l'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ImageMagick/trunk/MagickWand/operation.c

    r7213 r7214  
    10761076        { 
    10771077          /* SyncImageSettings() used to set per-image attribute. */ 
    1078           (void) SetImageOption(_image_info,option+1,ArgOption("none")); 
    1079           _draw_info->gravity=(GravityType) ParseCommandOption( 
    1080                    MagickGravityOptions,MagickFalse,ArgOption("none")); 
     1078          arg1 = ArgOption("none"); 
     1079          parse = ParseCommandOption(MagickGravityOptions,MagickFalse,arg1); 
     1080          if (parse < 0) 
     1081            CLIWandExceptArgBreak(OptionError,"UnrecognizedGravityType", 
     1082                                      option,arg1); 
     1083          (void) SetImageOption(_image_info,option+1,arg1); 
     1084          _draw_info->gravity=(GravityType) parse; 
    10811085          break; 
    10821086        } 
     
    10871091             Used directly by many coders 
    10881092          */ 
     1093          if (IfSetOption && IsGeometry(arg1) == MagickFalse) 
     1094            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    10891095          (void) SetImageOption(_image_info,option+1,ArgOption("0.0")); 
    10901096          break; 
     
    11001106             SyncImageSettings() used to set per-image attribute. 
    11011107          */ 
    1102           (void) SetImageOption(_image_info,option+1,ArgOption("undefined")); 
     1108          arg1 = ArgOption("indefined"); 
     1109          parse = ParseCommandOption(MagickIntentOptions,MagickFalse,arg1); 
     1110          if (parse < 0) 
     1111            CLIWandExceptArgBreak(OptionError,"UnrecognizedIntentType", 
     1112                                      option,arg1); 
     1113          (void) SetImageOption(_image_info,option+1,arg1); 
    11031114          break; 
    11041115        } 
     
    11081119             SyncImageSettings() used to set per-image attribute. 
    11091120          */ 
    1110           (void) SetImageOption(_image_info,option+1,ArgOption("undefined")); 
    1111           _image_info->interlace=(InterlaceType) ParseCommandOption( 
    1112                 MagickInterlaceOptions,MagickFalse,ArgOption("undefined")); 
     1121          arg1 = ArgOption("undefined"); 
     1122          parse = ParseCommandOption(MagickInterlaceOptions,MagickFalse,arg1); 
     1123          if (parse < 0) 
     1124            CLIWandExceptArgBreak(OptionError,"UnrecognizedInterlaceType", 
     1125                                      option,arg1); 
     1126          _image_info->interlace=(InterlaceType) parse; 
     1127          (void) SetImageOption(_image_info,option+1,arg1); 
    11131128          break; 
    11141129        } 
    11151130      if (LocaleCompare("interline-spacing",option+1) == 0) 
    11161131        { 
     1132          if (IfSetOption && IsGeometry(arg1) == MagickFalse) 
     1133            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    11171134          (void) SetImageOption(_image_info,option+1, ArgOption(NULL)); 
    11181135          _draw_info->interline_spacing=StringToDouble(ArgOption("0"), 
     
    11231140        { 
    11241141          /* SyncImageSettings() used to set per-image attribute. */ 
    1125           (void) SetImageOption(_image_info,option+1,ArgOption("undefined")); 
     1142          arg1 = ArgOption("undefined"); 
     1143          parse = ParseCommandOption(MagickInterpolateOptions,MagickFalse,arg1); 
     1144          if (parse < 0) 
     1145            CLIWandExceptArgBreak(OptionError,"UnrecognizedInterpolateMethod", 
     1146                                      option,arg1); 
     1147          (void) SetImageOption(_image_info,option+1,arg1); 
    11261148          break; 
    11271149        } 
    11281150      if (LocaleCompare("interword-spacing",option+1) == 0) 
    11291151        { 
     1152          if (IfSetOption && IsGeometry(arg1) == MagickFalse) 
     1153            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    11301154          (void) SetImageOption(_image_info,option+1, ArgOption(NULL)); 
    11311155          _draw_info->interword_spacing=StringToDouble(ArgOption("0"),(char **) NULL); 
     
    11381162      if (LocaleCompare("kerning",option+1) == 0) 
    11391163        { 
     1164          if (IfSetOption && IsGeometry(arg1) == MagickFalse) 
     1165            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    11401166          (void) SetImageOption(_image_info,option+1,ArgOption(NULL)); 
    11411167          _draw_info->kerning=StringToDouble(ArgOption("0"),(char **) NULL); 
     
    11541180      if (LocaleCompare("log",option+1) == 0) 
    11551181        { 
    1156           if (IfSetOption) 
     1182          if (IfSetOption) { 
     1183            if ((strchr(arg1,'%') == (char *) NULL)) 
     1184              CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    11571185            (void) SetLogFormat(arg1); 
     1186          } 
    11581187          break; 
    11591188        } 
     
    11611190        { 
    11621191          /* SyncImageSettings() used to set per-image attribute. */ 
    1163           (void) SetImageOption(_image_info,option+1,ArgOption("0")); 
     1192          arg1=ArgOption("0"); 
     1193          if (IsGeometry(arg1) == MagickFalse) 
     1194            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
     1195          (void) SetImageOption(_image_info,option+1,arg1); 
    11641196          break; 
    11651197        } 
     
    13251357             SyncImageSettings() used to set per-image attribute. 
    13261358          */ 
     1359          if (IfSetOption && IsGeometry(arg1) == MagickFalse) 
     1360            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    13271361          (void) SetImageOption(_image_info,option+1,ArgOption("0.0")); 
    13281362          break; 
     
    17221756      if (LocaleCompare("adaptive-resize",option+1) == 0) 
    17231757        { 
     1758          /* FUTURE: Roll into a resize special operator */ 
    17241759          if (IsGeometry(arg1) == MagickFalse) 
    17251760            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
     
    22292264               ** Convert that to an appropriate distortion argument array. 
    22302265               ** FUTURE: make a separate special resize operator 
    2231                */ 
     2266                    Roll into a resize special operator */ 
    22322267               if (IsGeometry(arg2) == MagickFalse) 
    22332268                 CLIWandExceptArgBreak(OptionError,"InvalidGeometry", 
     
    24982533      if (LocaleCompare("gamma",option+1) == 0) 
    24992534        { 
     2535          if (IsGeometry(arg1) == MagickFalse) 
     2536            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    25002537          if (IfNormalOp) 
    25012538            (void) GammaImage(_image,StringToDouble(arg1,(char **) NULL), 
     
    25082545          (LocaleCompare("gaussian",option+1) == 0)) 
    25092546        { 
     2547          if (IsGeometry(arg1) == MagickFalse) 
     2548            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    25102549          flags=ParseGeometry(arg1,&geometry_info); 
    25112550          if ((flags & SigmaValue) == 0) 
     
    25192558          /* 
    25202559            Record Image offset for composition. (A Setting) 
    2521             Resize last _image. (ListOperator) 
     2560            Resize last _image. (ListOperator)  -- DEPRECIATE 
    25222561            FUTURE: Why if no 'offset' does this resize ALL images? 
    25232562            Also why is the setting recorded in the IMAGE non-sense! 
     
    25292568              break; 
    25302569            } 
     2570          if (IsGeometry(arg1) == MagickFalse) 
     2571            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    25312572          flags=ParseRegionGeometry(_image,arg1,&geometry,_exception); 
    25322573          if (((flags & XValue) != 0) || ((flags & YValue) != 0)) 
     
    25732614      if (LocaleCompare("implode",option+1) == 0) 
    25742615        { 
     2616          if (IsGeometry(arg1) == MagickFalse) 
     2617            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    25752618          (void) ParseGeometry(arg1,&geometry_info); 
    25762619          new_image=ImplodeImage(_image,geometry_info.rho, 
     
    25802623      if (LocaleCompare("interpolative-resize",option+1) == 0) 
    25812624        { 
     2625          /* FUTURE: New to IMv7 
     2626               Roll into a resize special operator */ 
     2627          if (IsGeometry(arg1) == MagickFalse) 
     2628            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    25822629          (void) ParseRegionGeometry(_image,arg1,&geometry,_exception); 
    25832630          new_image=InterpolativeResizeImage(_image,geometry.width, 
     
    25912638      if (LocaleCompare("lat",option+1) == 0) 
    25922639        { 
     2640          if (IsGeometry(arg1) == MagickFalse) 
     2641            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    25932642          flags=ParseGeometry(arg1,&geometry_info); 
    25942643          if ((flags & PercentValue) != 0) 
     
    26092658            flags; 
    26102659 
     2660          if (IsGeometry(arg1) == MagickFalse) 
     2661            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    26112662          flags=ParseGeometry(arg1,&geometry_info); 
    26122663          black_point=geometry_info.rho; 
     
    26782729            flags; 
    26792730 
     2731          if (IsGeometry(arg1) == MagickFalse) 
     2732            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    26802733          flags=ParseGeometry(arg1,&geometry_info); 
    26812734          black_point=geometry_info.rho; 
     
    26962749      if (LocaleCompare("liquid-rescale",option+1) == 0) 
    26972750        { 
     2751          /* FUTURE: Roll into a resize special operator */ 
     2752          if (IsGeometry(arg1) == MagickFalse) 
     2753            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    26982754          flags=ParseRegionGeometry(_image,arg1,&geometry,_exception); 
    26992755          if ((flags & XValue) == 0) 
     
    31053161      if (LocaleCompare("sample",option+1) == 0) 
    31063162        { 
     3163          /* FUTURE: Roll into a resize special operator */ 
    31073164          (void) ParseRegionGeometry(_image,arg1,&geometry,_exception); 
    31083165          new_image=SampleImage(_image,geometry.width,geometry.height, 
     
    31123169      if (LocaleCompare("scale",option+1) == 0) 
    31133170        { 
     3171          /* FUTURE: Roll into a resize special operator */ 
    31143172          (void) ParseRegionGeometry(_image,arg1,&geometry,_exception); 
    31153173          new_image=ScaleImage(_image,geometry.width,geometry.height, 
     
    35573615%    o arg1, arg2: optional argument strings to the operation 
    35583616% 
    3559 % NOTE: only "limit" currently uses two arguments. 
     3617% NOTE: only "limit" uses two arguments. 
    35603618% 
    35613619% Example usage... 
     
    38563914            index; 
    38573915 
     3916          if (IfNormalOp && IsGeometry(arg1) == MagickFalse) 
     3917            CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1); 
    38583918          index=0; 
    38593919          insert_image=RemoveLastImageFromList(&_images); 
     
    38693929               index_image=GetImageFromList(_images,index-1); 
    38703930               if (index_image == (Image *) NULL) 
    3871                  { 
    3872                    (void) ThrowMagickException(_exception,GetMagickModule(), 
    3873                      OptionError,"NoSuchImage","'%s'",arg1); 
    3874                    break; 
    3875                  } 
     3931                 CLIWandExceptArgBreak(OptionError,"NoSuchImage",option,arg1); 
    38763932              InsertImageInList(&index_image,insert_image); 
    38773933            } 
     
    38853941      if (LocaleCompare("layers",option+1) == 0) 
    38863942        { 
    3887           ImageLayerMethod 
    3888             method; 
    3889  
    3890           method=(ImageLayerMethod) ParseCommandOption(MagickLayerOptions, 
    3891             MagickFalse,arg1); 
    3892           switch (method) 
     3943          parse=ParseCommandOption(MagickLayerOptions,MagickFalse,arg1); 
     3944          if ( parse < 0 ) 
     3945            CLIWandExceptArgBreak(OptionError,"UnrecognizedLayerMethod", 
     3946                 option,arg1); 
     3947          switch ((ImageLayerMethod) parse) 
    38933948          { 
    38943949            case CoalesceLayer: 
     
    39023957            default: 
    39033958            { 
    3904               new_images=CompareImagesLayers(_images,method,_exception); 
     3959              new_images=CompareImagesLayers(_images,(ImageLayerMethod) parse, 
     3960                   _exception); 
    39053961              break; 
    39063962            } 
     
    39103966            case TrimBoundsLayer: 
    39113967            { 
    3912               new_images=MergeImageLayers(_images,method,_exception); 
     3968              new_images=MergeImageLayers(_images,(ImageLayerMethod) parse, 
     3969                   _exception); 
    39133970              break; 
    39143971            } 
     
    40304087            limit; 
    40314088 
    4032           ResourceType 
    4033             type; 
    4034  
    4035           type=(ResourceType) ParseCommandOption(MagickResourceOptions, 
    4036             MagickFalse,arg1); 
    40374089          limit=MagickResourceInfinity; 
     4090          parse= ParseCommandOption(MagickResourceOptions,MagickFalse,arg1); 
     4091          if ( parse < 0 ) 
     4092            CLIWandExceptArgBreak(OptionError,"UnrecognizedResourceType", 
     4093                 option,arg1); 
    40384094          if (LocaleCompare("unlimited",arg2) != 0) 
    40394095            limit=(MagickSizeType) SiPrefixToDoubleInterval(arg2,100.0); 
    4040           (void) SetMagickResourceLimit(type,limit); 
     4096          (void) SetMagickResourceLimit((ResourceType)parse,limit); 
    40414097          break; 
    40424098        } 
     
    45244580 
    45254581      list=ParseCommandOption(MagickListOptions,MagickFalse, arg1); 
     4582      if ( list < 0 ) { 
     4583        CLIWandExceptionArg(OptionError,"UnrecognizedListType",option,arg1); 
     4584        return; 
     4585      } 
    45264586      switch (list) 
    45274587      { 
Note: See TracChangeset for help on using the changeset viewer.