Esempio n. 1
0
int Awstats::processLine( const HttpVHost * pVHost, int fdConf,
                char * pCur, char * pLineEnd, char * &pLastWrite )
{
    while(( *pCur == ' ' )||( *pCur == '\t' ))
        ++pCur;
    if ( *pCur == '#' )
        return 0;
    int ret = findKeyInList( pCur );
    if ( ret >= (int)(sizeof( s_pList ) / sizeof( char * )) )
        return 0;
    if ( pLastWrite < pCur )
    {
        int len = write( fdConf, pLastWrite, pCur - pLastWrite );
        if ( len < pCur - pLastWrite )
        {
            return -1;
        }
        pLastWrite = pLineEnd + 1;
    }
    int n = 0;
    int len;
    const char * pBuf;
    char achBuf[2048];
    pBuf = achBuf;
    if ( HttpGlobals::s_psChroot )
        len = HttpGlobals::s_psChroot->len();
    else
        len = 0;
    switch( ret )
    {
    case 0:
        n = safe_snprintf( achBuf, sizeof( achBuf ), s_pList[ret],
                    pVHost->getAccessLogPath() + len );
        break;
    case 2:
        n = safe_snprintf( achBuf, sizeof( achBuf ), s_pList[ret],
                    m_sSiteDomain.c_str() );
        break;
    case 3:
        n = safe_snprintf( achBuf, sizeof( achBuf ), s_pList[ret],
                    m_sSiteAliases.c_str() );
        break;
    case 4:
        n = safe_snprintf( achBuf, sizeof( achBuf ), s_pList[ret],
                    m_sWorkingDir.c_str() + len );
        break;
    case 5:
        n = safe_snprintf( achBuf, sizeof( achBuf ), s_pList[ret],
                    m_sAwstatsURI.c_str() );
        break;
    case 1:
    case 6:
        pBuf = s_pList[ret];
        n = s_pLineLen[ret];
        break;
    }
    if ( write( fdConf, pBuf, n ) != n )
        return -1;
    return 0;
}
Esempio n. 2
0
//##############################################################################
//# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
//##############################################################################
bool xHashMap::containsKey(xObject& key)
throw(xClassCastException)
{
	int index = indexOf(hash(&key));
	if(findKeyInList(&key,(*m_table)[index]) != NULL)
		return true;
	return false;
}
Esempio n. 3
0
//##############################################################################
//# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
//##############################################################################
xObject& xHashMap::get(xObject& key)
throw(xClassCastException)
{
	int index = indexOf(hash(&key));
	Node* found = findKeyInList(&key,(*m_table)[index]);
	if(found != NULL)
		return *(found->data);
		
	return xNullObject::getInstance();
}