當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。