コード例 #1
0
ファイル: wandcli.c プロジェクト: Distrotech/ImageMagick
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
+   C L I T h r o w E x c e p t i o n                                         %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CLIThrowException() is a wrapper around ThrowMagickException(), adding to
% it the location of the option that caused the exception to occur.
*/
WandExport MagickBooleanType CLIThrowException(MagickCLI *cli_wand,
       const char *module,const char *function,const size_t line,
       const ExceptionType severity,const char *tag,const char *format,...)
{
  char
    new_format[MaxTextExtent];

  size_t
    len;

  MagickBooleanType
    status;

  va_list
    operands;

  /* HACK - append location to format string.
     The better way would be add more arguments to to the 'va' oparands
     list, but that does not appear to be possible! So we do some
     pre-formating of the location info here.
  */
  (void) CopyMagickString(new_format,format,MaxTextExtent);
  (void) ConcatenateMagickString(new_format," ",MaxTextExtent);

  len=strlen(new_format);
  (void) FormatLocaleString(new_format+len,MaxTextExtent-len,cli_wand->location,
       cli_wand->filename, cli_wand->line, cli_wand->column);

  va_start(operands,format);
  status=ThrowMagickExceptionList(cli_wand->wand.exception,
              module,function,line,
              severity,tag,new_format,operands);
  va_end(operands);
  return(status == MagickFalse ? 0 : 1);
}
コード例 #2
0
ファイル: exception.c プロジェクト: Distrotech/ImageMagick
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception,
  const char *module,const char *function,const size_t line,
  const ExceptionType severity,const char *tag,const char *format,...)
{
  MagickBooleanType
    status;

  va_list
    operands;

  va_start(operands,format);
  status=ThrowMagickExceptionList(exception,module,function,line,severity,tag,
    format,operands);
  va_end(operands);
  return(status);
}
コード例 #3
0
ファイル: wandcli.c プロジェクト: 0xPr0xy/ImageMagick
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
+   C L I T h r o w E x c e p t i o n                                         %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CLIThrowException() formats and records an exception condition, adding to
% it the location of the option that caused the exception to occur.
*/
WandExport MagickBooleanType CLIThrowException(MagickCLI *cli_wand,
       const char *module,const char *function,const size_t line,
       const ExceptionType severity,const char *tag,const char *format,...)
{
  char
    new_format[MaxTextExtent];

  size_t
    len;

  MagickBooleanType
    status;

  va_list
    operands;

  /* HACK - append location to format string.
     The better way would be append location formats and add more arguments to
     operands, but that does not appear to be posible!
     Note:  ThrowMagickExceptionList() was exported specifically for
     the use of this function.
  */
  (void) CopyMagickString(new_format,format,MaxTextExtent);
  (void) ConcatenateMagickString(new_format," ",MaxTextExtent);

  len=strlen(new_format);
  (void) FormatLocaleString(new_format+len,MaxTextExtent-len,cli_wand->location,
       cli_wand->filename, cli_wand->line, cli_wand->column);

  va_start(operands,format);
  status=ThrowMagickExceptionList(cli_wand->wand.exception,
              module,function,line,
              severity,tag,new_format,operands);
  va_end(operands);
  return(status);
}