static MagickBooleanType GetEXIFProperty(const Image *image,
  const char *property,ExceptionInfo *exception)
{
#define MaxDirectoryStack  16
#define EXIF_DELIMITER  "\n"
#define EXIF_NUM_FORMATS  12
#define EXIF_FMT_BYTE  1
#define EXIF_FMT_STRING  2
#define EXIF_FMT_USHORT  3
#define EXIF_FMT_ULONG  4
#define EXIF_FMT_URATIONAL  5
#define EXIF_FMT_SBYTE  6
#define EXIF_FMT_UNDEFINED  7
#define EXIF_FMT_SSHORT  8
#define EXIF_FMT_SLONG  9
#define EXIF_FMT_SRATIONAL  10
#define EXIF_FMT_SINGLE  11
#define EXIF_FMT_DOUBLE  12
#define TAG_EXIF_OFFSET  0x8769
#define TAG_GPS_OFFSET  0x8825
#define TAG_INTEROP_OFFSET  0xa005

#define EXIFMultipleValues(size,format,arg) \
{ \
   ssize_t \
     component; \
 \
   size_t \
     len; \
 \
   unsigned char \
     *p1; \
 \
   len=0; \
   p1=p; \
   for (component=0; component < components; component++) \
   { \
     len+=FormatLocaleString(buffer+len,MagickPathExtent-len,format", ",arg); \
     if (len >= (MagickPathExtent-1)) \
       len=MagickPathExtent-1; \
     p1+=size; \
   } \
   if (len > 1) \
     buffer[len-2]='\0'; \
   value=AcquireString(buffer); \
}

#define EXIFMultipleFractions(size,format,arg1,arg2) \
{ \
   ssize_t \
     component; \
 \
   size_t \
     len; \
 \
   unsigned char \
     *p1; \
 \
   len=0; \
   p1=p; \
   for (component=0; component < components; component++) \
   { \
     len+=FormatLocaleString(buffer+len,MagickPathExtent-len,format", ", \
       (arg1),(arg2)); \
     if (len >= (MagickPathExtent-1)) \
       len=MagickPathExtent-1; \
     p1+=size; \
   } \
   if (len > 1) \
     buffer[len-2]='\0'; \
   value=AcquireString(buffer); \
}

  typedef struct _DirectoryInfo
  {
    const unsigned char
      *directory;

    size_t
      entry;

    ssize_t
      offset;
  } DirectoryInfo;

  typedef struct _TagInfo
  {
    size_t
      tag;

    const char
      description[36];
  } TagInfo;

  static const TagInfo
    EXIFTag[] =
    {
      {  0x001, "exif:InteroperabilityIndex" },
      {  0x002, "exif:InteroperabilityVersion" },
      {  0x100, "exif:ImageWidth" },
      {  0x101, "exif:ImageLength" },
      {  0x102, "exif:BitsPerSample" },
      {  0x103, "exif:Compression" },
      {  0x106, "exif:PhotometricInterpretation" },
      {  0x10a, "exif:FillOrder" },
      {  0x10d, "exif:DocumentName" },
      {  0x10e, "exif:ImageDescription" },
      {  0x10f, "exif:Make" },
      {  0x110, "exif:Model" },
      {  0x111, "exif:StripOffsets" },
      {  0x112, "exif:Orientation" },
      {  0x115, "exif:SamplesPerPixel" },
      {  0x116, "exif:RowsPerStrip" },
      {  0x117, "exif:StripByteCounts" },
      {  0x11a, "exif:XResolution" },
      {  0x11b, "exif:YResolution" },
      {  0x11c, "exif:PlanarConfiguration" },
      {  0x11d, "exif:PageName" },
      {  0x11e, "exif:XPosition" },
      {  0x11f, "exif:YPosition" },
      {  0x118, "exif:MinSampleValue" },
      {  0x119, "exif:MaxSampleValue" },
      {  0x120, "exif:FreeOffsets" },
      {  0x121, "exif:FreeByteCounts" },
      {  0x122, "exif:GrayResponseUnit" },
      {  0x123, "exif:GrayResponseCurve" },
      {  0x124, "exif:T4Options" },
      {  0x125, "exif:T6Options" },
      {  0x128, "exif:ResolutionUnit" },
      {  0x12d, "exif:TransferFunction" },
      {  0x131, "exif:Software" },
      {  0x132, "exif:DateTime" },
      {  0x13b, "exif:Artist" },
      {  0x13e, "exif:WhitePoint" },
      {  0x13f, "exif:PrimaryChromaticities" },
      {  0x140, "exif:ColorMap" },
      {  0x141, "exif:HalfToneHints" },
      {  0x142, "exif:TileWidth" },
      {  0x143, "exif:TileLength" },
      {  0x144, "exif:TileOffsets" },
      {  0x145, "exif:TileByteCounts" },
      {  0x14a, "exif:SubIFD" },
      {  0x14c, "exif:InkSet" },
      {  0x14d, "exif:InkNames" },
      {  0x14e, "exif:NumberOfInks" },
      {  0x150, "exif:DotRange" },
      {  0x151, "exif:TargetPrinter" },
      {  0x152, "exif:ExtraSample" },
      {  0x153, "exif:SampleFormat" },
      {  0x154, "exif:SMinSampleValue" },
      {  0x155, "exif:SMaxSampleValue" },
      {  0x156, "exif:TransferRange" },
      {  0x157, "exif:ClipPath" },
      {  0x158, "exif:XClipPathUnits" },
      {  0x159, "exif:YClipPathUnits" },
      {  0x15a, "exif:Indexed" },
      {  0x15b, "exif:JPEGTables" },
      {  0x15f, "exif:OPIProxy" },
      {  0x200, "exif:JPEGProc" },
      {  0x201, "exif:JPEGInterchangeFormat" },
      {  0x202, "exif:JPEGInterchangeFormatLength" },
      {  0x203, "exif:JPEGRestartInterval" },
      {  0x205, "exif:JPEGLosslessPredictors" },
      {  0x206, "exif:JPEGPointTransforms" },
      {  0x207, "exif:JPEGQTables" },
      {  0x208, "exif:JPEGDCTables" },
      {  0x209, "exif:JPEGACTables" },
      {  0x211, "exif:YCbCrCoefficients" },
      {  0x212, "exif:YCbCrSubSampling" },
      {  0x213, "exif:YCbCrPositioning" },
      {  0x214, "exif:ReferenceBlackWhite" },
      {  0x2bc, "exif:ExtensibleMetadataPlatform" },
      {  0x301, "exif:Gamma" },
      {  0x302, "exif:ICCProfileDescriptor" },
      {  0x303, "exif:SRGBRenderingIntent" },
      {  0x320, "exif:ImageTitle" },
      {  0x5001, "exif:ResolutionXUnit" },
      {  0x5002, "exif:ResolutionYUnit" },
      {  0x5003, "exif:ResolutionXLengthUnit" },
      {  0x5004, "exif:ResolutionYLengthUnit" },
      {  0x5005, "exif:PrintFlags" },
      {  0x5006, "exif:PrintFlagsVersion" },
      {  0x5007, "exif:PrintFlagsCrop" },
      {  0x5008, "exif:PrintFlagsBleedWidth" },
      {  0x5009, "exif:PrintFlagsBleedWidthScale" },
      {  0x500A, "exif:HalftoneLPI" },
      {  0x500B, "exif:HalftoneLPIUnit" },
      {  0x500C, "exif:HalftoneDegree" },
      {  0x500D, "exif:HalftoneShape" },
      {  0x500E, "exif:HalftoneMisc" },
      {  0x500F, "exif:HalftoneScreen" },
      {  0x5010, "exif:JPEGQuality" },
      {  0x5011, "exif:GridSize" },
      {  0x5012, "exif:ThumbnailFormat" },
      {  0x5013, "exif:ThumbnailWidth" },
      {  0x5014, "exif:ThumbnailHeight" },
      {  0x5015, "exif:ThumbnailColorDepth" },
      {  0x5016, "exif:ThumbnailPlanes" },
      {  0x5017, "exif:ThumbnailRawBytes" },
      {  0x5018, "exif:ThumbnailSize" },
      {  0x5019, "exif:ThumbnailCompressedSize" },
      {  0x501a, "exif:ColorTransferFunction" },
      {  0x501b, "exif:ThumbnailData" },
      {  0x5020, "exif:ThumbnailImageWidth" },
      {  0x5021, "exif:ThumbnailImageHeight" },
      {  0x5022, "exif:ThumbnailBitsPerSample" },
      {  0x5023, "exif:ThumbnailCompression" },
      {  0x5024, "exif:ThumbnailPhotometricInterp" },
      {  0x5025, "exif:ThumbnailImageDescription" },
      {  0x5026, "exif:ThumbnailEquipMake" },
      {  0x5027, "exif:ThumbnailEquipModel" },
      {  0x5028, "exif:ThumbnailStripOffsets" },
      {  0x5029, "exif:ThumbnailOrientation" },
      {  0x502a, "exif:ThumbnailSamplesPerPixel" },
      {  0x502b, "exif:ThumbnailRowsPerStrip" },
      {  0x502c, "exif:ThumbnailStripBytesCount" },
      {  0x502d, "exif:ThumbnailResolutionX" },
      {  0x502e, "exif:ThumbnailResolutionY" },
      {  0x502f, "exif:ThumbnailPlanarConfig" },
      {  0x5030, "exif:ThumbnailResolutionUnit" },
      {  0x5031, "exif:ThumbnailTransferFunction" },
      {  0x5032, "exif:ThumbnailSoftwareUsed" },
      {  0x5033, "exif:ThumbnailDateTime" },
      {  0x5034, "exif:ThumbnailArtist" },
      {  0x5035, "exif:ThumbnailWhitePoint" },
      {  0x5036, "exif:ThumbnailPrimaryChromaticities" },
      {  0x5037, "exif:ThumbnailYCbCrCoefficients" },
      {  0x5038, "exif:ThumbnailYCbCrSubsampling" },
      {  0x5039, "exif:ThumbnailYCbCrPositioning" },
      {  0x503A, "exif:ThumbnailRefBlackWhite" },
      {  0x503B, "exif:ThumbnailCopyRight" },
      {  0x5090, "exif:LuminanceTable" },
      {  0x5091, "exif:ChrominanceTable" },
      {  0x5100, "exif:FrameDelay" },
      {  0x5101, "exif:LoopCount" },
      {  0x5110, "exif:PixelUnit" },
      {  0x5111, "exif:PixelPerUnitX" },
      {  0x5112, "exif:PixelPerUnitY" },
      {  0x5113, "exif:PaletteHistogram" },
      {  0x1000, "exif:RelatedImageFileFormat" },
      {  0x1001, "exif:RelatedImageLength" },
      {  0x1002, "exif:RelatedImageWidth" },
      {  0x800d, "exif:ImageID" },
      {  0x80e3, "exif:Matteing" },
      {  0x80e4, "exif:DataType" },
      {  0x80e5, "exif:ImageDepth" },
      {  0x80e6, "exif:TileDepth" },
      {  0x828d, "exif:CFARepeatPatternDim" },
      {  0x828e, "exif:CFAPattern2" },
      {  0x828f, "exif:BatteryLevel" },
      {  0x8298, "exif:Copyright" },
      {  0x829a, "exif:ExposureTime" },
      {  0x829d, "exif:FNumber" },
      {  0x83bb, "exif:IPTC/NAA" },
      {  0x84e3, "exif:IT8RasterPadding" },
      {  0x84e5, "exif:IT8ColorTable" },
      {  0x8649, "exif:ImageResourceInformation" },
      {  0x8769, "exif:ExifOffset" },  /* specs as "Exif IFD Pointer"? */
      {  0x8773, "exif:InterColorProfile" },
      {  0x8822, "exif:ExposureProgram" },
      {  0x8824, "exif:SpectralSensitivity" },
      {  0x8825, "exif:GPSInfo" }, /* specs as "GPSInfo IFD Pointer"? */
      {  0x8827, "exif:PhotographicSensitivity" },
      {  0x8828, "exif:OECF" },
      {  0x8829, "exif:Interlace" },
      {  0x882a, "exif:TimeZoneOffset" },
      {  0x882b, "exif:SelfTimerMode" },
      {  0x8830, "exif:SensitivityType" },
      {  0x8831, "exif:StandardOutputSensitivity" },
      {  0x8832, "exif:RecommendedExposureIndex" },
      {  0x8833, "exif:ISOSpeed" },
      {  0x8834, "exif:ISOSpeedLatitudeyyy" },
      {  0x8835, "exif:ISOSpeedLatitudezzz" },
      {  0x9000, "exif:ExifVersion" },
      {  0x9003, "exif:DateTimeOriginal" },
      {  0x9004, "exif:DateTimeDigitized" },
      {  0x9010, "exif:OffsetTime" },
      {  0x9011, "exif:OffsetTimeOriginal" },
      {  0x9012, "exif:OffsetTimeDigitized" },
      {  0x9101, "exif:ComponentsConfiguration" },
      {  0x9102, "exif:CompressedBitsPerPixel" },
      {  0x9201, "exif:ShutterSpeedValue" },
      {  0x9202, "exif:ApertureValue" },
      {  0x9203, "exif:BrightnessValue" },
      {  0x9204, "exif:ExposureBiasValue" },
      {  0x9205, "exif:MaxApertureValue" },
      {  0x9206, "exif:SubjectDistance" },
      {  0x9207, "exif:MeteringMode" },
      {  0x9208, "exif:LightSource" },
      {  0x9209, "exif:Flash" },
      {  0x920a, "exif:FocalLength" },
      {  0x920b, "exif:FlashEnergy" },
      {  0x920c, "exif:SpatialFrequencyResponse" },
      {  0x920d, "exif:Noise" },
      {  0x9214, "exif:SubjectArea" },
      {  0x9290, "exif:SubSecTime" },
      {  0x9291, "exif:SubSecTimeOriginal" },
      {  0x9292, "exif:SubSecTimeDigitized" },
      {  0x9211, "exif:ImageNumber" },
      {  0x9212, "exif:SecurityClassification" },
      {  0x9213, "exif:ImageHistory" },
      {  0x9214, "exif:SubjectArea" },
      {  0x9215, "exif:ExposureIndex" },
      {  0x9216, "exif:TIFF-EPStandardID" },
      {  0x927c, "exif:MakerNote" },
      {  0x9286, "exif:UserComment" },
      {  0x9290, "exif:SubSecTime" },
      {  0x9291, "exif:SubSecTimeOriginal" },
      {  0x9292, "exif:SubSecTimeDigitized" },
      {  0x9400, "exif:Temperature" },
      {  0x9401, "exif:Humidity" },
      {  0x9402, "exif:Pressure" },
      {  0x9403, "exif:WaterDepth" },
      {  0x9404, "exif:Acceleration" },
      {  0x9405, "exif:CameraElevationAngle" },
      {  0x9C9b, "exif:WinXP-Title" },
      {  0x9C9c, "exif:WinXP-Comments" },
      {  0x9C9d, "exif:WinXP-Author" },
      {  0x9C9e, "exif:WinXP-Keywords" },
      {  0x9C9f, "exif:WinXP-Subject" },
      {  0xa000, "exif:FlashPixVersion" },
      {  0xa001, "exif:ColorSpace" },
      {  0xa002, "exif:PixelXDimension" },
      {  0xa003, "exif:PixelYDimension" },
      {  0xa004, "exif:RelatedSoundFile" },
      {  0xa005, "exif:InteroperabilityOffset" },
      {  0xa20b, "exif:FlashEnergy" },
      {  0xa20c, "exif:SpatialFrequencyResponse" },
      {  0xa20d, "exif:Noise" },
      {  0xa20e, "exif:FocalPlaneXResolution" },
      {  0xa20f, "exif:FocalPlaneYResolution" },
      {  0xa210, "exif:FocalPlaneResolutionUnit" },
      {  0xa214, "exif:SubjectLocation" },
      {  0xa215, "exif:ExposureIndex" },
      {  0xa216, "exif:TIFF/EPStandardID" },
      {  0xa217, "exif:SensingMethod" },
      {  0xa300, "exif:FileSource" },
      {  0xa301, "exif:SceneType" },
      {  0xa302, "exif:CFAPattern" },
      {  0xa401, "exif:CustomRendered" },
      {  0xa402, "exif:ExposureMode" },
      {  0xa403, "exif:WhiteBalance" },
      {  0xa404, "exif:DigitalZoomRatio" },
      {  0xa405, "exif:FocalLengthIn35mmFilm" },
      {  0xa406, "exif:SceneCaptureType" },
      {  0xa407, "exif:GainControl" },
      {  0xa408, "exif:Contrast" },
      {  0xa409, "exif:Saturation" },
      {  0xa40a, "exif:Sharpness" },
      {  0xa40b, "exif:DeviceSettingDescription" },
      {  0xa40c, "exif:SubjectDistanceRange" },
      {  0xa420, "exif:ImageUniqueID" },
      {  0xa430, "exif:CameraOwnerName" },
      {  0xa431, "exif:BodySerialNumber" },
      {  0xa432, "exif:LensSpecification" },
      {  0xa433, "exif:LensMake" },
      {  0xa434, "exif:LensModel" },
      {  0xa435, "exif:LensSerialNumber" },
      {  0xc4a5, "exif:PrintImageMatching" },
      {  0xa500, "exif:Gamma" },
      {  0xc640, "exif:CR2Slice" },
      { 0x10000, "exif:GPSVersionID" },
      { 0x10001, "exif:GPSLatitudeRef" },
      { 0x10002, "exif:GPSLatitude" },
      { 0x10003, "exif:GPSLongitudeRef" },
      { 0x10004, "exif:GPSLongitude" },
      { 0x10005, "exif:GPSAltitudeRef" },
      { 0x10006, "exif:GPSAltitude" },
      { 0x10007, "exif:GPSTimeStamp" },
      { 0x10008, "exif:GPSSatellites" },
      { 0x10009, "exif:GPSStatus" },
      { 0x1000a, "exif:GPSMeasureMode" },
      { 0x1000b, "exif:GPSDop" },
      { 0x1000c, "exif:GPSSpeedRef" },
      { 0x1000d, "exif:GPSSpeed" },
      { 0x1000e, "exif:GPSTrackRef" },
      { 0x1000f, "exif:GPSTrack" },
      { 0x10010, "exif:GPSImgDirectionRef" },
      { 0x10011, "exif:GPSImgDirection" },
      { 0x10012, "exif:GPSMapDatum" },
      { 0x10013, "exif:GPSDestLatitudeRef" },
      { 0x10014, "exif:GPSDestLatitude" },
      { 0x10015, "exif:GPSDestLongitudeRef" },
      { 0x10016, "exif:GPSDestLongitude" },
      { 0x10017, "exif:GPSDestBearingRef" },
      { 0x10018, "exif:GPSDestBearing" },
      { 0x10019, "exif:GPSDestDistanceRef" },
      { 0x1001a, "exif:GPSDestDistance" },
      { 0x1001b, "exif:GPSProcessingMethod" },
      { 0x1001c, "exif:GPSAreaInformation" },
      { 0x1001d, "exif:GPSDateStamp" },
      { 0x1001e, "exif:GPSDifferential" },
      { 0x1001f, "exif:GPSHPositioningError" },
      { 0x00000, "" }
    };  /* http://www.cipa.jp/std/documents/e/DC-008-Translation-2016-E.pdf */

  const StringInfo
    *profile;

  const unsigned char
    *directory,
    *exif;

  DirectoryInfo
    directory_stack[MaxDirectoryStack];

  EndianType
    endian;

  MagickBooleanType
    status;

  ssize_t
    i;

  size_t
    entry,
    length,
    number_entries,
    tag,
    tag_value;

  SplayTreeInfo
    *exif_resources;

  ssize_t
    all,
    id,
    level,
    offset,
    tag_offset;

  static int
    tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};

  /*
    If EXIF data exists, then try to parse the request for a tag.
  */
  profile=GetImageProfile(image,"exif");
  if (profile == (const StringInfo *) NULL)
    return(MagickFalse);
  if ((property == (const char *) NULL) || (*property == '\0'))
    return(MagickFalse);
  while (isspace((int) ((unsigned char) *property)) != 0)
    property++;
  if (strlen(property) <= 5)
    return(MagickFalse);
  all=0;
  tag=(~0UL);
  switch (*(property+5))
  {
    case '*':
    {
      /*
        Caller has asked for all the tags in the EXIF data.
      */
      tag=0;
      all=1; /* return the data in description=value format */
      break;
    }
    case '!':
    {
      tag=0;
      all=2; /* return the data in tagid=value format */
      break;
    }
    case '#':
    case '@':
    {
      int
        c;

      size_t
        n;

      /*
        Check for a hex based tag specification first.
      */
      tag=(*(property+5) == '@') ? 1UL : 0UL;
      property+=6;
      n=strlen(property);
      if (n != 4)
        return(MagickFalse);
      /*
        Parse tag specification as a hex number.
      */
      n/=4;
      do
      {
        for (i=(ssize_t) n-1L; i >= 0; i--)
        {
          c=(*property++);
          tag<<=4;
          if ((c >= '0') && (c <= '9'))
            tag|=(c-'0');
          else
            if ((c >= 'A') && (c <= 'F'))
              tag|=(c-('A'-10));
            else
              if ((c >= 'a') && (c <= 'f'))
                tag|=(c-('a'-10));
              else
                return(MagickFalse);
        }
      } while (*property != '\0');
      break;
    }
    default:
    {
      /*
        Try to match the text with a tag name instead.
      */
      for (i=0; ; i++)
      {
        if (EXIFTag[i].tag == 0)
          break;
        if (LocaleCompare(EXIFTag[i].description,property) == 0)
          {
            tag=(size_t) EXIFTag[i].tag;
            break;
          }
      }
      break;
    }
  }
  if (tag == (~0UL))
    return(MagickFalse);
  length=GetStringInfoLength(profile);
  if (length < 6)
    return(MagickFalse);
  exif=GetStringInfoDatum(profile);
  while (length != 0)
  {
    if (ReadPropertyByte(&exif,&length) != 0x45)
      continue;
    if (ReadPropertyByte(&exif,&length) != 0x78)
      continue;
    if (ReadPropertyByte(&exif,&length) != 0x69)
      continue;
    if (ReadPropertyByte(&exif,&length) != 0x66)
      continue;
    if (ReadPropertyByte(&exif,&length) != 0x00)
      continue;
    if (ReadPropertyByte(&exif,&length) != 0x00)
      continue;
    break;
  }
  if (length < 16)
    return(MagickFalse);
  id=(ssize_t) ReadPropertySignedShort(LSBEndian,exif);
  endian=LSBEndian;
  if (id == 0x4949)
    endian=LSBEndian;
  else
    if (id == 0x4D4D)
      endian=MSBEndian;
    else
      return(MagickFalse);
  if (ReadPropertyUnsignedShort(endian,exif+2) != 0x002a)
    return(MagickFalse);
  /*
    This the offset to the first IFD.
  */
  offset=(ssize_t) ReadPropertySignedLong(endian,exif+4);
  if ((offset < 0) || (size_t) offset >= length)
    return(MagickFalse);
  /*
    Set the pointer to the first IFD and follow it were it leads.
  */
  status=MagickFalse;
  directory=exif+offset;
  level=0;
  entry=0;
  tag_offset=0;
  exif_resources=NewSplayTree((int (*)(const void *,const void *)) NULL,
    (void *(*)(void *)) NULL,(void *(*)(void *)) NULL);
  do
  {
    /*
      If there is anything on the stack then pop it off.
    */
    if (level > 0)
      {
        level--;
        directory=directory_stack[level].directory;
        entry=directory_stack[level].entry;
        tag_offset=directory_stack[level].offset;
      }
    if ((directory < exif) || (directory > (exif+length-2)))
      break;
    /*
      Determine how many entries there are in the current IFD.
    */
    number_entries=(size_t) ReadPropertyUnsignedShort(endian,directory);
    for ( ; entry < number_entries; entry++)
    {
      unsigned char
        *p,
        *q;

      size_t
        format;

      ssize_t
        components,
        number_bytes;

      q=(unsigned char *) (directory+(12*entry)+2);
      if (q > (exif+length-12))
        break;  /* corrupt EXIF */
      if (GetValueFromSplayTree(exif_resources,q) == q)
        break;
      (void) AddValueToSplayTree(exif_resources,q,q);
      tag_value=(size_t) ReadPropertyUnsignedShort(endian,q)+tag_offset;
      format=(size_t) ReadPropertyUnsignedShort(endian,q+2);
      if (format >= (sizeof(tag_bytes)/sizeof(*tag_bytes)))
        break;
      if (format == 0)
        break;  /* corrupt EXIF */
      components=(ssize_t) ReadPropertySignedLong(endian,q+4);
      if (components < 0)
        break;  /* corrupt EXIF */
      number_bytes=(size_t) components*tag_bytes[format];
      if (number_bytes < components)
        break;  /* prevent overflow */
      if (number_bytes <= 4)
        p=q+8;
      else
        {
          ssize_t
            dir_offset;

          /*
            The directory entry contains an offset.
          */
          dir_offset=(ssize_t) ReadPropertySignedLong(endian,q+8);
          if ((dir_offset < 0) || (size_t) dir_offset >= length)
            continue;
          if (((size_t) dir_offset+number_bytes) < (size_t) dir_offset)
            continue;  /* prevent overflow */
          if (((size_t) dir_offset+number_bytes) > length)
            continue;
          p=(unsigned char *) (exif+dir_offset);
        }
      if ((all != 0) || (tag == (size_t) tag_value))
        {
          char
            buffer[MagickPathExtent],
            *value;

          if ((p < exif) || (p > (exif+length-tag_bytes[format])))
            break;
          value=(char *) NULL;
          *buffer='\0';
          switch (format)
          {
            case EXIF_FMT_BYTE:
            case EXIF_FMT_UNDEFINED:
            {
              value=(char *) NULL;
              if (~((size_t) number_bytes) >= 1)
                value=(char *) AcquireQuantumMemory((size_t) number_bytes+1UL,
                  sizeof(*value));
              if (value != (char *) NULL)
                {
                  for (i=0; i < (ssize_t) number_bytes; i++)
                  {
                    value[i]='.';
                    if (isprint((int) p[i]) != 0)
                      value[i]=(char) p[i];
                  }
                  value[i]='\0';
                }
              break;
            }
            case EXIF_FMT_SBYTE:
            {
              EXIFMultipleValues(1,"%.20g",(double) (*(signed char *) p1));
              break;
            }
            case EXIF_FMT_SSHORT:
            {
              EXIFMultipleValues(2,"%hd",ReadPropertySignedShort(endian,p1));
              break;
            }
            case EXIF_FMT_USHORT:
            {
              EXIFMultipleValues(2,"%hu",ReadPropertyUnsignedShort(endian,p1));
              break;
            }
            case EXIF_FMT_ULONG:
            {
              EXIFMultipleValues(4,"%.20g",(double)
                ReadPropertyUnsignedLong(endian,p1));
              break;
            }
            case EXIF_FMT_SLONG:
            {
              EXIFMultipleValues(4,"%.20g",(double)
                ReadPropertySignedLong(endian,p1));
              break;
            }
            case EXIF_FMT_URATIONAL:
            {
              EXIFMultipleFractions(8,"%.20g/%.20g",(double)
                ReadPropertyUnsignedLong(endian,p1),(double)
                ReadPropertyUnsignedLong(endian,p1+4));
              break;
            }
            case EXIF_FMT_SRATIONAL:
            {
              EXIFMultipleFractions(8,"%.20g/%.20g",(double)
                ReadPropertySignedLong(endian,p1),(double)
                ReadPropertySignedLong(endian,p1+4));
              break;
            }
            case EXIF_FMT_SINGLE:
            {
              EXIFMultipleValues(4,"%f",(double) *(float *) p1);
              break;
            }
            case EXIF_FMT_DOUBLE:
            {
              EXIFMultipleValues(8,"%f",*(double *) p1);
              break;
            }
            case EXIF_FMT_STRING:
            default:
            {
              if ((p < exif) || (p > (exif+length-number_bytes)))
                break;
              value=(char *) NULL;
              if (~((size_t) number_bytes) >= 1)
                value=(char *) AcquireQuantumMemory((size_t) number_bytes+1UL,
                  sizeof(*value));
              if (value != (char *) NULL)
                {
                  for (i=0; i < (ssize_t) number_bytes; i++)
                  {
                    value[i]='.';
                    if ((isprint((int) p[i]) != 0) || (p[i] == '\0'))
                      value[i]=(char) p[i];
                  }
                  value[i]='\0';
                }
              break;
            }
          }
          if (value != (char *) NULL)
            {
              char
                *key;

              key=AcquireString(property);
              switch (all)
              {
                case 1:
                {
                  const char
                    *description;

                  description="unknown";
                  for (i=0; ; i++)
                  {
                    if (EXIFTag[i].tag == 0)
                      break;
                    if (EXIFTag[i].tag == tag_value)
                      {
                        description=EXIFTag[i].description;
                        break;
                      }
                  }
                  (void) FormatLocaleString(key,MagickPathExtent,"%s",
                    description);
                  if (level == 2)
                    (void) SubstituteString(&key,"exif:","exif:thumbnail:");
                  break;
                }
                case 2:
                {
                  if (tag_value < 0x10000)
                    (void) FormatLocaleString(key,MagickPathExtent,"#%04lx",
                      (unsigned long) tag_value);
                  else
                    if (tag_value < 0x20000)
                      (void) FormatLocaleString(key,MagickPathExtent,"@%04lx",
                        (unsigned long) (tag_value & 0xffff));
                    else
                      (void) FormatLocaleString(key,MagickPathExtent,"unknown");
                  break;
                }
                default:
                {
                  if (level == 2)
                    (void) SubstituteString(&key,"exif:","exif:thumbnail:");
                }
              }
              if ((image->properties == (void *) NULL) ||
                  (GetValueFromSplayTree((SplayTreeInfo *) image->properties,
                    key) == (const void *) NULL))
                (void) SetImageProperty((Image *) image,key,value,exception);
              value=DestroyString(value);
              key=DestroyString(key);
              status=MagickTrue;
            }
        }
        if ((tag_value == TAG_EXIF_OFFSET) ||
            (tag_value == TAG_INTEROP_OFFSET) || (tag_value == TAG_GPS_OFFSET))
          {
            ssize_t
              tag_offset1;

            tag_offset1=(ssize_t) ReadPropertySignedLong(endian,p);
            if (((size_t) tag_offset1 < length) &&
                (level < (MaxDirectoryStack-2)))
              {
                ssize_t
                  tag_offset2;

                tag_offset2=(ssize_t) ((tag_value == TAG_GPS_OFFSET) ? 0x10000 :
                  0);
                directory_stack[level].directory=directory;
                entry++;
                directory_stack[level].entry=entry;
                directory_stack[level].offset=tag_offset;
                level++;
                /*
                  Check for duplicate tag.
                */
                for (i=0; i < level; i++)
                  if (directory_stack[i].directory == (exif+tag_offset1))
                    break;
                if (i < level)
                  break;  /* duplicate tag */
                directory_stack[level].directory=exif+tag_offset1;
                directory_stack[level].offset=tag_offset2;
                directory_stack[level].entry=0;
                level++;
                if ((directory+2+(12*number_entries)+4) > (exif+length))
                  break;
                tag_offset1=(ssize_t) ReadPropertySignedLong(endian,directory+
                  2+(12*number_entries));
                if ((tag_offset1 != 0) && ((size_t) tag_offset1 < length) &&
                    (level < (MaxDirectoryStack-2)))
                  {
                    directory_stack[level].directory=exif+tag_offset1;
                    directory_stack[level].entry=0;
                    directory_stack[level].offset=tag_offset2;
                    level++;
                  }
              }
            break;
          }
    }
  } while (level > 0);
  exif_resources=DestroySplayTree(exif_resources);
  return(status);
}


static void cuda_receive_packet(CUDAState *s, const uint8_t *data, int len) { uint8_t obuf[16]; int ti, autopoll; switch(data[0]) { case CUDA_AUTOPOLL: autopoll = (data[1] != 0); if (autopoll != s->autopoll) { s->autopoll = autopoll; if (autopoll) { qemu_mod_timer(s->adb_poll_timer, qemu_get_clock(vm_clock) + (ticks_per_sec / CUDA_ADB_POLL_FREQ)); } else { qemu_del_timer(s->adb_poll_timer); } } obuf[0] = CUDA_PACKET; obuf[1] = data[1]; cuda_send_packet_to_host(s, obuf, 2); break; case CUDA_GET_TIME: case CUDA_SET_TIME: /* XXX: add time support ? */ ti = time(NULL) + RTC_OFFSET; obuf[0] = CUDA_PACKET; obuf[1] = 0; obuf[2] = 0; obuf[3] = ti >> 24; obuf[4] = ti >> 16; obuf[5] = ti >> 8; obuf[6] = ti; cuda_send_packet_to_host(s, obuf, 7); break; case CUDA_FILE_SERVER_FLAG: case CUDA_SET_DEVICE_LIST: case CUDA_SET_AUTO_RATE: case CUDA_SET_POWER_MESSAGES: obuf[0] = CUDA_PACKET; obuf[1] = 0; cuda_send_packet_to_host(s, obuf, 2); break; case CUDA_POWERDOWN: obuf[0] = CUDA_PACKET; obuf[1] = 0; cuda_send_packet_to_host(s, obuf, 2); qemu_system_shutdown_request(); break; case CUDA_RESET_SYSTEM: obuf[0] = CUDA_PACKET; obuf[1] = 0; cuda_send_packet_to_host(s, obuf, 2); qemu_system_reset_request(); break; default: break; } }


