本文整理汇总了C++中FT_ERR函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_ERR函数的具体用法?C++ FT_ERR怎么用?C++ FT_ERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FT_ERR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getaddr
static int getaddr(char *node, char *service, void **addr,
size_t *len)
{
struct addrinfo *ai;
int ret;
if (!node) {
*addr = NULL;
*len = 0;
return 0;
}
ret = getaddrinfo(node, service, NULL, &ai);
if (ret) {
FT_ERR("getaddrinfo error %s\n", gai_strerror(ret));
return ret;
}
if ((*addr = malloc(ai->ai_addrlen))) {
memcpy(*addr, ai->ai_addr, ai->ai_addrlen);
*len = (size_t)ai->ai_addrlen;
} else {
FT_ERR("addr allocation failed\n");
ret = EAI_MEMORY;
}
freeaddrinfo(ai);
return ret;
}
示例2: check_address
static int check_address(struct fid *fid, const char *message)
{
char buf1[BUFSIZ], buf2[BUFSIZ];
union sockaddr_any tmp;
size_t tmplen;
const char *ep_addr, *addr_expected;
int ret;
memset(&tmp, 0, sizeof tmp);
tmplen = sizeof tmp;
ret = fi_getname(fid, &tmp, &tmplen);
if (ret) {
FT_PRINTERR("fi_getname", ret);
}
if (sockaddrcmp(&tmp, tmplen, &bound_addr, bound_addr_len)) {
ep_addr = sockaddrstr(&tmp, tmplen, buf1, BUFSIZ);
if (!ep_addr) {
FT_ERR("Unable to get ep_addr as string!\n");
return -FI_EINVAL;
}
addr_expected = sockaddrstr(&bound_addr, bound_addr_len, buf2, BUFSIZ);
if (!addr_expected) {
FT_ERR("Unable to get addr_expected as string!\n");
return -FI_EINVAL;
}
FT_ERR("address changed after %s: got %s expected %s\n",
message, ep_addr, addr_expected);
return -FI_EINVAL;
}
return 0;
}
示例3: server_listen
static int server_listen(size_t paramlen)
{
size_t expected;
uint32_t event;
int ret;
expected = paramlen + sizeof(*entry);
memset(entry, 0, expected);
ret = fi_eq_sread(eq, &event, entry, expected, -1, 0);
if (ret != expected) {
FT_PROCESS_EQ_ERR(ret, eq, "fi_eq_sread", "listen");
return ret;
}
if (event != FI_CONNREQ) {
FT_ERR("Unexpected CM event %d", event);
return -FI_EOTHER;
}
ret = ft_check_buf(entry->data, paramlen);
if (ret)
return ret;
fi = entry->info;
return 0;
}
示例4: pfr_get_advance
pfr_get_advance( FT_Face pfrface, /* PFR_Face */
FT_UInt gindex,
FT_Pos *anadvance )
{
PFR_Face face = (PFR_Face)pfrface;
FT_Error error = FT_ERR( Invalid_Argument );
*anadvance = 0;
if ( !gindex )
goto Exit;
gindex--;
if ( face )
{
PFR_PhyFont phys = &face->phy_font;
if ( gindex < phys->num_chars )
{
*anadvance = phys->chars[gindex].advance;
error = FT_Err_Ok;
}
}
Exit:
return error;
}
示例5: FT_Set_Var_Blend_Coordinates
FT_Set_Var_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
{
FT_Error error;
FT_Service_MultiMasters service;
/* check of `face' delayed to `ft_face_get_mm_service' */
if ( !coords )
return FT_THROW( Invalid_Argument );
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
if ( service->set_mm_blend )
error = service->set_mm_blend( face, num_coords, coords );
}
/* enforce recomputation of auto-hinting data */
if ( !error && face->autohint.finalizer )
{
face->autohint.finalizer( face->autohint.data );
face->autohint.data = NULL;
}
return error;
}
示例6: FT_Get_BDF_Charset_ID
FT_Get_BDF_Charset_ID( FT_Face face,
const char* *acharset_encoding,
const char* *acharset_registry )
{
FT_Error error;
const char* encoding = NULL;
const char* registry = NULL;
error = FT_ERR( Invalid_Argument );
if ( face )
{
FT_Service_BDF service;
FT_FACE_FIND_SERVICE( face, service, BDF );
if ( service && service->get_charset_id )
error = service->get_charset_id( face, &encoding, ®istry );
}
if ( acharset_encoding )
*acharset_encoding = encoding;
if ( acharset_registry )
*acharset_registry = registry;
return error;
}
示例7: FT_Get_CID_Registry_Ordering_Supplement
FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
const char* *registry,
const char* *ordering,
FT_Int *supplement)
{
FT_Error error;
const char* r = NULL;
const char* o = NULL;
FT_Int s = 0;
error = FT_ERR( Invalid_Argument );
if ( face )
{
FT_Service_CID service;
FT_FACE_FIND_SERVICE( face, service, CID );
if ( service && service->get_ros )
error = service->get_ros( face, &r, &o, &s );
}
if ( registry )
*registry = r;
if ( ordering )
*ordering = o;
if ( supplement )
*supplement = s;
return error;
}
示例8: ft_face_get_mm_service
static FT_Error
ft_face_get_mm_service( FT_Face face,
FT_Service_MultiMasters *aservice )
{
FT_Error error;
*aservice = NULL;
if ( !face )
return FT_THROW( Invalid_Face_Handle );
error = FT_ERR( Invalid_Argument );
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
{
FT_FACE_LOOKUP_SERVICE( face,
*aservice,
MULTI_MASTERS );
if ( *aservice )
error = FT_Err_Ok;
}
return error;
}
示例9: ft_post_rma
ssize_t ft_post_rma(enum ft_rma_opcodes op, struct fid_ep *ep, size_t size,
struct fi_rma_iov *remote, void *context)
{
switch (op) {
case FT_RMA_WRITE:
FT_POST(fi_write, ft_get_tx_comp, tx_seq, "fi_write", ep, tx_buf,
opts.transfer_size, fi_mr_desc(mr), remote_fi_addr,
remote->addr, remote->key, context);
break;
case FT_RMA_WRITEDATA:
FT_POST(fi_writedata, ft_get_tx_comp, tx_seq, "fi_writedata", ep,
tx_buf, opts.transfer_size, fi_mr_desc(mr),
remote_cq_data, remote_fi_addr, remote->addr,
remote->key, context);
break;
case FT_RMA_READ:
FT_POST(fi_read, ft_get_tx_comp, tx_seq, "fi_read", ep, rx_buf,
opts.transfer_size, fi_mr_desc(mr), remote_fi_addr,
remote->addr, remote->key, context);
break;
default:
FT_ERR("Unknown RMA op type\n");
return EXIT_FAILURE;
}
return 0;
}
示例10: tt_property_set
/*
* PROPERTY SERVICE
*
*/
static FT_Error
tt_property_set( FT_Module module, /* TT_Driver */
const char* property_name,
const void* value )
{
FT_Error error = FT_Err_Ok;
TT_Driver driver = (TT_Driver)module;
if ( !ft_strcmp( property_name, "interpreter-version" ) )
{
FT_UInt* interpreter_version = (FT_UInt*)value;
#ifndef TT_CONFIG_OPTION_SUBPIXEL_HINTING
if ( *interpreter_version != TT_INTERPRETER_VERSION_35 )
error = FT_ERR( Unimplemented_Feature );
else
#endif
driver->interpreter_version = *interpreter_version;
return error;
}
FT_TRACE0(( "tt_property_set: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
示例11: client_expect_accept
static int client_expect_accept(size_t paramlen)
{
size_t expected;
uint32_t event;
int ret;
expected = paramlen + sizeof(*entry);
ret = client_connect(paramlen);
if (ret) {
FT_PRINTERR("fi_connect", ret);
return ret;
}
ret = fi_eq_sread(eq, &event, entry, expected, -1, 0);
if (ret != expected) {
FT_PROCESS_EQ_ERR(ret, eq, "fi_eq_sread", "connect");
return ret;
}
if (event != FI_CONNECTED || entry->fid != &ep->fid) {
FT_ERR("Unexpected CM event %d fid %p (ep %p)", event,
entry->fid, ep);
return -FI_EOTHER;
}
/* Check data on FI_CONNECTED event. */
ret = ft_check_buf(entry->data, paramlen);
if (ret)
return ret;
fi_shutdown(ep, 0);
return read_shutdown_event();
}
示例12: tt_property_set
/*
* PROPERTY SERVICE
*
*/
static FT_Error
tt_property_set( FT_Module module, /* TT_Driver */
const char* property_name,
const void* value,
FT_Bool value_is_string )
{
FT_Error error = FT_Err_Ok;
TT_Driver driver = (TT_Driver)module;
#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
FT_UNUSED( value_is_string );
#endif
if ( !ft_strcmp( property_name, "interpreter-version" ) )
{
FT_UInt interpreter_version;
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
{
const char* s = (const char*)value;
interpreter_version = (FT_UInt)ft_strtol( s, NULL, 10 );
}
else
#endif
{
FT_UInt* iv = (FT_UInt*)value;
interpreter_version = *iv;
}
if ( interpreter_version == TT_INTERPRETER_VERSION_35
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|| interpreter_version == TT_INTERPRETER_VERSION_38
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|| interpreter_version == TT_INTERPRETER_VERSION_40
#endif
)
driver->interpreter_version = interpreter_version;
else
error = FT_ERR( Unimplemented_Feature );
return error;
}
FT_TRACE0(( "tt_property_set: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
示例13: dupaddr
static int dupaddr(void **dst_addr, size_t *dst_addrlen,
void *src_addr, size_t src_addrlen)
{
*dst_addr = malloc(src_addrlen);
if (!*dst_addr) {
FT_ERR("address allocation failed");
return EAI_MEMORY;
}
*dst_addrlen = src_addrlen;
memcpy(*dst_addr, src_addr, src_addrlen);
return 0;
}
示例14: FT_New_Face_From_FSSpec
FT_New_Face_From_FSSpec( FT_Library library,
const FSSpec* spec,
FT_Long face_index,
FT_Face* aface )
{
#if HAVE_FSREF
FSRef ref;
if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr )
return FT_THROW( Invalid_Argument );
else
return FT_New_Face_From_FSRef( library, &ref, face_index, aface );
#elif HAVE_FSSPEC
FT_Error error;
FT_Open_Args args;
OSErr err;
UInt8 pathname[PATH_MAX];
if ( !spec )
return FT_THROW( Invalid_Argument );
err = FT_FSpMakePath( spec, pathname, sizeof ( pathname ) );
if ( err )
error = FT_ERR( Cannot_Open_Resource );
error = FT_New_Face_From_Resource( library, pathname, face_index, aface );
if ( error || *aface )
return error;
/* fallback to datafork font */
args.flags = FT_OPEN_PATHNAME;
args.pathname = (char*)pathname;
return FT_Open_Face( library, &args, face_index, aface );
#else
FT_UNUSED( library );
FT_UNUSED( spec );
FT_UNUSED( face_index );
FT_UNUSED( aface );
return FT_THROW( Unimplemented_Feature );
#endif /* HAVE_FSREF, HAVE_FSSPEC */
}
示例15: ft_comp_x
static int ft_comp_x(struct fid_cq *cq, struct ft_xcontrol *ft_x,
const char *x_str, int timeout)
{
uint8_t buf[FT_COMP_BUF_SIZE];
struct timespec s, e;
int poll_time = 0;
int ret;
switch(test_info.cq_wait_obj) {
case FI_WAIT_NONE:
do {
if (!poll_time)
clock_gettime(CLOCK_MONOTONIC, &s);
ft_cq_read(fi_cq_read, cq, buf, comp_entry_cnt[ft_x->cq_format],
ft_x->credits, x_str, ret);
clock_gettime(CLOCK_MONOTONIC, &e);
poll_time = get_elapsed(&s, &e, MILLI);
} while (ret == -FI_EAGAIN && poll_time < timeout);
break;
case FI_WAIT_UNSPEC:
case FI_WAIT_FD:
case FI_WAIT_MUTEX_COND:
ft_cq_read(fi_cq_sread, cq, buf, comp_entry_cnt[ft_x->cq_format],
ft_x->credits, x_str, ret, NULL, timeout);
break;
case FI_WAIT_SET:
FT_ERR("fi_ubertest: Unsupported cq wait object");
return -1;
default:
FT_ERR("Unknown cq wait object");
return -1;
}
return (ret == -FI_EAGAIN && timeout) ? ret : 0;
}