当前位置: 首页>>代码示例>>C++>>正文


C++ CVT_PTR函数代码示例

本文整理汇总了C++中CVT_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ CVT_PTR函数的具体用法?C++ CVT_PTR怎么用?C++ CVT_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CVT_PTR函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pngtest_write_data

static void
pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
	png_uint_32 check;
	png_byte *near_data;  /* Needs to be "png_byte *" instead of "png_bytep" */
	png_FILE_p io_ptr;
	/* Check if data really is near. If so, use usual code. */
	near_data = (png_byte *)CVT_PTR_NOCHECK(data);
	io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
	if ((png_bytep)near_data == data)
		WRITEFILE(io_ptr, near_data, length, check);
	else {
		png_byte buf[NEAR_BUF_SIZE];
		png_size_t written, remaining, err;
		check = 0;
		remaining = length;
		do {
			written = MIN(NEAR_BUF_SIZE, remaining);
			png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
			WRITEFILE(io_ptr, buf, written, err);
			if (err != written)
				break;
			else
				check += err;
			data += written;
			remaining -= written;
		} while (remaining != 0);
	}
	if (check != length)
		png_error(png_ptr, "Write Error");
}
开发者ID:Codyle,项目名称:pcsx2,代码行数:31,代码来源:pngtest.c

示例2: pngtest_read_data

static void
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
	int check;
	png_byte *n_data;
	png_FILE_p io_ptr;
	/* Check if data really is near. If so, use usual code. */
	n_data = (png_byte *)CVT_PTR_NOCHECK(data);
	io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
	if ((png_bytep)n_data == data)
		READFILE(io_ptr, n_data, length, check);
	else {
		png_byte buf[NEAR_BUF_SIZE];
		png_size_t read, remaining, err;
		check = 0;
		remaining = length;
		do {
			read = MIN(NEAR_BUF_SIZE, remaining);
			READFILE(io_ptr, buf, 1, err);
			png_memcpy(data, buf, read); /* Copy far buffer to near buffer */
			if (err != read)
				break;
			else
				check += err;
			data += read;
			remaining -= read;
		} while (remaining != 0);
	}
	if (check != length)
		png_error(png_ptr, "read Error");
}
开发者ID:Codyle,项目名称:pcsx2,代码行数:31,代码来源:pngtest.c

示例3: png_default_flush

static void
png_default_flush(png_structp png_ptr)
{
   FILE *io_ptr;
   io_ptr = (FILE *)CVT_PTR((png_ptr->io_ptr));
   if (io_ptr != NULL)
      fflush(io_ptr);
}
开发者ID:axxie,项目名称:MouseImp,代码行数:8,代码来源:pngwio.c

示例4: jbig2_png_flush

static void
jbig2_png_flush(png_structp png_ptr)
{
    png_FILE_p io_ptr;
    io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
    if (io_ptr != NULL)
        fflush(io_ptr);
}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:8,代码来源:jbig2_image_png.c

示例5: png_default_flush

void PNGCBAPI
png_default_flush(png_structp png_ptr)
{
   png_FILE_p io_ptr;
   if (png_ptr == NULL)
      return;
   io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
   fflush(io_ptr);
}
开发者ID:bincker,项目名称:Webkey,代码行数:9,代码来源:pngwio.c

示例6: pngtest_flush

static void
pngtest_flush(png_structp png_ptr)
{
#if !defined(_WIN32_WCE)
   png_FILE_p io_ptr;
   io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
   if (io_ptr != NULL)
      fflush(io_ptr);
#endif
}
开发者ID:50p,项目名称:multitheftauto,代码行数:10,代码来源:pngtest.c

示例7: png_default_flush

void PNGAPI
png_default_flush(png_structp png_ptr)
{
#if !defined(_WIN32_WCE)
   png_FILE_p io_ptr;
   io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
   if (io_ptr != NULL)
      fflush(io_ptr);
#endif
}
开发者ID:Teivaz,项目名称:nebula2,代码行数:10,代码来源:pngwio.c

示例8: png_default_write_data

void PNGAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
  png_uint_32 check;
  png_byte *near_data;  /* Needs to be "png_byte *" instead of "png_bytep" */
  png_FILE_p io_ptr;

  /* Check if data really is near. If so, use usual code. */
  near_data = (png_byte *)CVT_PTR_NOCHECK(data);
  io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);

  if ((png_bytep)near_data == data) {
#if defined(_WIN32_WCE)

    if (!WriteFile(io_ptr, near_data, length, &check, NULL)) {
      check = 0;
    }

#else
    check = fwrite(near_data, 1, length, io_ptr);
#endif
  } else {
    png_byte buf[NEAR_BUF_SIZE];
    png_size_t written, remaining, err;
    check = 0;
    remaining = length;

    do {
      written = MIN(NEAR_BUF_SIZE, remaining);
      png_memcpy(buf, data, written); /* copy far buffer to near buffer */
#if defined(_WIN32_WCE)

      if (!WriteFile(io_ptr, buf, written, &err, NULL)) {
        err = 0;
      }

#else
      err = fwrite(buf, 1, written, io_ptr);
#endif

      if (err != written) {
        break;
      } else {
        check += err;
      }

      data += written;
      remaining -= written;
    } while (remaining != 0);
  }

  if (check != length) {
    png_error(png_ptr, "Write Error");
  }
}
开发者ID:cafeinecake,项目名称:hge2,代码行数:55,代码来源:pngwio.c

示例9: png_default_flush

void PNGAPI
png_default_flush(png_structp png_ptr)
{
#if !defined(_WIN32_WCE)
   png_FILE_p io_ptr;
#endif
   if (png_ptr == NULL) return;
#if !defined(_WIN32_WCE)
   io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
   fflush(io_ptr);
#endif
}
开发者ID:is00hcw,项目名称:page-speed,代码行数:12,代码来源:pngwio.c

示例10: pngtest_write_data

static void
pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
   png_size_t check;
   png_FILE_p io_ptr;
   io_ptr = (png_FILE_p)CVT_PTR(png_get_io_ptr(png_ptr));

   check = fwrite(data, 1, length, io_ptr);
   if (check != length)
   {
      png_error(png_ptr, "Write Error");
   }
}
开发者ID:52nlp,项目名称:LabelMeAnnotationTool,代码行数:13,代码来源:pngtest.c

示例11: png_default_read_data

static void PNGCBAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
    png_size_t check;
    png_byte *n_data;
    png_FILE_p io_ptr;

    if (png_ptr == NULL)
        return;

    /* Check if data really is near. If so, use usual code. */
    n_data = (png_byte *)CVT_PTR_NOCHECK(data);
    io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);

    if ((png_bytep)n_data == data)
    {
        check = fread(n_data, 1, length, io_ptr);
    }

    else
    {
        png_byte buf[NEAR_BUF_SIZE];
        png_size_t read, remaining, err;
        check = 0;
        remaining = length;

        do
        {
            read = MIN(NEAR_BUF_SIZE, remaining);
            err = fread(buf, 1, read, io_ptr);
            png_memcpy(data, buf, read); /* copy FAR buffer to near buffer */

            if (err != read)
                break;

            else
                check += err;

            data += read;
            remaining -= read;
        }
        while (remaining != 0);
    }

    if ((png_uint_32)check != (png_uint_32)length)
        png_error(png_ptr, "read Error");
}
开发者ID:Strongc,项目名称:Tesseract_Ocr,代码行数:47,代码来源:pngrio.c

示例12: png_default_write_data

static void
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
   png_uint_32 check;
   png_byte *near_data;
   FILE *io_ptr;

   near_data = (png_byte *)CVT_PTR_NOCHECK(data);
   io_ptr = (FILE *)CVT_PTR(png_ptr->io_ptr);
   if ((png_bytep)near_data == data)
   {
      check = fwrite(near_data, 1, length, io_ptr);
   }
   else
   {
      png_byte buf[NEAR_BUF_SIZE];
      png_size_t written, remaining, err;
      check = 0;
      remaining = length;
      do
      {
         written = MIN(NEAR_BUF_SIZE, remaining);
         png_memcpy(buf, data, written);
         err = fwrite(buf, 1, written, io_ptr);
         if (err != written)
            break;
         else
            check += err;
         data += written;
         remaining -= written;
      }
      while (remaining != 0);
   }
   if (check != length)
   {
      png_error(png_ptr, "Write Error");
   }
}
开发者ID:AMDmi3,项目名称:analog,代码行数:38,代码来源:pngwio.c


注:本文中的CVT_PTR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。