static void sig_complete_connect ( GList * * list , WINDOW_REC * window , const char * word , const char * line , int * want_space ) {
 g_return_if_fail ( list != NULL ) ;
 g_return_if_fail ( word != NULL ) ;
 * list = completion_get_chatnets ( word ) ;
 * list = g_list_concat ( * list , completion_get_servers ( word ) ) ;
 if ( * list != NULL ) signal_stop ( ) ;
 }


static int xen_pt_status_reg_init(XenPCIPassthroughState *s, XenPTRegInfo *reg, uint32_t real_offset, uint32_t *data) { XenPTRegGroup *reg_grp_entry = NULL; XenPTReg *reg_entry = NULL; uint32_t reg_field = 0; /* find Header register group */ reg_grp_entry = xen_pt_find_reg_grp(s, PCI_CAPABILITY_LIST); if (reg_grp_entry) { /* find Capabilities Pointer register */ reg_entry = xen_pt_find_reg(reg_grp_entry, PCI_CAPABILITY_LIST); if (reg_entry) { /* check Capabilities Pointer register */ if (reg_entry->data) { reg_field |= PCI_STATUS_CAP_LIST; } else { reg_field &= ~PCI_STATUS_CAP_LIST; } } else { xen_shutdown_fatal_error("Internal error: Couldn't find XenPTReg*" " for Capabilities Pointer register." " (%s)\n", __func__); return -1; } } else { xen_shutdown_fatal_error("Internal error: Couldn't find XenPTRegGroup" " for Header. (%s)\n", __func__); return -1; } *data = reg_field; return 0; }


