📄 attr.c
字号:
/////////////////////////////////////////////////////////////////////////////// Copyright (c) 2000 Intel Corporation// All rights reserved.//// Redistribution and use in source and binary forms, with or without// modification, are permitted provided that the following conditions are met://// * Redistributions of source code must retain the above copyright notice,// this list of conditions and the following disclaimer.// * Redistributions in binary form must reproduce the above copyright notice,// this list of conditions and the following disclaimer in the documentation// and/or other materials provided with the distribution.// * Neither name of Intel Corporation nor the names of its contributors// may be used to endorse or promote products derived from this software// without specific prior written permission.//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE./////////////////////////////////////////////////////////////////////////////// $Revision: 1.1.2.10 $// $Date: 2004/08/16 03:17:47 $#include "../../inc/tools/config.h"#if EXCLUDE_DOM == 0#include "../../inc/upnpdom/Attr.h"char* Attr_getName(Attr *pAttr ,struct strNode *pNode){ char *returnName; returnName = (char *)malloc( strlen(pNode->nact->NA_NodeName) + 1); if(!returnName) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } strcpy(returnName, pNode->nact->NA_NodeName); return(returnName);}char* Attr_getValue(Attr *pAttr, struct strNode *pNode){ char *returnValue; returnValue= (char *)malloc( strlen(pNode->nact->NA_NodeValue) + 1); if(!returnValue) { DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");) return NULL; } strcpy(returnValue, pNode->nact->NA_NodeValue); return(returnValue);}void Attr_Attr_0(Attr *pAttr, struct strNode *pNode){ pAttr->ownerAttr=(Attr *)pNode; pNode->nact=NULL;}void Attr_Attr_1(Attr *pAttr, char *name){ struct strNode *pNode; pNode->nact = (struct strNodeAct *) malloc (sizeof(struct strNodeAct) + 1); NodeAct_NodeAct_4(pNode->nact, ATTRIBUTE_NODE, name,"",pNode); if(!pNode->nact) {DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");)} pNode->nact->RefCount++; pAttr->ownerAttr=(Attr *)pNode;}void Attr_Attr_2(Attr *pAttr, char *name, char*value){ struct strNode *pNode; pNode->nact = (struct strNodeAct *) malloc( sizeof(struct strNodeAct) + 1); NodeAct_NodeAct_4(pNode->nact, ATTRIBUTE_NODE, name,"",pNode); if(!pNode->nact) {DBGONLY(UpnpPrintf(UPNP_CRITICAL,DOM,__FILE__,__LINE__,"Insuffecient memory\n");)} pNode->nact->RefCount++; pAttr->ownerAttr=(Attr *)pNode;}void Attr_Attr_free(Attr *pAttr){}Attr *Attr_Attr_operator_eq(Attr *pAttr, struct strNode *pNode, const Attr *aother, struct strNode *nother){ if (pNode->nact != nother->nact) { pNode->nact = nother->nact; pNode->nact->RefCount++; } pAttr->ownerAttr=aother->ownerAttr; return pAttr;}void Attr_deleteAttr(Attr *pAttr, struct strNode *pNode){ free(pAttr->ownerAttr); pNode->nact=NULL;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -