本文整理汇总了C++中debug_printf函数 的典型用法代码示例。如果您正苦于以下问题:C++ debug_printf函数的具体用法?C++ debug_printf怎么用?C++ debug_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_printf函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _normalize_path
static size_t G_GNUC_MGET_NONNULL_ALL _normalize_path(char *path)
{
char *p1 = path, *p2 = path;
debug_printf("path %s ->\n", path);
// skip ./ and ../ at the beginning of the path
for (;;) {
if (*p2 == '/')
p2++;
else if (*p2 == '.') {
if (p2[1] == '/')
p2 += 2;
else if (p2[1] == '.') {
if (p2[2] == '/')
p2 += 3;
else if (!p2[2])
p2 += 2;
else
break;
}
else if (!p2[1])
p2++;
else
break;
} else
break;
}
// normalize path but stop at query or fragment
while (*p2 && *p2 != '?' && *p2 != '#') {
if (*p2 == '/') {
if (p2[1] == '.') {
if (!strncmp(p2, "/../", 4)) {
// go one level up
p2 += 3;
while (p1 > path && *--p1 != '/');
} else if (!strcmp(p2, "/..")) {
p2 += 3;
while (p1 > path && *--p1 != '/');
if (p1 > path) *p1++='/';
} else if (!strncmp(p2, "/./", 3)) {
p2 += 2;
} else if (!strcmp(p2, "/.")) {
p2 += 2;
if (p1 > path) *p1++='/';
} else
*p1++ = *p2++;
} else if (p1 == path)
p2++; // avoid leading slash
else if (p2[1] == '/')
p2++; // double slash to single slash
else
*p1++ = *p2++;
} else
*p1++ = *p2++;
}
if (p1 != p2) {
while (*p2)
*p1++ = *p2++;
*p1 = 0;
}
debug_printf(" %s\n", path);
return p1 - path;
}
开发者ID:rockdaboot, 项目名称:mget, 代码行数:69, 代码来源:iri.c
示例2: fuse_vnop_getattr
/*
struct vnop_getattr_args {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
struct thread *a_td;
};
*/
static int
fuse_vnop_getattr(struct vop_getattr_args *ap)
{
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
struct ucred *cred = ap->a_cred;
struct thread *td = curthread;
struct fuse_vnode_data *fvdat = VTOFUD(vp);
int err = 0;
int dataflags;
struct fuse_dispatcher fdi;
FS_DEBUG2G("inode=%ju\n", (uintmax_t)VTOI(vp));
dataflags = fuse_get_mpdata(vnode_mount(vp))->dataflags;
/* Note that we are not bailing out on a dead file system just yet. */
if (!(dataflags & FSESS_INITED)) {
if (!vnode_isvroot(vp)) {
fdata_set_dead(fuse_get_mpdata(vnode_mount(vp)));
err = ENOTCONN;
debug_printf("fuse_getattr b: returning ENOTCONN\n");
return err;
} else {
goto fake;
}
}
fdisp_init(&fdi, 0);
if ((err = fdisp_simple_putget_vp(&fdi, FUSE_GETATTR, vp, td, cred))) {
if ((err == ENOTCONN) && vnode_isvroot(vp)) {
/* see comment at similar place in fuse_statfs() */
fdisp_destroy(&fdi);
goto fake;
}
if (err == ENOENT) {
fuse_internal_vnode_disappear(vp);
}
goto out;
}
cache_attrs(vp, (struct fuse_attr_out *)fdi.answ);
if (vap != VTOVA(vp)) {
memcpy(vap, VTOVA(vp), sizeof(*vap));
}
if (vap->va_type != vnode_vtype(vp)) {
fuse_internal_vnode_disappear(vp);
err = ENOENT;
goto out;
}
if ((fvdat->flag & FN_SIZECHANGE) != 0)
vap->va_size = fvdat->filesize;
if (vnode_isreg(vp) && (fvdat->flag & FN_SIZECHANGE) == 0) {
/*
* This is for those cases when the file size changed without us
* knowing, and we want to catch up.
*/
off_t new_filesize = ((struct fuse_attr_out *)
fdi.answ)->attr.size;
if (fvdat->filesize != new_filesize) {
fuse_vnode_setsize(vp, cred, new_filesize);
}
}
debug_printf("fuse_getattr e: returning 0\n");
out:
fdisp_destroy(&fdi);
return err;
fake:
bzero(vap, sizeof(*vap));
vap->va_type = vnode_vtype(vp);
return 0;
}
开发者ID:2asoft, 项目名称:freebsd, 代码行数:85, 代码来源:fuse_vnops.c
示例3: st_bufferobj_data
//.........这里部分代码省略.........
case GL_PIXEL_PACK_BUFFER_ARB:
case GL_PIXEL_UNPACK_BUFFER_ARB:
bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
break;
case GL_ARRAY_BUFFER_ARB:
bind = PIPE_BIND_VERTEX_BUFFER;
break;
case GL_ELEMENT_ARRAY_BUFFER_ARB:
bind = PIPE_BIND_INDEX_BUFFER;
break;
case GL_TEXTURE_BUFFER:
bind = PIPE_BIND_SAMPLER_VIEW;
break;
case GL_TRANSFORM_FEEDBACK_BUFFER:
bind = PIPE_BIND_STREAM_OUTPUT;
break;
case GL_UNIFORM_BUFFER:
bind = PIPE_BIND_CONSTANT_BUFFER;
break;
case GL_DRAW_INDIRECT_BUFFER:
bind = PIPE_BIND_COMMAND_ARGS_BUFFER;
break;
default:
bind = 0;
}
/* Set usage. */
if (st_obj->Base.Immutable) {
/* BufferStorage */
if (storageFlags & GL_CLIENT_STORAGE_BIT)
pipe_usage = PIPE_USAGE_STAGING;
else
pipe_usage = PIPE_USAGE_DEFAULT;
}
else {
/* BufferData */
switch (usage) {
case GL_STATIC_DRAW:
case GL_STATIC_READ:
case GL_STATIC_COPY:
default:
pipe_usage = PIPE_USAGE_DEFAULT;
break;
case GL_DYNAMIC_DRAW:
case GL_DYNAMIC_READ:
case GL_DYNAMIC_COPY:
pipe_usage = PIPE_USAGE_DYNAMIC;
break;
case GL_STREAM_DRAW:
case GL_STREAM_READ:
case GL_STREAM_COPY:
pipe_usage = PIPE_USAGE_STREAM;
break;
}
}
/* Set flags. */
if (storageFlags & GL_MAP_PERSISTENT_BIT)
pipe_flags |= PIPE_RESOURCE_FLAG_MAP_PERSISTENT;
if (storageFlags & GL_MAP_COHERENT_BIT)
pipe_flags |= PIPE_RESOURCE_FLAG_MAP_COHERENT;
pipe_resource_reference( &st_obj->buffer, NULL );
if (ST_DEBUG & DEBUG_BUFFER) {
debug_printf("Create buffer size %" PRId64 " bind 0x%x\n",
(int64_t) size, bind);
}
if (size != 0) {
struct pipe_resource buffer;
memset(&buffer, 0, sizeof buffer);
buffer.target = PIPE_BUFFER;
buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
buffer.bind = bind;
buffer.usage = pipe_usage;
buffer.flags = pipe_flags;
buffer.width0 = size;
buffer.height0 = 1;
buffer.depth0 = 1;
buffer.array_size = 1;
st_obj->buffer = pipe->screen->resource_create(pipe->screen, &buffer);
if (!st_obj->buffer) {
/* out of memory */
st_obj->Base.Size = 0;
return GL_FALSE;
}
if (data)
pipe_buffer_write(pipe, st_obj->buffer, 0, size, data);
}
/* BufferData may change an array or uniform buffer, need to update it */
st->dirty.st |= ST_NEW_VERTEX_ARRAYS | ST_NEW_UNIFORM_BUFFER;
return GL_TRUE;
}
开发者ID:austriancoder, 项目名称:mesa-1, 代码行数:101, 代码来源:st_cb_bufferobjects.c
示例4: dmarc_write_history_file
int
dmarc_write_history_file()
{
int history_file_fd;
ssize_t written_len;
int tmp_ans;
u_char **rua; /* aggregate report addressees */
uschar *history_buffer = NULL;
if (!dmarc_history_file)
return DMARC_HIST_DISABLED;
history_file_fd = log_create(dmarc_history_file);
if (history_file_fd < 0)
{
log_write(0, LOG_MAIN|LOG_PANIC, "failure to create DMARC history file: %s",
dmarc_history_file);
return DMARC_HIST_FILE_ERR;
}
/* Generate the contents of the history file */
history_buffer = string_sprintf(
"job %s\nreporter %s\nreceived %ld\nipaddr %s\nfrom %s\nmfrom %s\n",
message_id, primary_hostname, time(NULL), sender_host_address,
header_from_sender, expand_string(US"$sender_address_domain"));
if (spf_response)
history_buffer = string_sprintf("%sspf %d\n", history_buffer, dmarc_spf_ares_result);
/* history_buffer = string_sprintf("%sspf -1\n", history_buffer); */
history_buffer = string_sprintf(
"%s%spdomain %s\npolicy %d\n",
history_buffer, dkim_history_buffer, dmarc_used_domain, dmarc_policy);
if ((rua = opendmarc_policy_fetch_rua(dmarc_pctx, NULL, 0, 1)))
for (tmp_ans = 0; rua[tmp_ans]; tmp_ans++)
history_buffer = string_sprintf("%srua %s\n", history_buffer, rua[tmp_ans]);
else
history_buffer = string_sprintf("%srua -\n", history_buffer);
opendmarc_policy_fetch_pct(dmarc_pctx, &tmp_ans);
history_buffer = string_sprintf("%spct %d\n", history_buffer, tmp_ans);
opendmarc_policy_fetch_adkim(dmarc_pctx, &tmp_ans);
history_buffer = string_sprintf("%sadkim %d\n", history_buffer, tmp_ans);
opendmarc_policy_fetch_aspf(dmarc_pctx, &tmp_ans);
history_buffer = string_sprintf("%saspf %d\n", history_buffer, tmp_ans);
opendmarc_policy_fetch_p(dmarc_pctx, &tmp_ans);
history_buffer = string_sprintf("%sp %d\n", history_buffer, tmp_ans);
opendmarc_policy_fetch_sp(dmarc_pctx, &tmp_ans);
history_buffer = string_sprintf("%ssp %d\n", history_buffer, tmp_ans);
history_buffer = string_sprintf(
"%salign_dkim %d\nalign_spf %d\naction %d\n",
history_buffer, da, sa, action);
/* Write the contents to the history file */
DEBUG(D_receive)
debug_printf("DMARC logging history data for opendmarc reporting%s\n",
(host_checking || running_in_test_harness) ? " (not really)" : "");
if (host_checking || running_in_test_harness)
{
DEBUG(D_receive)
debug_printf("DMARC history data for debugging:\n%s", history_buffer);
}
else
{
written_len = write_to_fd_buf(history_file_fd,
history_buffer,
Ustrlen(history_buffer));
if (written_len == 0)
{
log_write(0, LOG_MAIN|LOG_PANIC, "failure to write to DMARC history file: %s",
dmarc_history_file);
return DMARC_HIST_WRITE_ERR;
}
(void)close(history_file_fd);
}
return DMARC_HIST_OK;
}
开发者ID:Chaohua, 项目名称:exim, 代码行数:83, 代码来源:dmarc.c
示例5: fuse_vnop_setattr
//.........这里部分代码省略.........
facp.xuid = vap->va_uid;
facp.xgid = vap->va_gid;
if (vap->va_uid != (uid_t)VNOVAL) {
facp.facc_flags |= FACCESS_CHOWN;
fsai->uid = vap->va_uid;
fsai->valid |= FATTR_UID;
}
if (vap->va_gid != (gid_t)VNOVAL) {
facp.facc_flags |= FACCESS_CHOWN;
fsai->gid = vap->va_gid;
fsai->valid |= FATTR_GID;
}
if (vap->va_size != VNOVAL) {
struct fuse_filehandle *fufh = NULL;
/*Truncate to a new value. */
fsai->size = vap->va_size;
sizechanged = 1;
newsize = vap->va_size;
fsai->valid |= FATTR_SIZE;
fuse_filehandle_getrw(vp, FUFH_WRONLY, &fufh);
if (fufh) {
fsai->fh = fufh->fh_id;
fsai->valid |= FATTR_FH;
}
}
if (vap->va_atime.tv_sec != VNOVAL) {
fsai->atime = vap->va_atime.tv_sec;
fsai->atimensec = vap->va_atime.tv_nsec;
fsai->valid |= FATTR_ATIME;
}
if (vap->va_mtime.tv_sec != VNOVAL) {
fsai->mtime = vap->va_mtime.tv_sec;
fsai->mtimensec = vap->va_mtime.tv_nsec;
fsai->valid |= FATTR_MTIME;
}
if (vap->va_mode != (mode_t)VNOVAL) {
fsai->mode = vap->va_mode & ALLPERMS;
fsai->valid |= FATTR_MODE;
}
if (!fsai->valid) {
goto out;
}
vtyp = vnode_vtype(vp);
if (fsai->valid & FATTR_SIZE && vtyp == VDIR) {
err = EISDIR;
goto out;
}
if (vfs_isrdonly(vnode_mount(vp)) && (fsai->valid & ~FATTR_SIZE || vtyp == VREG)) {
err = EROFS;
goto out;
}
if (fsai->valid & ~FATTR_SIZE) {
/*err = fuse_internal_access(vp, VADMIN, context, &facp); */
/*XXX */
err = 0;
}
facp.facc_flags &= ~FACCESS_XQUERIES;
if (err && !(fsai->valid & ~(FATTR_ATIME | FATTR_MTIME)) &&
vap->va_vaflags & VA_UTIMES_NULL) {
err = fuse_internal_access(vp, VWRITE, &facp, td, cred);
}
if (err)
goto out;
if ((err = fdisp_wait_answ(&fdi)))
goto out;
vtyp = IFTOVT(((struct fuse_attr_out *)fdi.answ)->attr.mode);
if (vnode_vtype(vp) != vtyp) {
if (vnode_vtype(vp) == VNON && vtyp != VNON) {
debug_printf("FUSE: Dang! vnode_vtype is VNON and vtype isn't.\n");
} else {
/*
* STALE vnode, ditch
*
* The vnode has changed its type "behind our back". There's
* nothing really we can do, so let us just force an internal
* revocation and tell the caller to try again, if interested.
*/
fuse_internal_vnode_disappear(vp);
err = EAGAIN;
}
}
if (!err && !sizechanged) {
cache_attrs(vp, (struct fuse_attr_out *)fdi.answ);
}
out:
fdisp_destroy(&fdi);
if (!err && sizechanged) {
fuse_vnode_setsize(vp, cred, newsize);
VTOFUD(vp)->flag &= ~FN_SIZECHANGE;
}
return err;
}
开发者ID:2asoft, 项目名称:freebsd, 代码行数:101, 代码来源:fuse_vnops.c
示例6: mpd_playlist_queue_commit
int mpd_playlist_queue_commit(MpdObj *mi)
{
if(!mpd_check_connected(mi))
{
debug_printf(DEBUG_WARNING,"not connected\n");
return MPD_NOT_CONNECTED;
}
if(mi->queue == NULL)
{
debug_printf(DEBUG_WARNING,"mi->queue is empty");
return MPD_PLAYLIST_QUEUE_EMPTY;
}
if(mpd_lock_conn(mi))
{
debug_printf(DEBUG_WARNING,"lock failed\n");
return MPD_LOCK_FAILED;
}
mpd_sendCommandListBegin(mi->connection);
/* get first item */
mi->queue = mi->queue->first;
while(mi->queue != NULL)
{
if(mi->queue->type == MPD_QUEUE_ADD)
{
if(mi->queue->path != NULL)
{
mpd_sendAddCommand(mi->connection, mi->queue->path);
}
}
else if(mi->queue->type == MPD_QUEUE_LOAD)
{
if(mi->queue->path != NULL)
{
mpd_sendLoadCommand(mi->connection, mi->queue->path);
}
}
else if (mi->queue->type == MPD_QUEUE_DELETE_ID)
{
if(mi->queue->id >= 0)
{
mpd_sendDeleteIdCommand(mi->connection, mi->queue->id);
}
}
else if (mi->queue->type == MPD_QUEUE_DELETE_POS)
{
if(mi->queue->id >= 0)
{
mpd_sendDeleteCommand(mi->connection, mi->queue->id);
}
}
mpd_queue_get_next(mi);
}
mpd_sendCommandListEnd(mi->connection);
mpd_finishCommand(mi->connection);
mpd_unlock_conn(mi);
mpd_status_update(mi);
return MPD_OK;
}
开发者ID:DaveDavenport, 项目名称:libmpd, 代码行数:62, 代码来源:libmpd-playlist.c
示例7: softpipe_get_param
//.........这里部分代码省略.........
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
return 1;
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
return 256; /* for GL3 */
case PIPE_CAP_MIN_TEXEL_OFFSET:
return -8;
case PIPE_CAP_MAX_TEXEL_OFFSET:
return 7;
case PIPE_CAP_CONDITIONAL_RENDER:
return 1;
case PIPE_CAP_TEXTURE_BARRIER:
return 0;
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: /* draw module */
case PIPE_CAP_VERTEX_COLOR_CLAMPED: /* draw module */
return 1;
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
return 0;
case PIPE_CAP_GLSL_FEATURE_LEVEL:
return 330;
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
return 0;
case PIPE_CAP_COMPUTE:
return 0;
case PIPE_CAP_USER_VERTEX_BUFFERS:
case PIPE_CAP_USER_INDEX_BUFFERS:
case PIPE_CAP_USER_CONSTANT_BUFFERS:
case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
return 1;
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
return 16;
case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_TEXTURE_MULTISAMPLE:
return 0;
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
return 64;
case PIPE_CAP_QUERY_TIMESTAMP:
case PIPE_CAP_CUBE_MAP_ARRAY:
return 1;
case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
return 1;
case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
return 65536;
case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
return 0;
case PIPE_CAP_TGSI_TEXCOORD:
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
return 0;
case PIPE_CAP_MAX_VIEWPORTS:
return 1;
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_NATIVE;
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
case PIPE_CAP_TEXTURE_GATHER_SM5:
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
case PIPE_CAP_TEXTURE_QUERY_LOD:
case PIPE_CAP_SAMPLE_SHADING:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
case PIPE_CAP_SAMPLER_VIEW_TARGET:
return 0;
case PIPE_CAP_FAKE_SW_MSAA:
return 1;
case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET:
case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET:
return 0;
case PIPE_CAP_DRAW_INDIRECT:
return 1;
case PIPE_CAP_VENDOR_ID:
return 0xFFFFFFFF;
case PIPE_CAP_DEVICE_ID:
return 0xFFFFFFFF;
case PIPE_CAP_ACCELERATED:
return 0;
case PIPE_CAP_VIDEO_MEMORY: {
/* XXX: Do we want to return the full amount fo system memory ? */
uint64_t system_memory;
if (!os_get_total_physical_memory(&system_memory))
return 0;
return (int)(system_memory >> 20);
}
case PIPE_CAP_UMA:
return 0;
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
return 1;
case PIPE_CAP_CLIP_HALFZ:
return 1;
}
/* should only get here on unhandled cases */
debug_printf("Unexpected PIPE_CAP %d query\n", param);
return 0;
}
开发者ID:juhapekka, 项目名称:juha_mesaexperimentals, 代码行数:101, 代码来源:sp_screen.c
示例8: test_memset_s
int test_memset_s (void)
{
errno_t rc;
uint32_t len;
uint32_t i;
uint8_t value;
/*--------------------------------------------------*/
value = 34;
rc = memset_s(NULL, LEN, value);
if (rc != ESNULLP) {
debug_printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc);
}
/*--------------------------------------------------*/
value = 34;
rc = memset_s(mem1, 0, value);
if (rc != ESZEROL) {
debug_printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc);
}
/*--------------------------------------------------*/
for (i=0; i<LEN; i++) { mem1[i] = 99; }
len = 1;
value = 34;
rc = memset_s(mem1, len, value);
if (rc != EOK) {
debug_printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc);
}
for (i=0; i<len; i++) {
if (mem1[i] != value) {
printf("%d - %d m1=%d \n",
__LINE__, i, mem1[i]);
}
}
/*--------------------------------------------------*/
for (i=0; i<LEN; i++) { mem1[i] = 99; }
len = 2;
value = 34;
rc = memset_s(mem1, len, value);
if (rc != EOK) {
debug_printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc);
}
for (i=0; i<len; i++) {
if (mem1[i] != value) {
printf("%d - %d m1=%d \n",
__LINE__, i, mem1[i]);
}
}
/*--------------------------------------------------*/
for (i=0; i<LEN; i++) { mem1[i] = 99; }
len = 12;
value = 34;
rc = memset_s(mem1, len, value);
if (rc != EOK) {
debug_printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc);
}
for (i=0; i<len; i++) {
if (mem1[i] != value) {
printf("%d - %d m1=%d \n",
__LINE__, i, mem1[i]);
}
}
/*--------------------------------------------------*/
for (i=0; i<LEN; i++) { mem1[i] = 99; }
len = 31;
value = 34;
rc = memset_s(mem1, len, value);
if (rc != EOK) {
debug_printf("%s %u Error rc=%u \n",
__FUNCTION__, __LINE__, rc);
}
//.........这里部分代码省略.........
开发者ID:01org, 项目名称:safestringlib, 代码行数:101, 代码来源:test_memset_s.c
示例9: emit_const_range
/*
* Check and emit a range of shader constant registers, trying to coalesce
* successive shader constant updates in a single command in order to save
* space on the command buffer. This is a HWv8 feature.
*/
static enum pipe_error
emit_const_range(struct svga_context *svga,
unsigned shader,
unsigned offset,
unsigned count,
const float (*values)[4])
{
unsigned i, j;
enum pipe_error ret;
assert(shader == PIPE_SHADER_VERTEX ||
shader == PIPE_SHADER_FRAGMENT);
assert(!svga_have_vgpu10(svga));
#ifdef DEBUG
if (offset + count > SVGA3D_CONSTREG_MAX) {
debug_printf("svga: too many constants (offset %u + count %u = %u (max = %u))\n",
offset, count, offset + count, SVGA3D_CONSTREG_MAX);
}
#endif
if (offset > SVGA3D_CONSTREG_MAX) {
/* This isn't OK, but if we propagate an error all the way up we'll
* just get into more trouble.
* XXX note that offset is always zero at this time so this is moot.
*/
return PIPE_OK;
}
if (offset + count > SVGA3D_CONSTREG_MAX) {
/* Just drop the extra constants for now.
* Ideally we should not have allowed the app to create a shader
* that exceeds our constant buffer size but there's no way to
* express that in gallium at this time.
*/
count = SVGA3D_CONSTREG_MAX - offset;
}
i = 0;
while (i < count) {
if (memcmp(svga->state.hw_draw.cb[shader][offset + i],
values[i],
4 * sizeof(float)) != 0) {
/* Found one dirty constant
*/
if (SVGA_DEBUG & DEBUG_CONSTS)
debug_printf("%s %s %d: %f %f %f %f\n",
__FUNCTION__,
shader == PIPE_SHADER_VERTEX ? "VERT" : "FRAG",
offset + i,
values[i][0],
values[i][1],
values[i][2],
values[i][3]);
/* Look for more consecutive dirty constants.
*/
j = i + 1;
while (j < count &&
j < i + MAX_CONST_REG_COUNT &&
memcmp(svga->state.hw_draw.cb[shader][offset + j],
values[j],
4 * sizeof(float)) != 0) {
if (SVGA_DEBUG & DEBUG_CONSTS)
debug_printf("%s %s %d: %f %f %f %f\n",
__FUNCTION__,
shader == PIPE_SHADER_VERTEX ? "VERT" : "FRAG",
offset + j,
values[j][0],
values[j][1],
values[j][2],
values[j][3]);
++j;
}
assert(j >= i + 1);
/* Send them all together.
*/
if (svga_have_gb_objects(svga)) {
ret = SVGA3D_SetGBShaderConstsInline(svga->swc,
offset + i, /* start */
j - i, /* count */
svga_shader_type(shader),
SVGA3D_CONST_TYPE_FLOAT,
values + i);
}
else {
ret = SVGA3D_SetShaderConsts(svga->swc,
offset + i, j - i,
svga_shader_type(shader),
SVGA3D_CONST_TYPE_FLOAT,
values + i);
//.........这里部分代码省略.........
开发者ID:krnowak, 项目名称:mesa, 代码行数:101, 代码来源:svga_state_constants.c
示例10: ExaPrepareCopy
static Bool
ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
int ydir, int alu, Pixel planeMask)
{
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa;
struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
struct exa_pixmap_priv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap);
#if DEBUG_PRINT
debug_printf("ExaPrepareCopy\n");
#endif
if (!exa->accel)
return FALSE;
if (!exa->pipe)
XORG_FALLBACK("accle not enabled");
if (!priv || !priv->tex)
XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");
if (!src_priv || !src_priv->tex)
XORG_FALLBACK("pSrc %s", !src_priv ? "!priv" : "!priv->tex");
if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask))
XORG_FALLBACK("planeMask is not solid");
if (alu != GXcopy)
XORG_FALLBACK("alu not GXcopy");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format));
if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
src_priv->tex->target,
PIPE_TEXTURE_USAGE_SAMPLER, 0))
XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format));
exa->copy.src = src_priv;
exa->copy.dst = priv;
/* For same-surface copies, the pipe->surface_copy path is clearly
* superior, providing it is implemented. In other cases it's not
* clear what the better path would be, and eventually we'd
* probably want to gather timings and choose dynamically.
*/
if (exa->pipe->surface_copy &&
exa->copy.src == exa->copy.dst) {
exa->copy.use_surface_copy = TRUE;
exa->copy.src_surface =
exa->scrn->get_tex_surface( exa->scrn,
exa->copy.src->tex,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_READ);
exa->copy.dst_surface =
exa->scrn->get_tex_surface( exa->scrn,
exa->copy.dst->tex,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE );
}
else {
exa->copy.use_surface_copy = FALSE;
if (exa->copy.dst == exa->copy.src)
exa->copy.src_texture = renderer_clone_texture( exa->renderer,
exa->copy.src->tex );
else
pipe_texture_reference(&exa->copy.src_texture,
exa->copy.src->tex);
exa->copy.dst_surface =
exa->scrn->get_tex_surface(exa->scrn,
exa->copy.dst->tex,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
renderer_copy_prepare(exa->renderer,
exa->copy.dst_surface,
exa->copy.src_texture );
}
return TRUE;
}
开发者ID:CPFDSoftware-Tony, 项目名称:gmv, 代码行数:92, 代码来源:xorg_exa.c
示例11: ExaPrepareComposite
static Bool
ExaPrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa;
struct exa_pixmap_priv *priv;
if (!exa->accel)
return FALSE;
#if DEBUG_PRINT
debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n",
op, pSrcPicture, pMaskPicture, pDstPicture);
debug_printf("\tFormats: src(%s), mask(%s), dst(%s)\n",
pSrcPicture ? render_format_name(pSrcPicture->format) : "none",
pMaskPicture ? render_format_name(pMaskPicture->format) : "none",
pDstPicture ? render_format_name(pDstPicture->format) : "none");
#endif
if (!exa->pipe)
XORG_FALLBACK("accle not enabled");
priv = exaGetPixmapDriverPrivate(pDst);
if (!priv || !priv->tex)
XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format));
if (priv->picture_format != pDstPicture->format)
XORG_FALLBACK("pDst pic_format: %s != %s",
render_format_name(priv->picture_format),
render_format_name(pDstPicture->format));
if (pSrc) {
priv = exaGetPixmapDriverPrivate(pSrc);
if (!priv || !priv->tex)
XORG_FALLBACK("pSrc %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target,
PIPE_TEXTURE_USAGE_SAMPLER, 0))
XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format));
if (!picture_check_formats(priv, pSrcPicture))
XORG_FALLBACK("pSrc pic_format: %s != %s",
render_format_name(priv->picture_format),
render_format_name(pSrcPicture->format));
}
if (pMask) {
priv = exaGetPixmapDriverPrivate(pMask);
if (!priv || !priv->tex)
XORG_FALLBACK("pMask %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target,
PIPE_TEXTURE_USAGE_SAMPLER, 0))
XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format));
if (!picture_check_formats(priv, pMaskPicture))
XORG_FALLBACK("pMask pic_format: %s != %s",
render_format_name(priv->picture_format),
render_format_name(pMaskPicture->format));
}
return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
pDstPicture,
pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL,
pMask ? exaGetPixmapDriverPrivate(pMask) : NULL,
exaGetPixmapDriverPrivate(pDst));
}
开发者ID:CPFDSoftware-Tony, 项目名称:gmv, 代码行数:77, 代码来源:xorg_exa.c
示例12: perform_ibase_search
static int
perform_ibase_search(uschar * query, uschar * server, uschar ** resultptr,
uschar ** errmsg, BOOL * defer_break)
{
isc_stmt_handle stmth = NULL;
XSQLDA *out_sqlda;
XSQLVAR *var;
char buffer[256];
ISC_STATUS status[20], *statusp = status;
int i;
int ssize = 0;
int offset = 0;
int yield = DEFER;
uschar *result = NULL;
ibase_connection *cn;
uschar *server_copy = NULL;
uschar *sdata[3];
/* Disaggregate the parameters from the server argument. The order is host,
database, user, password. We can write to the string, since it is in a
nextinlist temporary buffer. The copy of the string that is used for caching
has the password removed. This copy is also used for debugging output. */
for (i = 2; i > 0; i--) {
uschar *pp = Ustrrchr(server, '|');
if (pp == NULL) {
*errmsg =
string_sprintf("incomplete Interbase server data: %s",
(i == 3) ? server : server_copy);
*defer_break = TRUE;
return DEFER;
}
*pp++ = 0;
sdata[i] = pp;
if (i == 2)
server_copy = string_copy(server); /* sans password */
}
sdata[0] = server; /* What's left at the start */
/* See if we have a cached connection to the server */
for (cn = ibase_connections; cn != NULL; cn = cn->next) {
if (Ustrcmp(cn->server, server_copy) == 0) {
break;
}
}
/* Use a previously cached connection ? */
if (cn != NULL) {
static char db_info_options[] = { isc_info_base_level };
/* test if the connection is alive */
if (isc_database_info
(status, &cn->dbh, sizeof(db_info_options), db_info_options,
sizeof(buffer), buffer)) {
/* error occurred: assume connection is down */
DEBUG(D_lookup)
debug_printf
("Interbase cleaning up cached connection: %s\n",
cn->server);
isc_detach_database(status, &cn->dbh);
} else {
DEBUG(D_lookup)
debug_printf("Interbase using cached connection for %s\n",
server_copy);
}
} else {
cn = store_get(sizeof(ibase_connection));
cn->server = server_copy;
cn->dbh = NULL;
cn->transh = NULL;
cn->next = ibase_connections;
ibase_connections = cn;
}
/* If no cached connection, we must set one up. */
if (cn->dbh == NULL || cn->transh == NULL) {
char *dpb, *p;
short dpb_length;
static char trans_options[] =
{ isc_tpb_version3, isc_tpb_read, isc_tpb_read_committed,
isc_tpb_rec_version
};
/* Construct the database parameter buffer. */
dpb = buffer;
*dpb++ = isc_dpb_version1;
*dpb++ = isc_dpb_user_name;
*dpb++ = strlen(sdata[1]);
for (p = sdata[1]; *p;)
*dpb++ = *p++;
*dpb++ = isc_dpb_password;
*dpb++ = strlen(sdata[2]);
for (p = sdata[2]; *p;)
*dpb++ = *p++;
//.........这里部分代码省略.........
开发者ID:akissa, 项目名称:exim, 代码行数:101, 代码来源:ibase.c
示例13: show_prop
int
show_prop(property *prop)
{
char *buf;
char *head, *tail;
char *p[6] = {0};
char *indication_id = NULL, *iconic_label =NULL, *label_string = NULL;
int check_leaf = 0;
/* output new prop_list for Emacs */
if (prop->list == NULL) {
debug_printf(DEBUG_ERROR, "no prop_list\n");
a_printf(" ( e ) ");
return 0;
}
a_printf(" ( l ");
head = buf = uim_strdup(prop->list);
#define PART_BRANCH "branch"
#define PART_LEAF "leaf"
#define ACTION_ID_IMSW "action_imsw_"
while (head && *head) {
/*
* head: beginning of each line
* tail: end of each line
* p[n]: token
*/
tail = strchr(head, '\n');
if (tail)
*tail = '\0';
else
break;
/* head always not equal NULL */
if (strlen(head) >= strlen(PART_BRANCH)
&& strncmp(head, PART_BRANCH, strlen(PART_BRANCH)) == 0) {
if ((p[0] = strchr(head, '\t'))
&& (p[1] = strchr(p[0] + 1, '\t'))
&& (p[2] = strchr(p[1] + 1, '\t'))) {
*p[0] = *p[1] = *p[2] = '\0';
indication_id = p[0] + 1;
iconic_label = p[1] + 1;
label_string = p[2] + 1;
check_leaf = 1; /* check next leaf */
/*a_printf(" ( \"%s\" \"%s\" \"%s\" ) ", p[0] + 1, p[1] + 1, p[2] + 1);*/
}
} else if (strlen(head) >= strlen(PART_LEAF)
&& strncmp(head, PART_LEAF, strlen(PART_LEAF)) == 0) {
if (check_leaf && indication_id && iconic_label && label_string) {
check_leaf = 0;
/* im_switcher detection */
if ((p[0] = strchr(head, '\t'))
&& (p[1] = strchr(p[0] + 1, '\t'))
&& (p[2] = strchr(p[1] + 1, '\t'))
&& (p[3] = strchr(p[2] + 1, '\t'))
&& (p[4] = strchr(p[3] + 1, '\t'))
&& (p[5] = strchr(p[4] + 1, '\t')))
*p[0] = *p[1] = *p[2] = *p[3] = *p[4] = *p[5] = '\0';
if (strlen(p[4] + 1) >= strlen(ACTION_ID_IMSW)
&& strncmp(p[4] + 1, ACTION_ID_IMSW, strlen(ACTION_ID_IMSW)) == 0)
a_printf(" ( \"im-name\" \"%s\" \"%s\" \"%s\" ) ",
indication_id, iconic_label, label_string);
else
a_printf(" ( \"im-mode\" \"%s\" \"%s\" \"%s\" ) ",
indication_id, iconic_label, label_string);
}
}
head = tail + 1;
}
free(buf);
a_printf(" ) ");
return 1;
#undef PART_BRANCH
#undef PART_LEAF
#undef ACTION_ID_IMSW
}
开发者ID:DirtYiCE, 项目名称:uim, 代码行数:88, 代码来源:prop.c
示例14: debug_printf
//char *iri_relative_to_absolute(IRI *iri, const char *tag, const char *val, size_t len, char *dst, size_t dst_size)
const char *mget_iri_relative_to_abs(mget_iri_t *base, const char *val, size_t len, mget_buffer_t *buf)
{
debug_printf("*url = %.*s\n", (int)len, val);
if (*val == '/') {
if (base) {
char path[len + 1];
// strlcpy or snprintf are ineffective here since they do strlen(val), which might be large
memcpy(path, val, len);
path[len] = 0;
if (len >= 2 && val[1] == '/') {
char *p;
// absolute URI without scheme: //authority/path...
if ((p = strchr(path + 2, '/')))
_normalize_path(p + 1);
mget_buffer_strcpy(buf, base->scheme);
mget_buffer_strcat(buf, ":");
mget_buffer_strcat(buf, path);
debug_printf("*1 %s\n", buf->data);
} else {
// absolute path
_normalize_path(path);
mget_buffer_strcpy(buf, mget_iri_get_connection_part(base));
mget_buffer_strcat(buf, "/");
mget_buffer_strcat(buf, path);
debug_printf("*2 %s\n", buf->data);
}
} else
return NULL;
} else {
// see if URI begins with a scheme:
if (memchr(val, ':', len)) {
// absolute URI
if (buf) {
mget_buffer_memcpy(buf, val, len);
debug_printf("*3 %s\n", buf->data);
} else {
debug_printf("*3 %s\n", val);
return val;
}
} else if (base) {
// relative path
const char *lastsep = base->path ? strrchr(base->path, '/') : NULL;
mget_buffer_strcpy(buf, mget_iri_get_connection_part(base));
mget_buffer_strcat(buf, "/");
size_t tmp_len = buf->length;
if (lastsep)
mget_buffer_memcat(buf, base->path, lastsep - base->path + 1);
if (len)
mget_buffer_memcat(buf, val, len);
buf->length = _normalize_path(buf->data + tmp_len) + tmp_len;
debug_printf("*4 %s %zu\n", buf->data, buf->length);
} else if (val[len] == 0) {
return val;
} else
return NULL;
}
return buf->data;
}
开发者ID:rockdaboot, 项目名称:mget, 代码行数:71, 代码来源:iri.c
示例15: add_network
void add_network(char *essid, char *ascii_password)
{
debug_printf(2, "%s('%s', '%s')\n", __func__, essid, ascii_password);
network_action('a', essid, ascii_password);
}
开发者ID:palmer-dabbelt, 项目名称:eyefi-config, 代码行数:5, 代码来源:eyefi-config.c
示例16: eximsrs_init
int eximsrs_init()
{
uschar *list = srs_config;
uschar secret_buf[SRS_MAX_SECRET_LENGTH];
uschar *secret = NULL;
uschar sbuf[4];
uschar *sbufp;
/* Check if this instance of Exim has not initialized SRS */
if(srs == NULL)
{
int co = 0;
int hashlen, maxage;
BOOL usetimestamp, usehash;
/* Copy config vars */
hashlen = srs_hashlength;
maxage = srs_maxage;
usetimestamp = srs_usetimestamp;
usehash = srs_usehash;
/* Pass srs_config var (overrides new config vars) */
co = 0;
if(srs_config != NULL)
{
secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH);
if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
maxage = atoi(sbuf);
if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
hashlen = atoi(sbuf);
if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
usetimestamp = atoi(sbuf);
if((sbufp = string_nextinlist(&list, &co, sbuf, sizeof(sbuf))) != NULL)
usehash = atoi(sbuf);
}
if(srs_hashmin == -1)
srs_hashmin = hashlen;
/* First secret specified in secrets? */
co = 0;
list = srs_secrets;
if(secret == NULL || *secret == '\0')
{
if((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) == NULL)
{
log_write(0, LOG_MAIN | LOG_PANIC,
"SRS Configuration Error: No secret specified");
return DEFER;
}
}
/* Check config */
if(maxage < 0 || maxage > 365)
{
log_write(0, LOG_MAIN | LOG_PANIC,
"SRS Configuration Error: Invalid maximum timestamp age");
return DEFER;
}
if(hashlen < 1 || hashlen > 20 || srs_hashmin < 1 || srs_hashmin > 20)
{
log_write(0, LOG_MAIN | LOG_PANIC,
"SRS Configuration Error: Invalid hash length");
return DEFER;
}
if((srs = srs_open(secret, Ustrlen(secret), maxage, hashlen, srs_hashmin)) == NULL)
{
log_write(0, LOG_MAIN | LOG_PANIC,
"Failed to allocate SRS memory");
return DEFER;
}
srs_set_option(srs, SRS_OPTION_USETIMESTAMP, usetimestamp);
srs_set_option(srs, SRS_OPTION_USEHASH, usehash);
/* Extra secrets? */
while((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) != NULL)
srs_add_secret(srs, secret, (Ustrlen(secret) > SRS_MAX_SECRET_LENGTH) ? SRS_MAX_SECRET_LENGTH : Ustrlen(secret));
DEBUG(D_any)
debug_printf("SRS initialized\n");
}
return OK;
}
开发者ID:KMU-embedded, 项目名称:mosbench-ext, 代码行数:90, 代码来源:srs.c
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:19256| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:10007| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8335| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8703| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8650| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9677| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8636| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:8008| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8671| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7542| 2022-11-06
请发表评论