void usage_exit ( ) {
 int i ;
 fprintf ( stderr , "Usage: %s <options> -o dst_filename src_filename \n" , exec_name ) ;
 fprintf ( stderr , "\nOptions:\n" ) ;
 arg_show_usage ( stderr , main_args ) ;
 fprintf ( stderr , "\nEncoder Global Options:\n" ) ;
 arg_show_usage ( stderr , global_args ) ;
 fprintf ( stderr , "\nRate Control Options:\n" ) ;
 arg_show_usage ( stderr , rc_args ) ;
 fprintf ( stderr , "\nTwopass Rate Control Options:\n" ) ;
 arg_show_usage ( stderr , rc_twopass_args ) ;
 fprintf ( stderr , "\nKeyframe Placement Options:\n" ) ;
 arg_show_usage ( stderr , kf_args ) ;
 # if CONFIG_VP8_ENCODER fprintf ( stderr , "\nVP8 Specific Options:\n" ) ;
 arg_show_usage ( stderr , vp8_args ) ;
 # endif # if CONFIG_VP9_ENCODER fprintf ( stderr , "\nVP9 Specific Options:\n" ) ;
 arg_show_usage ( stderr , vp9_args ) ;
 # endif fprintf ( stderr , "\nStream timebase (--timebase):\n" " The desired precision of timestamps in the output, expressed\n" " in fractional seconds. Default is 1/1000.\n" ) ;
 fprintf ( stderr , "\nIncluded encoders:\n\n" ) ;
 for ( i = 0 ;
 i < get_vpx_encoder_count ( ) ;
 ++ i ) {
 const VpxInterface * const encoder = get_vpx_encoder_by_index ( i ) ;
 fprintf ( stderr , " %-6s - %s\n" , encoder -> name , vpx_codec_iface_name ( encoder -> codec_interface ( ) ) ) ;
 }
 exit ( EXIT_FAILURE ) ;
 }


static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { NFSClient *client = bs->opaque; int64_t ret; QemuOpts *opts; Error *local_err = NULL; opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (error_is_set(&local_err)) { error_propagate(errp, local_err); return -EINVAL; } ret = nfs_client_open(client, qemu_opt_get(opts, "filename"), (flags & BDRV_O_RDWR) ? O_RDWR : O_RDONLY, errp); if (ret < 0) { return ret; } bs->total_sectors = ret; return 0; }


static void help ( ) {
 extern char * __progname ;
 fprintf ( stderr , "iodine IP over DNS tunneling server\n" ) ;
 fprintf ( stderr , "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-u user] " "[-t chrootdir] [-d device] [-m mtu] [-z context] " "[-l ip address to listen on] [-p port] [-n external ip] [-b dnsport] [-P password] " "[-F pidfile] tunnel_ip[etmask] topdomain\n" , __progname ) ;
 fprintf ( stderr , " -v to print version info and exit\n" ) ;
 fprintf ( stderr , " -h to print this help and exit\n" ) ;
 fprintf ( stderr , " -c to disable check of client IP/port on each request\n" ) ;
 fprintf ( stderr , " -s to skip creating and configuring the tun device, " "which then has to be created manually\n" ) ;
 fprintf ( stderr , " -f to keep running in foreground\n" ) ;
 fprintf ( stderr , " -D to increase debug level\n" ) ;
 fprintf ( stderr , " (using -DD in UTF-8 terminal: \"LC_ALL=C luit iodined -DD ...\")\n" ) ;
 fprintf ( stderr , " -u name to drop privileges and run as user 'name'\n" ) ;
 fprintf ( stderr , " -t dir to chroot to directory dir\n" ) ;
 fprintf ( stderr , " -d device to set tunnel device name\n" ) ;
 fprintf ( stderr , " -m mtu to set tunnel device mtu\n" ) ;
 fprintf ( stderr , " -z context to apply SELinux context after initialization\n" ) ;
 fprintf ( stderr , " -l ip address to listen on for incoming dns traffic " "(default 0.0.0.0)\n" ) ;
 fprintf ( stderr , " -p port to listen on for incoming dns traffic (default 53)\n" ) ;
 fprintf ( stderr , " -n ip to respond with to NS queries\n" ) ;
 fprintf ( stderr , " -b port to forward normal DNS queries to (on localhost)\n" ) ;
 fprintf ( stderr , " -P password used for authentication (max 32 chars will be used)\n" ) ;
 fprintf ( stderr , " -F pidfile to write pid to a file\n" ) ;
 fprintf ( stderr , " -i maximum idle time before shutting down\n" ) ;
 fprintf ( stderr , "tunnel_ip is the IP number of the local tunnel interface.\n" ) ;
 fprintf ( stderr , " etmask sets the size of the tunnel network.\n" ) ;
 fprintf ( stderr , "topdomain is the FQDN that is delegated to this server.\n" ) ;
 exit ( 0 ) ;
 }


	switch (yych) {
		case 'a': goto yy44;
		default: goto yy41;
	}


static void insert_mark ( uintmax_t idnum , struct object_entry * oe ) {
 struct mark_set * s = marks ;
 while ( ( idnum >> s -> shift ) >= 1024 ) {
 s = pool_calloc ( 1 , sizeof ( struct mark_set ) ) ;
 s -> shift = marks -> shift + 10 ;
 s -> data . sets [ 0 ] = marks ;
 marks = s ;
 }
 while ( s -> shift ) {
 uintmax_t i = idnum >> s -> shift ;
 idnum -= i << s -> shift ;
 if ( ! s -> data . sets [ i ] ) {
 s -> data . sets [ i ] = pool_calloc ( 1 , sizeof ( struct mark_set ) ) ;
 s -> data . sets [ i ] -> shift = s -> shift - 10 ;
 }
 s = s -> data . sets [ i ] ;
 }
 if ( ! s -> data . marked [ idnum ] ) marks_set_count ++ ;
 s -> data . marked [ idnum ] = oe ;
 }


static void free_mi ( VP9_COMMON * cm ) {
 int i ;
 for ( i = 0 ;
 i < 2 ;
 ++ i ) {
 vpx_free ( cm -> mip_array [ i ] ) ;
 cm -> mip_array [ i ] = NULL ;
 }
 cm -> mip = NULL ;
 cm -> prev_mip = NULL ;
 }


static void pcnet_transmit ( PCNetState * s ) {
 hwaddr xmit_cxda = 0 ;
 int count = CSR_XMTRL ( s ) - 1 ;
 int add_crc = 0 ;
 int bcnt ;
 s -> xmit_pos = - 1 ;
 if ( ! CSR_TXON ( s ) ) {
 s -> csr [ 0 ] &= ~ 0x0008 ;
 return ;
 }
 s -> tx_busy = 1 ;
 txagain : if ( pcnet_tdte_poll ( s ) ) {
 struct pcnet_TMD tmd ;
 TMDLOAD ( & tmd , PHYSADDR ( s , CSR_CXDA ( s ) ) ) ;
 # ifdef PCNET_DEBUG_TMD printf ( " TMDLOAD 0x%08x\n" , PHYSADDR ( s , CSR_CXDA ( s ) ) ) ;
 PRINT_TMD ( & tmd ) ;
 # endif if ( GET_FIELD ( tmd . status , TMDS , STP ) ) {
 s -> xmit_pos = 0 ;
 xmit_cxda = PHYSADDR ( s , CSR_CXDA ( s ) ) ;
 if ( BCR_SWSTYLE ( s ) != 1 ) add_crc = GET_FIELD ( tmd . status , TMDS , ADDFCS ) ;
 }
 if ( s -> lnkst == 0 && ( ! CSR_LOOP ( s ) || ( ! CSR_INTL ( s ) && ! BCR_TMAULOOP ( s ) ) ) ) {
 SET_FIELD ( & tmd . misc , TMDM , LCAR , 1 ) ;
 SET_FIELD ( & tmd . status , TMDS , ERR , 1 ) ;
 SET_FIELD ( & tmd . status , TMDS , OWN , 0 ) ;
 s -> csr [ 0 ] |= 0xa000 ;
 s -> xmit_pos = - 1 ;
 goto txdone ;
 }
 if ( s -> xmit_pos < 0 ) {
 goto txdone ;
 }
 bcnt = 4096 - GET_FIELD ( tmd . length , TMDL , BCNT ) ;
 if ( s -> xmit_pos + bcnt > sizeof ( s -> buffer ) - 4 ) {
 s -> xmit_pos = - 1 ;
 goto txdone ;
 }
 s -> phys_mem_read ( s -> dma_opaque , PHYSADDR ( s , tmd . tbadr ) , s -> buffer + s -> xmit_pos , bcnt , CSR_BSWP ( s ) ) ;
 s -> xmit_pos += bcnt ;
 if ( ! GET_FIELD ( tmd . status , TMDS , ENP ) ) {
 goto txdone ;
 }
 # ifdef PCNET_DEBUG printf ( "pcnet_transmit size=%d\n" , s -> xmit_pos ) ;
 # endif if ( CSR_LOOP ( s ) ) {
 if ( BCR_SWSTYLE ( s ) == 1 ) add_crc = ! GET_FIELD ( tmd . status , TMDS , NOFCS ) ;
 s -> looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC ;
 pcnet_receive ( qemu_get_queue ( s -> nic ) , s -> buffer , s -> xmit_pos ) ;
 s -> looptest = 0 ;
 }
 else {
 if ( s -> nic ) {
 qemu_send_packet ( qemu_get_queue ( s -> nic ) , s -> buffer , s -> xmit_pos ) ;
 }
 }
 s -> csr [ 0 ] &= ~ 0x0008 ;
 s -> csr [ 4 ] |= 0x0004 ;
 s -> xmit_pos = - 1 ;
 txdone : SET_FIELD ( & tmd . status , TMDS , OWN , 0 ) ;
 TMDSTORE ( & tmd , PHYSADDR ( s , CSR_CXDA ( s ) ) ) ;
 if ( ! CSR_TOKINTD ( s ) || ( CSR_LTINTEN ( s ) && GET_FIELD ( tmd . status , TMDS , LTINT ) ) ) {
 s -> csr [ 0 ] |= 0x0200 ;
 }
 if ( CSR_XMTRC ( s ) <= 1 ) {
 CSR_XMTRC ( s ) = CSR_XMTRL ( s ) ;
 }
 else {
 CSR_XMTRC ( s ) -- ;
 }
 if ( count -- ) {
 goto txagain ;
 }
 }
 else if ( s -> xmit_pos >= 0 ) {
 struct pcnet_TMD tmd ;
 TMDLOAD ( & tmd , xmit_cxda ) ;
 SET_FIELD ( & tmd . misc , TMDM , BUFF , 1 ) ;
 SET_FIELD ( & tmd . misc , TMDM , UFLO , 1 ) ;
 SET_FIELD ( & tmd . status , TMDS , ERR , 1 ) ;
 SET_FIELD ( & tmd . status , TMDS , OWN , 0 ) ;
 TMDSTORE ( & tmd , xmit_cxda ) ;
 s -> csr [ 0 ] |= 0x0200 ;
 if ( ! CSR_DXSUFLO ( s ) ) {
 s -> csr [ 0 ] &= ~ 0x0010 ;
 }
 else if ( count -- ) {
 goto txagain ;
 }
 }
 s -> tx_busy = 0 ;
 }


