Ejemplo n.º 1
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   D e s t r o y S e c r e t I n f o                                         %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  DestroySecretInfo() zeros memory associated with the SecretInfo structure.
%
%  The format of the DestroySecretInfo method is:
%
%      SecretInfo *DestroySecretInfo(SecretInfo *secret_info)
%
%  A description of each parameter follows:
%
%    o secret_info: The secret info.
%
*/
WizardExport SecretInfo *DestroySecretInfo(SecretInfo *secret_info)
{
  (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
  WizardAssert(AuthenticateDomain,secret_info != (SecretInfo *) NULL);
  WizardAssert(AuthenticateDomain,secret_info->signature == WizardSignature);
  if (secret_info->random_info != (RandomInfo *) NULL)
    secret_info->random_info=DestroyRandomInfo(secret_info->random_info);
  if (secret_info->hmac_info != (HMACInfo *) NULL)
    secret_info->hmac_info=DestroyHMACInfo(secret_info->hmac_info);
  if (secret_info->cipher_info != (CipherInfo *) NULL)
    secret_info->cipher_info=DestroyCipherInfo(secret_info->cipher_info);
  if (secret_info->keyring_info != (KeyringInfo *) NULL)
    secret_info->keyring_info=DestroyKeyringInfo(secret_info->keyring_info);
  if (secret_info->nonce != (StringInfo *) NULL)
    secret_info->nonce=DestroyStringInfo(secret_info->nonce);
  if (secret_info->key != (StringInfo *) NULL)
    secret_info->key=DestroyStringInfo(secret_info->key);
  if (secret_info->id != (StringInfo *) NULL)
    secret_info->id=DestroyStringInfo(secret_info->id);
  if (secret_info->digest != (StringInfo *) NULL)
    secret_info->digest=DestroyStringInfo(secret_info->digest);
  secret_info->signature=(~WizardSignature);
  secret_info=(SecretInfo *) RelinquishWizardMemory(secret_info);
  return(secret_info);
}
Ejemplo n.º 2
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
+   D e s t r o y M a g i c k R e s o u r c e s                               %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  DestroyMagickResources() destroys the resource environment.
%
%  The format of the DestroyMagickResources() method is:
%
%      DestroyMagickResources(void)
%
*/
MagickExport void DestroyMagickResources(void)
{
  AcquireSemaphoreInfo(&resource_semaphore);
  if (temporary_resources != (SplayTreeInfo *) NULL)
    temporary_resources=DestroySplayTree(temporary_resources);
  if (random_info != (RandomInfo *) NULL)
    random_info=DestroyRandomInfo(random_info);
  RelinquishSemaphoreInfo(resource_semaphore);
  resource_semaphore=DestroySemaphoreInfo(resource_semaphore);
}
Ejemplo n.º 3
0
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
+   R e s o u r c e C o m p o n e n t T e r m i n u s                         %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  ResourceComponentTerminus() destroys the resource component.
%
%  The format of the ResourceComponentTerminus() method is:
%
%      ResourceComponentTerminus(void)
%
*/
MagickPrivate void ResourceComponentTerminus(void)
{
  if (resource_semaphore == (SemaphoreInfo *) NULL)
    AcquireSemaphoreInfo(&resource_semaphore);
  LockSemaphoreInfo(resource_semaphore);
  if (temporary_resources != (SplayTreeInfo *) NULL)
    temporary_resources=DestroySplayTree(temporary_resources);
  if (random_info != (RandomInfo *) NULL)
    random_info=DestroyRandomInfo(random_info);
  UnlockSemaphoreInfo(resource_semaphore);
  DestroySemaphoreInfo(&resource_semaphore);
}
Ejemplo n.º 4
0
static Image *ReadPlasmaImage(const ImageInfo *image_info,
  ExceptionInfo *exception)
{
  Image
    *image;

  ImageInfo
    *read_info;

  ssize_t
    y;

  MagickBooleanType
    status;

  register ssize_t
    x;

  register PixelPacket
    *q;

  register size_t
    i;

  SegmentInfo
    segment_info;

  size_t
    depth,
    max_depth;

  /*
    Recursively apply plasma to the image.
  */
  read_info=CloneImageInfo(image_info);
  SetImageInfoBlob(read_info,(void *) NULL,0);
  (void) FormatMagickString(read_info->filename,MaxTextExtent,
    "gradient:%s",image_info->filename);
  image=ReadImage(read_info,exception);
  read_info=DestroyImageInfo(read_info);
  if (image == (Image *) NULL)
    return((Image *) NULL);
  image->storage_class=DirectClass;
  for (y=0; y < (ssize_t) image->rows; y++)
  {
    q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
    if (q == (PixelPacket *) NULL)
      break;
    for (x=0; x < (ssize_t) image->columns; x++)
    {
      q->opacity=(Quantum) (QuantumRange/2);
      q++;
    }
    if (SyncAuthenticPixels(image,exception) == MagickFalse)
      break;
  }
  segment_info.x1=0;
  segment_info.y1=0;
  segment_info.x2=(double) image->columns-1;
  segment_info.y2=(double) image->rows-1;
  if (LocaleCompare(image_info->filename,"fractal") == 0)
    {
      RandomInfo
        *random_info;

      /*
        Seed pixels before recursion.
      */
      random_info=AcquireRandomInfo();
      PlasmaPixel(image,random_info,segment_info.x1,segment_info.y1);
      PlasmaPixel(image,random_info,segment_info.x1,(segment_info.y1+
        segment_info.y2)/2);
      PlasmaPixel(image,random_info,segment_info.x1,segment_info.y2);
      PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,
        segment_info.y1);
      PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,
        (segment_info.y1+segment_info.y2)/2);
      PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,
        segment_info.y2);
      PlasmaPixel(image,random_info,segment_info.x2,segment_info.y1);
      PlasmaPixel(image,random_info,segment_info.x2,(segment_info.y1+
        segment_info.y2)/2);
      PlasmaPixel(image,random_info,segment_info.x2,segment_info.y2);
      random_info=DestroyRandomInfo(random_info);
    }
  i=(size_t) MagickMax(image->columns,image->rows)/2;
  for (max_depth=0; i != 0; max_depth++)
    i>>=1;
  for (depth=1; ; depth++)
  {
    if (PlasmaImage(image,&segment_info,0,depth) != MagickFalse)
      break;
    status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) depth,
      max_depth);
    if (status == MagickFalse)
      break;
  }
  (void) SetImageAlphaChannel(image,DeactivateAlphaChannel);
  return(GetFirstImageInList(image));
}