当前位置: 首页>>代码示例>>C++>>正文


C++ HT_FREE函数代码示例

本文整理汇总了C++中HT_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ HT_FREE函数的具体用法?C++ HT_FREE怎么用?C++ HT_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了HT_FREE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HTMuxProtocol_delete

PUBLIC BOOL HTMuxProtocol_delete (HTMuxChannel * muxch, HTProtocolId pid)
{
    if (muxch && muxch->protocols) {
	HTList * cur = muxch->protocols;
	HTMuxProtocol * pres;
	while ((pres = (HTMuxProtocol *) HTList_nextObject(cur))) {
	    if (pres->pid == pid) {
		HTList_removeObject(muxch->protocols, pres);
		HT_FREE(pres);
		return YES;
	    }
	}
    }
    return NO;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:15,代码来源:HTMuxCh.c

示例2: HTRuleFilter

/*
**	Rule Translation BEFORE Filter
**	------------------------------
**	If we have a set of rules loaded (see the Rule manager) then check
**	before each request whether how that should be translated. The trick
**	is that a parent anchor has a "address" which is the part from the URL
**	we used when we created the anchor. However, it also have a "physical
**	address" which is the place we are actually going to look for the
**	resource. Hence this filter translates the physical address
**	(if any translations are found)
*/
PUBLIC int HTRuleFilter (HTRequest * request, void * param, int mode)
{
    HTList * list = HTRule_global();
    HTParentAnchor * anchor = HTRequest_anchor(request);
    char * addr = HTAnchor_physical(anchor);
    char * physical = HTRule_translate(list, addr, NO);
    if (!physical) {
	HTRequest_addError(request, ERR_FATAL, NO, HTERR_FORBIDDEN,
			   NULL, 0, "HTRuleFilter");
	return HT_ERROR;
    }
    HTAnchor_setPhysical(anchor, physical);
    HT_FREE(physical);
    return HT_OK;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:26,代码来源:HTFilter.c

示例3: HTextImp_delete

PUBLIC BOOL HTextImp_delete (HTextImp * me)
{
    if (me) {

	/*
	** Note that we do not call the delete method on the app
	** HText object as this normally stays around after the
	** request has been deleted and certainly it should be
	** deleted by the app and not libwww
	*/
	HT_FREE(me);
	return YES;
    }
    return NO;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:15,代码来源:HText.c

示例4: HTBind_getAnchorBindings

/*
**  Use the set of bindings to find the combination of language,
**  media type and encoding of a given object. This information can either be
**  stored in the anchor obejct or in the response object depending on which
**  function is called.
**
**  We comprise here as bindings only can have one language and one encoding.
**  If more than one suffix is found they are all searched. The last suffix
**  has highest priority, the first one lowest. See also HTBind_getFormat()
*/
PUBLIC BOOL HTBind_getAnchorBindings (HTParentAnchor * anchor)
{
    BOOL status = NO;
    double quality=1.0;		  /* @@@ Should we add this into the anchor? */
    if (anchor) {
	char *addr = HTAnchor_address((HTAnchor *) anchor);
	char *path = HTParse(addr, "", PARSE_PATH+PARSE_PUNCTUATION);
	char *file;
	char *end;
	if ((end = strchr(path, ';')) || (end = strchr(path, '?')) ||
	    (end = strchr(path, '#')))
	    *end = '\0';
	if ((file = strrchr(path, '/'))) {
	    HTFormat format = NULL;
	    HTEncoding encoding = NULL;
	    HTEncoding transfer = NULL;
	    HTLanguage language = NULL;
 	    HTTRACE(BIND_TRACE, "Anchor...... Get bindings for `%s\'\n" _ path);
	    status = HTBind_getFormat(file, &format, &encoding, &transfer,
				      &language, &quality);
	    if (status) {
		HTAnchor_setFormat(anchor, format);
		HTAnchor_setContentTransferEncoding(anchor, transfer);

                HTAnchor_deleteEncodingAll(anchor);
                HTAnchor_addEncoding(anchor, encoding);

                HTAnchor_deleteLanguageAll(anchor);
                HTAnchor_addLanguage(anchor, language);
	    }
	}
        HT_FREE(addr);
        HT_FREE(path);
    }
    return status;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:46,代码来源:HTBind.c

示例5: CSParse_put_block

PRIVATE int CSParse_put_block (HTStream * me, const char * b, int l)
{
    if (PICS_TRACE) {
        char * ptr;
        if ((ptr = (char *) HT_MALLOC(l+1)) == NULL)
            HT_OUTOFMEM("diagnostic buffer");
        strncpy(ptr, b, l);
        ptr[l] = 0;
        HTTRACE(PICS_TRACE, "PICS: parser %p parsing block \"%s\"\n" _ me->pCSParse _ ptr);
        HT_FREE(ptr);
    }
    if (CSParse_parseChunk(me->pCSParse, b, l, 0) == CSDoMore_error)
        return HT_ERROR;
    return HT_OK;
}
开发者ID:Rjoydip,项目名称:libwww,代码行数:15,代码来源:CSStream.c

示例6: HTAA_findElement

/*
**	Find AA Element
**	---------------
**	Seaches the set of authentication information bases for a match
**	In order to find an anode we do the following:
**
**		1) Find the right auth base
**		2) See if there is a realm match
**		3) See if there is a template match for URL
**
**	Return the node found else NULL which means that we don't have any
**	authentication information to hook on to this request or response
*/
PRIVATE HTAAElement * HTAA_findElement (BOOL proxy_access,
					const char * realm, const char * url)
{
    HTUTree * tree;
    if (!url) {
	HTTRACE(AUTH_TRACE, "Auth Engine. Bad argument\n");
	return NULL;
    }
    HTTRACE(AUTH_TRACE, "Auth Engine. Looking up `%s'\n" _ url);

    /* Find an existing URL Tree for this URL (if any) */
    {
	char * host = HTParse(url, "", PARSE_HOST);
	char * colon = strchr(host, ':');
	int port = DEFAULT_PORT;
	if (colon ) {
	    *(colon++) = '\0';			     /* Chop off port number */
	    port = atoi(colon);
	}	
	tree = HTUTree_find(proxy_access ? AA_PROXY_TREE : AA_TREE, host,port);
	HT_FREE(host);
	if (!tree) {
	    HTTRACE(AUTH_TRACE, "Auth Engine. No information\n");
	    return NULL;
	}
    }

    /* Find a matching AA element (if any) */
    {
	char * path = HTParse(url, "", PARSE_PATH | PARSE_PUNCTUATION);
	HTAAElement *element = (HTAAElement*)HTUTree_findNode(tree,realm,path);
	HT_FREE(path);
	return element;
    }
    return NULL;
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:49,代码来源:HTAAUtil.c

示例7: HTTmpAnchor

/*
**	Creates a temporary anchor that doesn't exist
*/
PUBLIC HTParentAnchor * HTTmpAnchor (HTUserProfile * up)
{
    static int offset = 0;			    /* Just keep counting... */
    HTParentAnchor * htpa = NULL;
    time_t t = time(NULL);
    char * tmpfile = HTGetTmpFileName(HTUserProfile_tmp(up));
    char * tmpurl = HTParse(tmpfile, "file:", PARSE_ALL);
    if (tmpfile && tmpurl && t >= 0) {
	char * result;
	if (!(result = (char *) HT_MALLOC(strlen(tmpurl)+20)))
	    HT_OUTOFMEM("HTTmpAnchor");
#ifdef HAVE_LONG_TIME_T
	sprintf(result, "%s.%ld.%d", tmpurl, t, offset++);
#else
	sprintf(result, "%s.%d.%d", tmpurl, t, offset++);
#endif
	HTTRACE(APP_TRACE, "Tmp Anchor.. With location `%s\'\n" _ result);
	htpa = HTAnchor_parent(HTAnchor_findAddress(result));
	HT_FREE(result);
    }
    HT_FREE(tmpfile);
    HT_FREE(tmpurl);
    return htpa;
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:27,代码来源:HTHome.c

示例8: HTNewsCache_update

PRIVATE BOOL HTNewsCache_update (HTRequest * request,
				 const char * url, HTArray * array)
{
    HTUTree * tree = NULL;
    if (request && url) {
	char * newshost = NULL;
	if (!strncasecomp(url, "news:", 5)) {
	    HTUserProfile * up = HTRequest_userProfile(request);
	    StrAllocCopy(newshost, HTUserProfile_news(up));
	} else if (!strncasecomp(url, "nntp:", 5)) {
	    newshost = HTParse(url, "", PARSE_HOST);
	}

	/* 
	**  If the news server was found then update the data entry. Otherwise
	**  create a new entry
	*/
	if (newshost) {
	    char * colon = strchr(newshost, ':');
	    int port = NEWS_PORT;
	    if (colon ) {
		*(colon++) = '\0';		     /* Chop off port number */
		port = atoi(colon);
	    }
	    tree = HTUTree_new(NEWS_TREE, newshost, port, HTNewsCache_delete);
	    HT_FREE(newshost);
	    if (!tree) {
		HTTRACE(PROT_TRACE, "News Cache.. Can't create tree\n");
		return NO;
	    }

	    /* Add new cache information to the tree */
	    {
		HTNewsCache * element = NULL;
		BOOL status;
		if ((element=(HTNewsCache *) HTUTree_findNode(tree, "", "/"))){
		    element->cache = array;
		    status = YES;
		} else {
		    element = HTNewsCache_new(url, array);
		    status = HTUTree_addNode(tree, "", "/", element);
		}
		return status;
	    }
	}
    }
    return NO;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:48,代码来源:HTNewsLs.c

示例9: HTInfoFilter

/*
**	Error and Information AFTER filter
**	----------------------------------
**	It checks the status code from a request and generates an 
**	error/information message if required.
*/
PUBLIC int HTInfoFilter (HTRequest * request, HTResponse * response,
			 void * param, int status)
{
    HTParentAnchor * anchor = HTRequest_anchor(request);
    char * uri = HTAnchor_address((HTAnchor*) anchor);
    switch (status) {
    case HT_RETRY: {
        HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE);
	if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL,
			HTRequest_error(request), NULL);
	HTTRACE(PROT_TRACE, "Load End.... NOT AVAILABLE, RETRY AT %ld\n" _ 
		    HTResponse_retryTime(response));
        }
        break;

    case HT_NO_DATA:
    {
	/*
	** The document was empty
	*/
	HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE);
	if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL,
			HTRequest_error(request), NULL);
	HTTRACE(PROT_TRACE, "Load End.... EMPTY: No content `%s\'\n" _ 
		    uri ? uri : "<UNKNOWN>");
	break;
    }    

    case HT_LOADED:
	HTTRACE(PROT_TRACE, "Load End.... OK: `%s\'\n" _ uri);
	break;

    default:
    {
	/*
	** See if we have a function registered for outputting errors.
	** If so then call it and present the message to the user
	*/
	HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE);
	if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL,
			HTRequest_error(request), NULL);
	HTTRACE(PROT_TRACE, "Load End.... Request ended with code %d\n" _ status);
	break;
    }
    }
    HT_FREE(uri);
    return HT_OK;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:54,代码来源:HTFilter.c

示例10: HTList_removeFirstObject

PUBLIC void * HTList_removeFirstObject  (HTList * me)
{
    if (me && me->next) {
	HTList * prevNode;
	void *firstObject;
	while (me->next) {
	    prevNode = me;
	    me = me->next;
	}
	firstObject = me->object;
	prevNode->next = NULL;
	HT_FREE(me);
	return firstObject;
    } else			/* Empty list */
	return NULL;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:16,代码来源:HTList.c

示例11: HTList_removeObject

PUBLIC BOOL HTList_removeObject (HTList * me, void * oldObject)
{
    if (me) {
	HTList *previous;
	while (me->next) {
	    previous = me;
	    me = me->next;
	    if (me->object == oldObject) {
		previous->next = me->next;
		HT_FREE(me);
		return YES;	/* Success */
	    }
	}
    }
    return NO;			/* object not found or NULL list */
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:16,代码来源:HTList.c

示例12: HTCookieHolder_delete

PRIVATE BOOL HTCookieHolder_delete (HTCookieHolder * me)
{
    if (me) {
        if (me->cookies) {
            HTList * cookies = me->cookies;
            HTCookie * cookie;
            while ((cookie = (HTCookie *) HTList_nextObject(cookies)))
                HTCookie_delete(cookie);
            HTList_delete(me->cookies);
        }
        HTList_removeObject(cookie_holder, me);
        HT_FREE(me);
        return YES;
    }
    return NO;
}
开发者ID:Rjoydip,项目名称:libwww,代码行数:16,代码来源:HTCookie.c

示例13: HTMIME_free

/*	Free a stream object
**	--------------------
*/
PRIVATE int HTMIME_free (HTStream * me)
{
    int status = HT_OK;
    if (!me->transparent)
        if (_stream2dispatchParsers(me) == HT_OK)
	    pumpData(me);
    if (me->target) {
	if ((status = (*me->target->isa->_free)(me->target))==HT_WOULD_BLOCK)
	    return HT_WOULD_BLOCK;
    }
    HTTRACE(PROT_TRACE, "MIME........ FREEING....\n");
    HTChunk_delete(me->token);
    HTChunk_delete(me->value);
    HT_FREE(me);
    return status;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:19,代码来源:HTMIME.c

示例14: HTAlertCall_delete

/*	HTAlertCall_delete
**	------------------
**	Unregister a call back function from a list
*/
PUBLIC BOOL HTAlertCall_delete (HTList * list, HTAlertCallback *cbf)
{
    HTTRACE(CORE_TRACE, "Alert Call..  Delete Alert Handler %p\n" _ (void *) cbf);
    if (list && cbf) {
	HTList *cur = list;
	HTAlert *pres;
	while ((pres = (HTAlert *) HTList_nextObject(cur))) {
	    if (pres->cbf == cbf) {
		HTList_removeObject(list, (void *) pres);
		HT_FREE(pres);
		return YES;
	    }
	}
    }
    return NO;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:20,代码来源:HTAlert.c

示例15: UserProgress

PUBLIC BOOL UserProgress (HTRequest * request, HTAlertOpcode op,
                          int msgnum, const char * dfault, void * input,
                          HTAlertPar * reply)
{
    char * msg = HTDialog_progressMessage(request, op, msgnum, dfault, input);
    CRequest * req = (CRequest *) HTRequest_context(request);
    ASSERT(request != NULL);
    ASSERT(req != NULL);
    CProgressCtrl * progress = req->GetProgressBar();

    switch (op) {
    case HT_PROG_READ:
        {
            long cl = HTAnchor_length(HTRequest_anchor(request));
            if (cl > 0) {
                long b_read = HTRequest_bodyRead(request);
                double pro = (double) b_read/cl*100;
		progress->SetPos((int) pro);
            }
        }
        break;
        
    case HT_PROG_WRITE:
        {
            long cl = HTAnchor_length(HTRequest_entityAnchor(request));
            if (cl > 0) {
                long b_written = HTRequest_bodyWritten(request);
                double pro = (double) b_written/cl*100;
		progress->SetPos((int) pro);
            }
        }
        break;
    }

    // Update pane 0 of the status bar
    if (msg) {
	CWinComDoc * doc = req->m_pDoc;
	if (doc) {
	    POSITION pos = doc->GetFirstViewPosition();
	    CView * view = doc->GetNextView( pos );
	    CMainFrame * mainframe = (CMainFrame *) view->GetParentFrame();
	    mainframe->m_wndStatusBar.SetPaneText(ID_SEPARATOR, msg);
	}
	HT_FREE(msg);
    }
    return YES;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:47,代码来源:UserParameters.cpp


注:本文中的HT_FREE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。