本文整理汇总了C++中CVT_PTR_NOCHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ CVT_PTR_NOCHECK函数的具体用法?C++ CVT_PTR_NOCHECK怎么用?C++ CVT_PTR_NOCHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CVT_PTR_NOCHECK函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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_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
示例4: 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
示例5: 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_NOCHECK函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论