static void gen_spr_620 (CPUPPCState *env) { /* XXX : not implemented */ spr_register(env, SPR_620_PMR0, "PMR0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR1, "PMR1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR2, "PMR2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR3, "PMR3", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR4, "PMR4", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR5, "PMR5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR6, "PMR6", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR7, "PMR7", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR8, "PMR8", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMR9, "PMR9", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMRA, "PMR10", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMRB, "PMR11", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMRC, "PMR12", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMRD, "PMR13", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMRE, "PMR14", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_PMRF, "PMR15", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_HID8, "HID8", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_620_HID9, "HID9", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); }


void xps_begin_opacity ( xps_document * doc , const fz_matrix * ctm , const fz_rect * area , char * base_uri , xps_resource * dict , char * opacity_att , fz_xml * opacity_mask_tag ) {
 float opacity ;
 if ( ! opacity_att && ! opacity_mask_tag ) return ;
 opacity = 1 ;
 if ( opacity_att ) opacity = fz_atof ( opacity_att ) ;
 if ( opacity_mask_tag && ! strcmp ( fz_xml_tag ( opacity_mask_tag ) , "SolidColorBrush" ) ) {
 char * scb_opacity_att = fz_xml_att ( opacity_mask_tag , "Opacity" ) ;
 char * scb_color_att = fz_xml_att ( opacity_mask_tag , "Color" ) ;
 if ( scb_opacity_att ) opacity = opacity * fz_atof ( scb_opacity_att ) ;
 if ( scb_color_att ) {
 fz_colorspace * colorspace ;
 float samples [ 32 ] ;
 xps_parse_color ( doc , base_uri , scb_color_att , & colorspace , samples ) ;
 opacity = opacity * samples [ 0 ] ;
 }
 opacity_mask_tag = NULL ;
 }
 if ( doc -> opacity_top + 1 < nelem ( doc -> opacity ) ) {
 doc -> opacity [ doc -> opacity_top + 1 ] = doc -> opacity [ doc -> opacity_top ] * opacity ;
 doc -> opacity_top ++ ;
 }
 if ( opacity_mask_tag ) {
 fz_begin_mask ( doc -> dev , area , 0 , NULL , NULL ) ;
 xps_parse_brush ( doc , ctm , area , base_uri , dict , opacity_mask_tag ) ;
 fz_end_mask ( doc -> dev ) ;
 }
 }


static int qemuMonitorTextCommandNotFound ( const char * cmd , const char * reply ) {
 if ( STRPREFIX ( cmd , "info " ) ) {
 if ( strstr ( reply , "info version" ) ) return 1 ;
 }
 else {
 if ( strstr ( reply , "unknown command:" ) ) return 1 ;
 }
 return 0 ;
 }


AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) { AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); if(avctx==NULL) return NULL; if(avcodec_get_context_defaults3(avctx, codec) < 0){ av_free(avctx); return NULL; } return avctx; }


static inline int base_key_length ( const cipher_type_t * cipher , int key_length ) {
 switch ( cipher -> id ) {
 case AES_128_ICM : case AES_192_ICM : case AES_256_ICM : return key_length - 14 ;
 break ;
 case AES_128_GCM : return 16 ;
 break ;
 case AES_256_GCM : return 32 ;
 break ;
 default : return key_length ;
 break ;
 }
 }


void vp9_clear_segdata ( struct segmentation * seg , int segment_id , SEG_LVL_FEATURES feature_id ) {
 seg -> feature_data [ segment_id ] [ feature_id ] = 0 ;
 }


static int equal_dimensions ( const YV12_BUFFER_CONFIG * a , const YV12_BUFFER_CONFIG * b ) {
 return a -> y_height == b -> y_height && a -> y_width == b -> y_width && a -> uv_height == b -> uv_height && a -> uv_width == b -> uv_width ;
 }


static void qemu_kvm_init_cpu_signals(CPUState *env) { int r; sigset_t set; struct sigaction sigact; memset(&sigact, 0, sizeof(sigact)); sigact.sa_handler = dummy_signal; sigaction(SIG_IPI, &sigact, NULL); #ifdef CONFIG_IOTHREAD pthread_sigmask(SIG_BLOCK, NULL, &set); sigdelset(&set, SIG_IPI); sigdelset(&set, SIGBUS); r = kvm_set_signal_mask(env, &set); if (r) { fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); exit(1); } #else sigemptyset(&set); sigaddset(&set, SIG_IPI); sigaddset(&set, SIGIO); sigaddset(&set, SIGALRM); pthread_sigmask(SIG_BLOCK, &set, NULL); pthread_sigmask(SIG_BLOCK, NULL, &set); sigdelset(&set, SIGIO); sigdelset(&set, SIGALRM); #endif sigdelset(&set, SIG_IPI); sigdelset(&set, SIGBUS); r = kvm_set_signal_mask(env, &set); if (r) { fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); exit(1); } }


static int usb_serial_initfn(USBDevice *dev) { USBSerialState *s = DO_UPCAST(USBSerialState, dev, dev); s->dev.speed = USB_SPEED_FULL; qemu_chr_add_handlers(s->cs, usb_serial_can_read, usb_serial_read, usb_serial_event, s); usb_serial_handle_reset(dev); return 0;


CollationCreate(const char *collname, Oid collnamespace,
				Oid collowner,
				char collprovider,
				int32 collencoding,
				const char *collcollate, const char *collctype,
				const char *collversion,
				bool if_not_exists,
				bool quiet)
{
	Relation	rel;
	TupleDesc	tupDesc;
	HeapTuple	tup;
	Datum		values[Natts_pg_collation];
	bool		nulls[Natts_pg_collation];
	NameData	name_name,
				name_collate,
				name_ctype;
	Oid			oid;
	ObjectAddress myself,
				referenced;

	AssertArg(collname);
	AssertArg(collnamespace);
	AssertArg(collowner);
	AssertArg(collcollate);
	AssertArg(collctype);

	/*
	 * Make sure there is no existing collation of same name & encoding.
	 *
	 * This would be caught by the unique index anyway; we're just giving a
	 * friendlier error message.  The unique index provides a backstop against
	 * race conditions.
	 */
	if (SearchSysCacheExists3(COLLNAMEENCNSP,
							  PointerGetDatum(collname),
							  Int32GetDatum(collencoding),
							  ObjectIdGetDatum(collnamespace)))
	{
		if (quiet)
			return InvalidOid;
		else if (if_not_exists)
		{
			ereport(NOTICE,
					(errcode(ERRCODE_DUPLICATE_OBJECT),
					 collencoding == -1
					 ? errmsg("collation \"%s\" already exists, skipping",
							  collname)
					 : errmsg("collation \"%s\" for encoding \"%s\" already exists, skipping",
							  collname, pg_encoding_to_char(collencoding))));
			return InvalidOid;
		}
		else
			ereport(ERROR,
					(errcode(ERRCODE_DUPLICATE_OBJECT),
					 collencoding == -1
					 ? errmsg("collation \"%s\" already exists",
							  collname)
					 : errmsg("collation \"%s\" for encoding \"%s\" already exists",
							  collname, pg_encoding_to_char(collencoding))));
	}

	/* open pg_collation; see below about the lock level */
	rel = heap_open(CollationRelationId, ShareRowExclusiveLock);

	/*
	 * Also forbid a specific-encoding collation shadowing an any-encoding
	 * collation, or an any-encoding collation being shadowed (see
	 * get_collation_name()).  This test is not backed up by the unique index,
	 * so we take a ShareRowExclusiveLock earlier, to protect against
	 * concurrent changes fooling this check.
	 */
	if ((collencoding == -1 &&
		 SearchSysCacheExists3(COLLNAMEENCNSP,
							   PointerGetDatum(collname),
							   Int32GetDatum(GetDatabaseEncoding()),
							   ObjectIdGetDatum(collnamespace))) ||
		(collencoding != -1 &&
		 SearchSysCacheExists3(COLLNAMEENCNSP,
							   PointerGetDatum(collname),
							   Int32GetDatum(-1),
							   ObjectIdGetDatum(collnamespace))))
	{
		if (quiet)
		{
			heap_close(rel, NoLock);
			return InvalidOid;
		}
		else if (if_not_exists)
		{
			heap_close(rel, NoLock);
			ereport(NOTICE,
					(errcode(ERRCODE_DUPLICATE_OBJECT),
					 errmsg("collation \"%s\" already exists, skipping",
							collname)));
			return InvalidOid;
		}
		else
			ereport(ERROR,
					(errcode(ERRCODE_DUPLICATE_OBJECT),
					 errmsg("collation \"%s\" already exists",
							collname)));
	}

	tupDesc = RelationGetDescr(rel);

	/* form a tuple */
	memset(nulls, 0, sizeof(nulls));

	namestrcpy(&name_name, collname);
	values[Anum_pg_collation_collname - 1] = NameGetDatum(&name_name);
	values[Anum_pg_collation_collnamespace - 1] = ObjectIdGetDatum(collnamespace);
	values[Anum_pg_collation_collowner - 1] = ObjectIdGetDatum(collowner);
	values[Anum_pg_collation_collprovider - 1] = CharGetDatum(collprovider);
	values[Anum_pg_collation_collencoding - 1] = Int32GetDatum(collencoding);
	namestrcpy(&name_collate, collcollate);
	values[Anum_pg_collation_collcollate - 1] = NameGetDatum(&name_collate);
	namestrcpy(&name_ctype, collctype);
	values[Anum_pg_collation_collctype - 1] = NameGetDatum(&name_ctype);
	if (collversion)
		values[Anum_pg_collation_collversion - 1] = CStringGetTextDatum(collversion);
	else
		nulls[Anum_pg_collation_collversion - 1] = true;

	tup = heap_form_tuple(tupDesc, values, nulls);

	/* insert a new tuple */
	oid = CatalogTupleInsert(rel, tup);
	Assert(OidIsValid(oid));

	/* set up dependencies for the new collation */
	myself.classId = CollationRelationId;
	myself.objectId = oid;
	myself.objectSubId = 0;

	/* create dependency on namespace */
	referenced.classId = NamespaceRelationId;
	referenced.objectId = collnamespace;
	referenced.objectSubId = 0;
	recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);

	/* create dependency on owner */
	recordDependencyOnOwner(CollationRelationId, HeapTupleGetOid(tup),
							collowner);

	/* dependency on extension */
	recordDependencyOnCurrentExtension(&myself, false);

	/* Post creation hook for new collation */
	InvokeObjectPostCreateHook(CollationRelationId, oid, 0);

	heap_freetuple(tup);
	heap_close(rel, NoLock);

	return oid;
}


ivshmem_client_handle_server_msg(IvshmemClient *client) { IvshmemClientPeer *peer; long peer_id; int ret, fd; ret = ivshmem_client_read_one_msg(client, &peer_id, &fd); if (ret < 0) { /* can return a peer or the local client */ peer = ivshmem_client_search_peer(client, peer_id); /* delete peer */ if (fd == -1) { if (peer == NULL || peer == &client->local) { IVSHMEM_CLIENT_DEBUG(client, "receive delete for invalid " "peer %ld\n", peer_id); IVSHMEM_CLIENT_DEBUG(client, "delete peer id = %ld\n", peer_id); ivshmem_client_free_peer(client, peer); return 0; /* new peer */ if (peer == NULL) { peer = g_malloc0(sizeof(*peer)); peer->id = peer_id; peer->vectors_count = 0; QTAILQ_INSERT_TAIL(&client->peer_list, peer, next); IVSHMEM_CLIENT_DEBUG(client, "new peer id = %ld\n", peer_id); /* new vector */ IVSHMEM_CLIENT_DEBUG(client, " new vector %d (fd=%d) for peer id %ld\n", peer->vectors_count, fd, peer->id); peer->vectors[peer->vectors_count] = fd; peer->vectors_count++; return 0;


static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags)
{
	struct frag *f;
	struct list_head *item;
	int rec, num, group;

	BUG_ON (!data || !frags);

	if (size < 2 * VBLK_SIZE_HEAD) {
		ldm_error("Value of size is to small.");
		return false;
	}

	group = get_unaligned_be32(data + 0x08);
	rec   = get_unaligned_be16(data + 0x0C);
	num   = get_unaligned_be16(data + 0x0E);
	if ((num < 1) || (num > 4)) {
		ldm_error ("A VBLK claims to have %d parts.", num);
		return false;
	}
	if (rec >= num) {
		ldm_error("REC value (%d) exceeds NUM value (%d)", rec, num);
		return false;
	}

	list_for_each (item, frags) {
		f = list_entry (item, struct frag, list);
		if (f->group == group)
			goto found;
	}

	f = kmalloc (sizeof (*f) + size*num, GFP_KERNEL);
	if (!f) {
		ldm_crit ("Out of memory.");
		return false;
	}

	f->group = group;
	f->num   = num;
	f->rec   = rec;
	f->map   = 0xFF << num;

	list_add_tail (&f->list, frags);
found:
	if (f->map & (1 << rec)) {
		ldm_error ("Duplicate VBLK, part %d.", rec);
		f->map &= 0x7F;			/* Mark the group as broken */
		return false;
	}

	f->map |= (1 << rec);

	data += VBLK_SIZE_HEAD;
	size -= VBLK_SIZE_HEAD;

	memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size);

	return true;
}


static void qemu_rdma_signal_unregister(RDMAContext *rdma, uint64_t index, uint64_t chunk, uint64_t wr_id) { if (rdma->unregistrations[rdma->unregister_next] != 0) { fprintf(stderr, "rdma migration: queue is full!\n"); } else { RDMALocalBlock *block = &(rdma->local_ram_blocks.block[index]); if (!test_and_set_bit(chunk, block->unregister_bitmap)) { DDPRINTF("Appending unregister chunk %" PRIu64 " at position %d\n", chunk, rdma->unregister_next); rdma->unregistrations[rdma->unregister_next++] = qemu_rdma_make_wrid(wr_id, index, chunk); if (rdma->unregister_next == RDMA_SIGNALED_SEND_MAX) { rdma->unregister_next = 0; } } else { DDPRINTF("Unregister chunk %" PRIu64 " already in queue.\n", chunk); } } }


int psf_ftruncate ( SF_PRIVATE * psf , sf_count_t len ) {
 int retval ;
 if ( len < 0 ) return - 1 ;
 if ( ( sizeof ( off_t ) < sizeof ( sf_count_t ) ) && len > 0x7FFFFFFF ) return - 1 ;
 retval = ftruncate ( psf -> file . filedes , len ) ;
 if ( retval == - 1 ) psf_log_syserr ( psf , errno ) ;
 return retval ;
 }


static void nic_receive(void *opaque, const uint8_t * buf, size_t size) { /* TODO: * - Magic packets should set bit 30 in power management driver register. * - Interesting packets should set bit 29 in power management driver register. */ EEPRO100State *s = opaque; uint16_t rfd_status = 0xa000; static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; /* TODO: check multiple IA bit. */ assert(!(s->configuration[20] & BIT(6))); if (s->configuration[8] & 0x80) { /* CSMA is disabled. */ logout("%p received while CSMA is disabled\n", s); return; } else if (size < 64 && (s->configuration[7] & 1)) { /* Short frame and configuration byte 7/0 (discard short receive) set: * Short frame is discarded */ logout("%p received short frame (%d byte)\n", s, size); s->statistics.rx_short_frame_errors++; //~ return; } else if ((size > MAX_ETH_FRAME_SIZE + 4) && !(s->configuration[18] & 8)) { /* Long frame and configuration byte 18/3 (long receive ok) not set: * Long frames are discarded. */ logout("%p received long frame (%d byte), ignored\n", s, size); return; } else if (memcmp(buf, s->macaddr, 6) == 0) { // !!! /* Frame matches individual address. */ /* TODO: check configuration byte 15/4 (ignore U/L). */ logout("%p received frame for me, len=%d\n", s, size); } else if (memcmp(buf, broadcast_macaddr, 6) == 0) { /* Broadcast frame. */ logout("%p received broadcast, len=%d\n", s, size); rfd_status |= 0x0002; } else if (buf[0] & 0x01) { // !!! /* Multicast frame. */ logout("%p received multicast, len=%d\n", s, size); /* TODO: check multicast all bit. */ assert(!(s->configuration[21] & BIT(3))); int mcast_idx = compute_mcast_idx(buf); if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) { return; } rfd_status |= 0x0002; } else if (s->configuration[15] & 1) { /* Promiscuous: receive all. */ logout("%p received frame in promiscuous mode, len=%d\n", s, size); rfd_status |= 0x0004; } else { logout("%p received frame, ignored, len=%d,%s\n", s, size, nic_dump(buf, size)); return; } if (get_ru_state(s) != ru_ready) { /* No ressources available. */ logout("no ressources, state=%u\n", get_ru_state(s)); s->statistics.rx_resource_errors++; //~ assert(!"no ressources"); return; } //~ !!! //~ $3 = {status = 0x0, command = 0xc000, link = 0x2d220, rx_buf_addr = 0x207dc, count = 0x0, size = 0x5f8, packet = {0x0 <repeats 1518 times>}} eepro100_rx_t rx; cpu_physical_memory_read(s->ru_base + s->ru_offset, (uint8_t *) & rx, offsetof(eepro100_rx_t, packet)); uint16_t rfd_command = le16_to_cpu(rx.command); uint16_t rfd_size = le16_to_cpu(rx.size); assert(size <= rfd_size); if (size < 64) { rfd_status |= 0x0080; } logout("command 0x%04x, link 0x%08x, addr 0x%08x, size %u\n", rfd_command, rx.link, rx.rx_buf_addr, rfd_size); stw_phys(s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, status), rfd_status); stw_phys(s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, count), size); /* Early receive interrupt not supported. */ //~ eepro100_er_interrupt(s); /* Receive CRC Transfer not supported. */ assert(!(s->configuration[18] & 4)); /* TODO: check stripping enable bit. */ //~ assert(!(s->configuration[17] & 1)); cpu_physical_memory_write(s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, packet), buf, size); s->statistics.rx_good_frames++; eepro100_fr_interrupt(s); s->ru_offset = le32_to_cpu(rx.link); if (rfd_command & 0x8000) { /* EL bit is set, so this was the last frame. */ assert(0); } if (rfd_command & 0x4000) { /* S bit is set. */ set_ru_state(s, ru_suspended); } }


static int ogg_packet ( AVFormatContext * s , int * sid , int * dstart , int * dsize , int64_t * fpos ) {
 struct ogg * ogg = s -> priv_data ;
 int idx , i , ret ;
 struct ogg_stream * os ;
 int complete = 0 ;
 int segp = 0 , psize = 0 ;
 av_log ( s , AV_LOG_TRACE , "ogg_packet: curidx=%i\n" , ogg -> curidx ) ;
 if ( sid ) * sid = - 1 ;
 do {
 idx = ogg -> curidx ;
 while ( idx < 0 ) {
 ret = ogg_read_page ( s , & idx ) ;
 if ( ret < 0 ) return ret ;
 }
 os = ogg -> streams + idx ;
 av_log ( s , AV_LOG_TRACE , "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n" , idx , os -> pstart , os -> psize , os -> segp , os -> nsegs ) ;
 if ( ! os -> codec ) {
 if ( os -> header < 0 ) {
 os -> codec = ogg_find_codec ( os -> buf , os -> bufpos ) ;
 if ( ! os -> codec ) {
 av_log ( s , AV_LOG_WARNING , "Codec not found\n" ) ;
 os -> header = 0 ;
 return 0 ;
 }
 }
 else {
 return 0 ;
 }
 }
 segp = os -> segp ;
 psize = os -> psize ;
 while ( os -> segp < os -> nsegs ) {
 int ss = os -> segments [ os -> segp ++ ] ;
 os -> psize += ss ;
 if ( ss < 255 ) {
 complete = 1 ;
 break ;
 }
 }
 if ( ! complete && os -> segp == os -> nsegs ) {
 ogg -> curidx = - 1 ;
 os -> incomplete = ! ! os -> psize ;
 }
 }
 while ( ! complete ) ;
 if ( os -> granule == - 1 ) av_log ( s , AV_LOG_WARNING , "Page at %" PRId64 " is missing granule\n" , os -> page_pos ) ;
 ogg -> curidx = idx ;
 os -> incomplete = 0 ;
 if ( os -> header ) {
 os -> header = os -> codec -> header ( s , idx ) ;
 if ( ! os -> header ) {
 os -> segp = segp ;
 os -> psize = psize ;
 ogg -> headers = 1 ;
 if ( ! s -> internal -> data_offset ) s -> internal -> data_offset = os -> sync_pos ;
 for ( i = 0 ;
 i < ogg -> nstreams ;
 i ++ ) {
 struct ogg_stream * cur_os = ogg -> streams + i ;
 if ( cur_os -> incomplete ) s -> internal -> data_offset = FFMIN ( s -> internal -> data_offset , cur_os -> sync_pos ) ;
 }
 }
 else {
 os -> nb_header ++ ;
 os -> pstart += os -> psize ;
 os -> psize = 0 ;
 }
 }
 else {
 os -> pflags = 0 ;
 os -> pduration = 0 ;
 if ( os -> codec && os -> codec -> packet ) os -> codec -> packet ( s , idx ) ;
 if ( sid ) * sid = idx ;
 if ( dstart ) * dstart = os -> pstart ;
 if ( dsize ) * dsize = os -> psize ;
 if ( fpos ) * fpos = os -> sync_pos ;
 os -> pstart += os -> psize ;
 os -> psize = 0 ;
 if ( os -> pstart == os -> bufpos ) os -> bufpos = os -> pstart = 0 ;
 os -> sync_pos = os -> page_pos ;
 }
 os -> page_end = 1 ;
 for ( i = os -> segp ;
 i < os -> nsegs ;
 i ++ ) if ( os -> segments [ i ] < 255 ) {
 os -> page_end = 0 ;
 break ;
 }
 if ( os -> segp == os -> nsegs ) ogg -> curidx = - 1 ;
 return 0 ;
 }


int unit_name_path_escape(const char *f, char **ret) {
        char *p, *s;

        assert(f);
        assert(ret);

        p = strdupa(f);
        if (!p)
                return -ENOMEM;

        path_simplify(p);

        if (empty_or_root(p))
                s = strdup("-");
        else {
                if (!path_is_normalized(p))
                        return -EINVAL;

                /* Truncate trailing slashes */
                delete_trailing_chars(p, "/");

                /* Truncate leading slashes */
                p = skip_leading_chars(p, "/");

                s = unit_name_escape(p);
        }
        if (!s)
                return -ENOMEM;

        *ret = s;
        return 0;
}


int virLogParseDefaultPriority ( const char * priority ) {
 if ( STREQ ( priority , "1" ) || STREQ ( priority , "debug" ) ) return VIR_LOG_DEBUG ;
 else if ( STREQ ( priority , "2" ) || STREQ ( priority , "info" ) ) return VIR_LOG_INFO ;
 else if ( STREQ ( priority , "3" ) || STREQ ( priority , "warning" ) ) return VIR_LOG_WARN ;
 else if ( STREQ ( priority , "4" ) || STREQ ( priority , "error" ) ) return VIR_LOG_ERROR ;
 return - 1 ;
 }


static void dtap_cc_notify ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
 guint32 curr_offset ;
 guint32 consumed ;
 guint curr_len ;
 curr_offset = offset ;
 curr_len = len ;
 is_uplink = IS_UPLINK_FALSE ;
 ELEM_MAND_V ( GSM_A_PDU_TYPE_DTAP , DE_NOT_IND , NULL ) ;
 EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
 }


void ff_h264_init_cabac_states ( H264Context * h ) {
 int i ;
 const int8_t ( * tab ) [ 2 ] ;
 const int slice_qp = av_clip ( h -> qscale - 6 * ( h -> sps . bit_depth_luma - 8 ) , 0 , 51 ) ;
 if ( h -> slice_type_nos == AV_PICTURE_TYPE_I ) tab = cabac_context_init_I ;
 else tab = cabac_context_init_PB [ h -> cabac_init_idc ] ;
 for ( i = 0 ;
 i < 1024 ;
 i ++ ) {
 int pre = 2 * ( ( ( tab [ i ] [ 0 ] * slice_qp ) >> 4 ) + tab [ i ] [ 1 ] ) - 127 ;
 pre ^= pre >> 31 ;
 if ( pre > 124 ) pre = 124 + ( pre & 1 ) ;
 h -> cabac_state [ i ] = pre ;
 }
 }


static int eval_refl(int *refl, const int16_t *coefs, RA144Context *ractx) { int b, c, i; unsigned int u; int buffer1[10]; int buffer2[10]; int *bp1 = buffer1; int *bp2 = buffer2; for (i=0; i < 10; i++) buffer2[i] = coefs[i]; refl[9] = bp2[9]; if ((unsigned) bp2[9] + 0x1000 > 0x1fff) { av_log(ractx, AV_LOG_ERROR, "Overflow. Broken sample?\n"); return 1; } for (c=8; c >= 0; c--) { b = 0x1000-((bp2[c+1] * bp2[c+1]) >> 12); if (!b) b = -2; for (u=0; u<=c; u++) bp1[u] = ((bp2[u] - ((refl[c+1] * bp2[c-u]) >> 12)) * (0x1000000 / b)) >> 12; refl[c] = bp1[c]; if ((unsigned) bp1[c] + 0x1000 > 0x1fff) return 1; FFSWAP(int *, bp1, bp2); } return 0; }


static void proto_tree_set_ipv6_tvb ( field_info * fi , tvbuff_t * tvb , gint start , gint length ) {
 proto_tree_set_ipv6 ( fi , tvb_get_ptr ( tvb , start , length ) ) ;
 }


static int mp_user_removexattr(FsContext *ctx, const char *path, const char *name) { char buffer[PATH_MAX]; if (strncmp(name, "user.virtfs.", 12) == 0) { /* * Don't allow fetch of user.virtfs namesapce * in case of mapped security */ errno = EACCES; return -1; } return lremovexattr(rpath(ctx, path, buffer), name); }


static always_inline void gen_ext_l(void (*tcg_gen_ext_i64)(TCGv t0, TCGv t1), int ra, int rb, int rc, int islit, uint8_t lit) { if (unlikely(rc == 31)) return; if (ra != 31) { if (islit) { tcg_gen_shri_i64(cpu_ir[rc], cpu_ir[ra], (lit & 7) * 8); } else { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(tmp, cpu_ir[rb], 7); tcg_gen_shli_i64(tmp, tmp, 3); tcg_gen_shr_i64(cpu_ir[rc], cpu_ir[ra], tmp); tcg_temp_free(tmp); } if (tcg_gen_ext_i64) tcg_gen_ext_i64(cpu_ir[rc], cpu_ir[rc]); } else tcg_gen_movi_i64(cpu_ir[rc], 0); }


static void default_print_section_header ( WriterContext * wctx ) {
 DefaultContext * def = wctx -> priv ;
 char buf [ 32 ] ;
 const struct section * section = wctx -> section [ wctx -> level ] ;
 const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
 av_bprint_clear ( & wctx -> section_pbuf [ wctx -> level ] ) ;
 if ( parent_section && ! ( parent_section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) {
 def -> nested_section [ wctx -> level ] = 1 ;
 av_bprintf ( & wctx -> section_pbuf [ wctx -> level ] , "%s%s:" , wctx -> section_pbuf [ wctx -> level - 1 ] . str , upcase_string ( buf , sizeof ( buf ) , av_x_if_null ( section -> element_name , section -> name ) ) ) ;
 }
 if ( def -> noprint_wrappers || def -> nested_section [ wctx -> level ] ) return ;
 if ( ! ( section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "[%s]\n" , upcase_string ( buf , sizeof ( buf ) , section -> name ) ) ;
 }


static inline bool e1000e_ring_empty ( E1000ECore * core , const E1000E_RingInfo * r ) {
 return core -> mac [ r -> dh ] == core -> mac [ r -> dt ] || core -> mac [ r -> dt ] >= core -> mac [ r -> dlen ] / E1000_RING_DESC_LEN ;
 }


sPAPRDRConnector *spapr_dr_connector_new(Object *owner, sPAPRDRConnectorType type, uint32_t id) { sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(object_new(TYPE_SPAPR_DR_CONNECTOR)); g_assert(type); drc->type = type; drc->id = id; drc->owner = owner; object_property_add_child(owner, "dr-connector[*]", OBJECT(drc), NULL); object_property_set_bool(OBJECT(drc), true, "realized", NULL); /* human-readable name for a DRC to encode into the DT * description. this is mainly only used within a guest in place * of the unique DRC index. * * in the case of VIO/PCI devices, it corresponds to a * "location code" that maps a logical device/function (DRC index) * to a physical (or virtual in the case of VIO) location in the * system by chaining together the "location label" for each * encapsulating component. * * since this is more to do with diagnosing physical hardware * issues than guest compatibility, we choose location codes/DRC * names that adhere to the documented format, but avoid encoding * the entire topology information into the label/code, instead * just using the location codes based on the labels for the * endpoints (VIO/PCI adaptor connectors), which is basically * just "C" followed by an integer ID. * * DRC names as documented by PAPR+ v2.7, 13.5.2.4 * location codes as documented by PAPR+ v2.7, 12.3.1.5 */ switch (drc->type) { case SPAPR_DR_CONNECTOR_TYPE_CPU: drc->name = g_strdup_printf("CPU %d", id); break; case SPAPR_DR_CONNECTOR_TYPE_PHB: drc->name = g_strdup_printf("PHB %d", id); break; case SPAPR_DR_CONNECTOR_TYPE_VIO: case SPAPR_DR_CONNECTOR_TYPE_PCI: drc->name = g_strdup_printf("C%d", id); break; case SPAPR_DR_CONNECTOR_TYPE_LMB: drc->name = g_strdup_printf("LMB %d", id); break; default: g_assert(false); } /* PCI slot always start in a USABLE state, and stay there */ if (drc->type == SPAPR_DR_CONNECTOR_TYPE_PCI) { drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE; } return drc; }


int bdrv_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) { BlockDriver *drv = bs->drv; if (!drv) return -ENOMEDIUM; if (drv->bdrv_snapshot_create) return drv->bdrv_snapshot_create(bs, sn_info); if (bs->file) return bdrv_snapshot_create(bs->file, sn_info); return -ENOTSUP; }


static VALUE ossl_asn1_ ## klass ( int argc , VALUE * argv , VALUE self ) \ {
 return rb_funcall3 ( cASN1 ## klass , rb_intern ( "new" ) , argc , argv ) ;
 }
 OSSL_ASN1_IMPL_FACTORY_METHOD ( Boolean ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Integer ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Enumerated ) OSSL_ASN1_IMPL_FACTORY_METHOD ( BitString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( OctetString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( UTF8String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( NumericString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( PrintableString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( T61String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( VideotexString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( IA5String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( GraphicString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( ISO64String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( GeneralString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( UniversalString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( BMPString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Null ) OSSL_ASN1_IMPL_FACTORY_METHOD ( ObjectId ) OSSL_ASN1_IMPL_FACTORY_METHOD ( UTCTime ) OSSL_ASN1_IMPL_FACTORY_METHOD ( GeneralizedTime ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Sequence ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Set ) OSSL_ASN1_IMPL_FACTORY_METHOD ( EndOfContent )


static int mov_write_udta_tag(ByteIOContext *pb, MOVContext* mov, AVFormatContext *s) { int pos = url_ftell(pb); int i; put_be32(pb, 0); /* size */ put_tag(pb, "udta"); /* iTunes meta data */ mov_write_meta_tag(pb, mov, s); /* Requirements */ for (i=0; i<MAX_STREAMS; i++) { if(mov->tracks[i].entry <= 0) continue; if (mov->tracks[i].enc->codec_id == CODEC_ID_AAC || mov->tracks[i].enc->codec_id == CODEC_ID_MPEG4) { int pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "\251req"); put_be16(pb, sizeof("QuickTime 6.0 or greater") - 1); put_be16(pb, 0); put_buffer(pb, "QuickTime 6.0 or greater", sizeof("QuickTime 6.0 or greater") - 1); updateSize(pb, pos); break; } } /* Encoder */ if(!(mov->tracks[0].enc->flags & CODEC_FLAG_BITEXACT)) { int pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "\251enc"); put_be16(pb, sizeof(LIBAVFORMAT_IDENT) - 1); /* string length */ put_be16(pb, 0); put_buffer(pb, LIBAVFORMAT_IDENT, sizeof(LIBAVFORMAT_IDENT) - 1); updateSize(pb, pos); } if( s->title[0] ) { int pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "\251nam"); put_be16(pb, strlen(s->title)); /* string length */ put_be16(pb, 0); put_buffer(pb, s->title, strlen(s->title)); updateSize(pb, pos); } if( s->author[0] ) { int pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, /*"\251aut"*/ "\251day" ); put_be16(pb, strlen(s->author)); /* string length */ put_be16(pb, 0); put_buffer(pb, s->author, strlen(s->author)); updateSize(pb, pos); } if( s->comment[0] ) { int pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "\251des"); put_be16(pb, strlen(s->comment)); /* string length */ put_be16(pb, 0); put_buffer(pb, s->comment, strlen(s->comment)); updateSize(pb, pos); } return updateSize(pb, pos); }


inline int MatchingDim(const RuntimeShape& shape1, int index1,
                       const RuntimeShape& shape2, int index2) {
  TFLITE_DCHECK_EQ(shape1.Dims(index1), shape2.Dims(index2));
  return shape1.Dims(index1);
}


static int dxtory_decode_v2_410(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size) { GetByteContext gb; GetBitContext gb2; int nslices, slice, slice_height, ref_slice_height; int cur_y, next_y; uint32_t off, slice_size; uint8_t *Y, *U, *V; int ret; bytestream2_init(&gb, src, src_size); nslices = bytestream2_get_le16(&gb); off = FFALIGN(nslices * 4 + 2, 16); if (src_size < off) { av_log(avctx, AV_LOG_ERROR, "no slice data\n"); return AVERROR_INVALIDDATA; } if (!nslices || avctx->height % nslices) { avpriv_request_sample(avctx, "%d slices for %dx%d", nslices, avctx->width, avctx->height); return AVERROR_PATCHWELCOME; } ref_slice_height = avctx->height / nslices; if ((avctx->width & 3) || (avctx->height & 3)) { avpriv_request_sample(avctx, "Frame dimensions %dx%d", avctx->width, avctx->height); } avctx->pix_fmt = AV_PIX_FMT_YUV410P; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; Y = pic->data[0]; U = pic->data[1]; V = pic->data[2]; cur_y = 0; next_y = ref_slice_height; for (slice = 0; slice < nslices; slice++) { slice_size = bytestream2_get_le32(&gb); slice_height = (next_y & ~3) - (cur_y & ~3); if (slice_size > src_size - off) { av_log(avctx, AV_LOG_ERROR, "invalid slice size %"PRIu32" (only %"PRIu32" bytes left)\n", slice_size, src_size - off); return AVERROR_INVALIDDATA; } if (slice_size <= 16) { av_log(avctx, AV_LOG_ERROR, "invalid slice size %"PRIu32"\n", slice_size); return AVERROR_INVALIDDATA; } if (AV_RL32(src + off) != slice_size - 16) { av_log(avctx, AV_LOG_ERROR, "Slice sizes mismatch: got %"PRIu32" instead of %"PRIu32"\n", AV_RL32(src + off), slice_size - 16); } init_get_bits(&gb2, src + off + 16, (slice_size - 16) * 8); dx2_decode_slice_410(&gb2, avctx->width, slice_height, Y, U, V, pic->linesize[0], pic->linesize[1], pic->linesize[2]); Y += pic->linesize[0] * slice_height; U += pic->linesize[1] * (slice_height >> 2); V += pic->linesize[2] * (slice_height >> 2); off += slice_size; cur_y = next_y; next_y += ref_slice_height; } return 0; }


static int rv20_decode_picture_header(MpegEncContext *s) { int seq, mb_pos, i; i= get_bits(&s->gb, 2); switch(i){ case 0: s->pict_type= I_TYPE; break; case 1: s->pict_type= I_TYPE; break; //hmm ... case 2: s->pict_type= P_TYPE; break; case 3: s->pict_type= B_TYPE; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n"); return -1; } if (get_bits(&s->gb, 1)){ av_log(s->avctx, AV_LOG_ERROR, "unknown bit set\n"); return -1; } s->qscale = get_bits(&s->gb, 5); if(s->qscale==0){ av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); return -1; } if(s->avctx->sub_id == 0x20200002) seq= get_bits(&s->gb, 16); else seq= get_bits(&s->gb, 8); for(i=0; i<6; i++){ if(s->mb_width*s->mb_height < ff_mba_max[i]) break; } mb_pos= get_bits(&s->gb, ff_mba_length[i]); s->mb_x= mb_pos % s->mb_width; s->mb_y= mb_pos / s->mb_width; s->no_rounding= get_bits1(&s->gb); s->f_code = 1; s->unrestricted_mv = 1; s->h263_aic= s->pict_type == I_TYPE; // s->alt_inter_vlc=1; // s->obmc=1; // s->umvplus=1; // s->modified_quant=1; if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding); } if (s->pict_type == B_TYPE){ av_log(s->avctx, AV_LOG_ERROR, "b frame not supported\n"); return -1; } return s->mb_width*s->mb_height - mb_pos; }


static void test_visitor_in_union_flat(TestInputVisitorData *data, const void *unused) { Visitor *v; Error *err = NULL; UserDefFlatUnion *tmp; UserDefUnionBase *base; v = visitor_input_test_init(data, "{ 'enum1': 'value1', " "'integer': 41, " "'string': 'str', " "'boolean': true }"); visit_type_UserDefFlatUnion(v, &tmp, NULL, &err); g_assert(err == NULL); g_assert_cmpint(tmp->enum1, ==, ENUM_ONE_VALUE1); g_assert_cmpstr(tmp->string, ==, "str"); g_assert_cmpint(tmp->integer, ==, 41); g_assert_cmpint(tmp->u.value1->boolean, ==, true); base = qapi_UserDefFlatUnion_base(tmp); g_assert(&base->enum1 == &tmp->enum1); qapi_free_UserDefFlatUnion(tmp); }


uint64_t TSHttpTxnIdGet ( TSHttpTxn txnp ) {
 sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
 HttpSM * sm = ( HttpSM * ) txnp ;
 return ( uint64_t ) sm -> sm_id ;
 }


int swr_convert_frame(SwrContext *s, AVFrame *out, const AVFrame *in) { int ret, setup = 0; if (!swr_is_initialized(s)) { if ((ret = swr_config_frame(s, out, in)) < 0) return ret; if ((ret = swr_init(s)) < 0) return ret; setup = 1; } else { // return as is or reconfigure for input changes? if ((ret = config_changed(s, out, in))) return ret; } if (out) { if (!out->linesize[0]) { out->nb_samples = swr_get_delay(s, s->out_sample_rate) + in->nb_samples*(int64_t)s->out_sample_rate / s->in_sample_rate + 3; if ((ret = av_frame_get_buffer(out, 0)) < 0) { if (setup) swr_close(s); return ret; } } else { if (!out->nb_samples) out->nb_samples = available_samples(out); } } return convert_frame(s, out, in); }


av_cold static int fbdev_read_header(AVFormatContext *avctx, AVFormatParameters *ap) { FBDevContext *fbdev = avctx->priv_data; AVStream *st = NULL; enum PixelFormat pix_fmt; int ret, flags = O_RDONLY; ret = av_parse_video_rate(&fbdev->framerate_q, fbdev->framerate); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Couldn't parse framerate.\n"); return ret; } #if FF_API_FORMAT_PARAMETERS if (ap->time_base.num) fbdev->framerate_q = (AVRational){ap->time_base.den, ap->time_base.num}; #endif if (!(st = av_new_stream(avctx, 0))) return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */ /* NONBLOCK is ignored by the fbdev driver, only set for consistency */ if (avctx->flags & AVFMT_FLAG_NONBLOCK) flags |= O_NONBLOCK; if ((fbdev->fd = open(avctx->filename, flags)) == -1) { ret = AVERROR(errno); av_log(avctx, AV_LOG_ERROR, "Could not open framebuffer device '%s': %s\n", avctx->filename, strerror(ret)); return ret; } if (ioctl(fbdev->fd, FBIOGET_VSCREENINFO, &fbdev->varinfo) < 0) { ret = AVERROR(errno); av_log(avctx, AV_LOG_ERROR, "FBIOGET_VSCREENINFO: %s\n", strerror(errno)); goto fail; } if (ioctl(fbdev->fd, FBIOGET_FSCREENINFO, &fbdev->fixinfo) < 0) { ret = AVERROR(errno); av_log(avctx, AV_LOG_ERROR, "FBIOGET_FSCREENINFO: %s\n", strerror(errno)); goto fail; } pix_fmt = get_pixfmt_from_fb_varinfo(&fbdev->varinfo); if (pix_fmt == PIX_FMT_NONE) { ret = AVERROR(EINVAL); av_log(avctx, AV_LOG_ERROR, "Framebuffer pixel format not supported.\n"); goto fail; } fbdev->width = fbdev->varinfo.xres; fbdev->heigth = fbdev->varinfo.yres; fbdev->bytes_per_pixel = (fbdev->varinfo.bits_per_pixel + 7) >> 3; fbdev->frame_linesize = fbdev->width * fbdev->bytes_per_pixel; fbdev->frame_size = fbdev->frame_linesize * fbdev->heigth; fbdev->time_frame = AV_NOPTS_VALUE; fbdev->data = mmap(NULL, fbdev->fixinfo.smem_len, PROT_READ, MAP_SHARED, fbdev->fd, 0); if (fbdev->data == MAP_FAILED) { ret = AVERROR(errno); av_log(avctx, AV_LOG_ERROR, "Error in mmap(): %s\n", strerror(errno)); goto fail; } st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->width = fbdev->width; st->codec->height = fbdev->heigth; st->codec->pix_fmt = pix_fmt; st->codec->time_base = (AVRational){fbdev->framerate_q.den, fbdev->framerate_q.num}; st->codec->bit_rate = fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel * av_q2d(fbdev->framerate_q) * 8; av_log(avctx, AV_LOG_INFO, "w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n", fbdev->width, fbdev->heigth, fbdev->varinfo.bits_per_pixel, av_pix_fmt_descriptors[pix_fmt].name, fbdev->framerate_q.num, fbdev->framerate_q.den, st->codec->bit_rate); return 0; fail: close(fbdev->fd); return ret; }


static int ipvideo_decode_block_opcode_0xB ( IpvideoContext * s , AVFrame * frame ) {
 int y ;
 for ( y = 0 ;
 y < 8 ;
 y ++ ) {
 bytestream2_get_buffer ( & s -> stream_ptr , s -> pixel_ptr , 8 ) ;
 s -> pixel_ptr += s -> stride ;
 }
 return 0 ;
 }


static int check_consistent_binlog_pos ( char * binlog_pos_file , char * binlog_pos_offset ) {
 MYSQL_RES * res ;
 MYSQL_ROW row ;
 int found ;
 if ( mysql_query_with_error_report ( mysql , & res , "SHOW STATUS LIKE 'binlog_snapshot_%'" ) ) return 0 ;
 found = 0 ;
 while ( ( row = mysql_fetch_row ( res ) ) ) {
 if ( 0 == strcmp ( row [ 0 ] , "Binlog_snapshot_file" ) ) {
 if ( binlog_pos_file ) strmake ( binlog_pos_file , row [ 1 ] , FN_REFLEN - 1 ) ;
 found ++ ;
 }
 else if ( 0 == strcmp ( row [ 0 ] , "Binlog_snapshot_position" ) ) {
 if ( binlog_pos_offset ) strmake ( binlog_pos_offset , row [ 1 ] , LONGLONG_LEN ) ;
 found ++ ;
 }
 }
 mysql_free_result ( res ) ;
 return ( found == 2 ) ;
 }


static int dissect_h225_SetupAcknowledge_UUIE ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
 # line 432 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
 offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_SetupAcknowledge_UUIE , SetupAcknowledge_UUIE_sequence ) ;
 # line 436 "./asn1/h225/h225.cnf" h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
 if ( h225_pi != NULL ) {
 h225_pi -> cs_type = H225_SETUP_ACK ;
 g_snprintf ( h225_pi -> frame_label , 50 , "%s" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) ) ;
 }
 return offset ;
 }


static void sdk_free_field_handle ( TSMBuffer bufp , MIMEFieldSDKHandle * field_handle ) {
 if ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) {
 mHandleAllocator . free ( field_handle ) ;
 }
 }