コード例 #1
0
ファイル: Requests.cpp プロジェクト: DonCN/haiku
// NotifyListenerRequest
status_t
NotifyListenerRequest::GetAddressInfos(AddressInfo* infos, int32* count)
{
	ADD_STRING(oldName);
	ADD_STRING(name);
	return B_OK;
}
コード例 #2
0
// update the standalone with the settings I have picked at the "start game" screen
void multi_options_update_start_game(netgame_info *ng)
{
	ubyte data[MAX_PACKET_SIZE],code;
	int packet_size = 0;

	// should be a host on a standalone
	Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER));

	// build the header
	BUILD_HEADER(OPTIONS_UPDATE);
	code = MULTI_OPTION_START_GAME;
	ADD_DATA(code);

	// add the start game options
	ADD_STRING(ng->name);
	ADD_INT(ng->mode);
	ADD_INT(ng->security);

	// add mode-specific data
	switch(ng->mode){
	case NG_MODE_PASSWORD:
		ADD_STRING(ng->passwd);
		break;
	case NG_MODE_RANK_ABOVE:
	case NG_MODE_RANK_BELOW:
		ADD_INT(ng->rank_base);
		break;
	}

	// send to the standalone server	
	multi_io_send_reliable(Net_player, data, packet_size);
}
コード例 #3
0
// update the standalone with the mission settings I have picked (mission filename, etc)
void multi_options_update_mission(netgame_info *ng, int campaign_mode)
{
	ubyte data[MAX_PACKET_SIZE],code;
	int packet_size = 0;

	// should be a host on a standalone
	Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER));

	// build the header
	BUILD_HEADER(OPTIONS_UPDATE);
	code = MULTI_OPTION_MISSION;
	ADD_DATA(code);

	// type (coop or team vs. team)
	ADD_INT(ng->type_flags);

	// respawns
	ADD_UINT(ng->respawn);

	// add the mission/campaign filename
	code = (ubyte)campaign_mode;
	ADD_DATA(code);
	if(campaign_mode){
		ADD_STRING(ng->campaign_name);
	} else {
		ADD_STRING(ng->mission_name);
	}

	// send to the server	
	multi_io_send_reliable(Net_player, data, packet_size);
}
コード例 #4
0
ファイル: dig.c プロジェクト: Gradwell/bind9
/*%
 * Internal print routine used to print short form replies.
 */
static isc_result_t
say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
	isc_result_t result;
	isc_uint64_t diff;
	isc_time_t now;
	char store[sizeof("12345678901234567890")];

	if (query->lookup->trace || query->lookup->ns_search_only) {
		result = dns_rdatatype_totext(rdata->type, buf);
		if (result != ISC_R_SUCCESS)
			return (result);
		ADD_STRING(buf, " ");
	}
	result = dns_rdata_totext(rdata, NULL, buf);
	if (result == ISC_R_NOSPACE)
		return (result);
	check_result(result, "dns_rdata_totext");
	if (query->lookup->identify) {
		TIME_NOW(&now);
		diff = isc_time_microdiff(&now, &query->time_sent);
		ADD_STRING(buf, " from server ");
		ADD_STRING(buf, query->servname);
		snprintf(store, 19, " in %d ms.", (int)diff/1000);
		ADD_STRING(buf, store);
	}
	ADD_STRING(buf, "\n");
	return (ISC_R_SUCCESS);
}
コード例 #5
0
ファイル: ProtocolWriterABF2.cpp プロジェクト: yamad/libabf
//===============================================================================================
// FUNCTION: WriteMathInfo
// PURPOSE:  Writes the math channel info to the data file.
// NOTES:    We currently only support one math channel, but the file can support any number.
//
BOOL CProtocolWriterABF2::WriteMathInfo()
{
   MEMBERASSERT();

   BOOL bOK    = TRUE;
   ABF_MathInfo Math;
   if( m_pFH->nArithmeticEnable )
   {
      Math.nMathEnable     = m_pFH->nArithmeticEnable;

      Math.nMathExpression = m_pFH->nArithmeticExpression;   
      Math.fMathUpperLimit = m_pFH->fArithmeticUpperLimit;   
      Math.fMathLowerLimit = m_pFH->fArithmeticLowerLimit;  

      Math.nMathADCNum[0]  = m_pFH->nArithmeticADCNumA;   
      Math.nMathADCNum[1]  = m_pFH->nArithmeticADCNumB;   

      Math.fMathK[0]       = m_pFH->fArithmeticK1;     
      Math.fMathK[1]       = m_pFH->fArithmeticK2;     
      Math.fMathK[2]       = m_pFH->fArithmeticK3;     
      Math.fMathK[3]       = m_pFH->fArithmeticK4;     
      Math.fMathK[4]       = m_pFH->fArithmeticK5;     
      Math.fMathK[5]       = m_pFH->fArithmeticK6;     

      Math.uMathOperatorIndex = ADD_STRING( m_pFH->sArithmeticOperator );
      Math.uMathUnitsIndex    = ADD_STRING( m_pFH->sArithmeticUnits );

      m_FileInfo.MathSection.Set( m_lNextBlock, sizeof( ABF_MathInfo ), 1 );
      bOK &= m_pFI->Write( &Math, sizeof( Math ) );
      bOK &= m_pFI->FillCurrentBlock( &m_lNextBlock );
   }

   return bOK;
}
コード例 #6
0
ファイル: ProtocolWriterABF2.cpp プロジェクト: yamad/libabf
//===============================================================================================
// FUNCTION: WriteFileInfo
// PURPOSE:  Writes the file info to the data file.
//
BOOL CProtocolWriterABF2::WriteFileInfo()
{
   MEMBERASSERT();

   BOOL bOK = TRUE;

   UINT uAcquiredSamples = m_pFI->GetAcquiredSamples();
   if( uAcquiredSamples )
   {
      // Make sure that at least one of the date fields has been set.
      ASSERT( m_pFH->uFileStartDate || m_pFH->uFileStartTimeMS );
   }

   m_FileInfo.uFileVersionNumber     = GetVersion( ABF_CURRENTVERSION );
                                       
   m_FileInfo.nFileType              = m_pFH->nFileType;
   m_FileInfo.nDataFormat            = m_pFH->nDataFormat;
   m_FileInfo.nSimultaneousScan      = m_pFH->nSimultaneousScan;
   m_FileInfo.FileGUID               = m_pFH->FileGUID;
   m_FileInfo.uFileCRC               = m_pFH->ulFileCRC;
   m_FileInfo.nCRCEnable             = m_pFH->nCRCEnable;

   m_FileInfo.uCreatorVersion        = GetVersion( m_pFH->nCreatorMajorVersion, 
                                                   m_pFH->nCreatorMinorVersion, 
                                                   m_pFH->nCreatorBugfixVersion, 
                                                   m_pFH->nCreatorBuildVersion );
   m_FileInfo.uModifierVersion       = GetVersion( m_pFH->nModifierMajorVersion, 
                                                   m_pFH->nModifierMinorVersion, 
                                                   m_pFH->nModifierBugfixVersion, 
                                                   m_pFH->nModifierBuildVersion );

   m_FileInfo.uFileStartDate         = m_pFH->uFileStartDate;
   m_FileInfo.uFileStartTimeMS       = m_pFH->uFileStartTimeMS;
   m_FileInfo.uStopwatchTime         = m_pFH->lStopwatchTime;

   m_FileInfo.uActualEpisodes        = m_pFI->GetAcquiredEpisodes();

   m_FileInfo.uCreatorNameIndex  = ADD_STRING( m_pFH->sCreatorInfo );
   m_FileInfo.uModifierNameIndex = ADD_STRING( m_pFH->sModifierInfo );
   m_FileInfo.uProtocolPathIndex = ADD_STRING( m_pFH->sProtocolPath );

   // Update the section pointers from the protocol.
   m_FileInfo.ScopeSection.Set( m_pFH->lScopeConfigPtr, sizeof( ABFScopeConfig ), m_pFH->lNumScopes );
   m_FileInfo.StatsSection.Set( m_pFH->lStatisticsConfigPtr, sizeof( ABFScopeConfig ), 1 );

   UINT uSampleSize = (m_pFH->nDataFormat != ABF_INTEGERDATA) ? sizeof(float) : sizeof(short);
   m_FileInfo.DataSection.Set( m_pFH->lDataSectionPtr, uSampleSize, uAcquiredSamples );
   m_FileInfo.TagSection.Set( m_pFH->lTagSectionPtr, sizeof( ABFTag ), m_pFH->lNumTagEntries );
   m_FileInfo.DeltaSection.Set( m_pFH->lDeltaArrayPtr, sizeof( ABFDelta ), m_pFH->lNumDeltas );
   m_FileInfo.VoiceTagSection.Set( m_pFH->lVoiceTagPtr, 0, m_pFH->lVoiceTagEntries );
   m_FileInfo.SynchArraySection.Set( m_pFH->lSynchArrayPtr, sizeof( ABFSynch ), m_pFH->lSynchArraySize );
   m_FileInfo.AnnotationSection.Set( m_pFH->lAnnotationSectionPtr, 0, m_pFH->lNumAnnotations );

   bOK &= m_pFI->Seek( 0L, FILE_BEGIN);
   bOK &= m_pFI->Write( &m_FileInfo, sizeof( m_FileInfo ) );
   bOK &= m_pFI->FillCurrentBlock( &m_lNextBlock );

   return TRUE;
}
コード例 #7
0
ファイル: aolserver.c プロジェクト: AmesianX/php-src
static void
php_ns_sapi_register_variables(zval *track_vars_array)
{
	int i;
	char buf[NS_BUF_SIZE + 1];
	char *tmp;

	for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
		char *key = Ns_SetKey(NSG(conn->headers), i);
		char *value = Ns_SetValue(NSG(conn->headers), i);
		char *p;
		char c;

		snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key);
		
		for(p = buf + 5; (c = *p); p++) {
			c = toupper(c);
			if(c < 'A' || c > 'Z') {
				c = '_';
			}
			*p = c;
		}

		ADD_STRINGX(buf, value);
	}
	
	snprintf(buf, NS_BUF_SIZE, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
	ADD_STRING("SERVER_SOFTWARE");
	snprintf(buf, NS_BUF_SIZE, "HTTP/%1.1f", NSG(conn)->request->version);
	ADD_STRING("SERVER_PROTOCOL");

	ADD_STRINGX("REQUEST_METHOD", NSG(conn)->request->method);

	if(NSG(conn)->request->query)
		ADD_STRINGX("QUERY_STRING", NSG(conn)->request->query);
	
	ADD_STRINGX("SERVER_BUILDDATE", Ns_InfoBuildDate());

	ADD_STRINGX("REMOTE_ADDR", Ns_ConnPeer(NSG(conn)));

	snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPeerPort(NSG(conn)));
	ADD_STRING("REMOTE_PORT");

	snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPort(NSG(conn)));
	ADD_STRING("SERVER_PORT");

	tmp = Ns_ConnHost(NSG(conn));
	if (tmp)
		ADD_STRINGX("SERVER_NAME", tmp);

	ADD_STRINGX("PATH_TRANSLATED", SG(request_info).path_translated);
	ADD_STRINGX("REQUEST_URI", SG(request_info).request_uri);
	ADD_STRINGX("PHP_SELF", SG(request_info).request_uri);

	ADD_STRINGX("GATEWAY_INTERFACE", "CGI/1.1");

	snprintf(buf, NS_BUF_SIZE, "%d", Ns_InfoBootTime());
	ADD_STRING("SERVER_BOOTTIME");
}
コード例 #8
0
ファイル: Requests.cpp プロジェクト: DonCN/haiku
// MountVolumeRequest
status_t
MountVolumeRequest::GetAddressInfos(AddressInfo* infos, int32* count)
{
	ADD_NON_NULL_STRING(cwd);
	ADD_STRING(device);
	ADD_STRING(parameters);
	return B_OK;
}
コード例 #9
0
/*
  this function will be called upon a scheduled data collection 
  for a specific rule. it has to write measurement values from 
  'flowdata' into 'buf' and set len accordingly
*/
int exportData( void **exp, int *len, void *flowdata )
{
    uint32_t i;
    packetData_t *pkt;
    flowRec_t *data = (flowRec_t *) flowdata;

    /* check if enough buffer space is available and reserve extra memory if not */
    if (expSize < ROWSTRSIZE * (data->nrows + 1)) {
        uint8_t *newMemory = realloc(expData, ROWSTRSIZE * (data->nrows + 1));
	if (newMemory != NULL) {
	    expData = newMemory;
	    expSize = ROWSTRSIZE * data->nrows;
	} else {
	    /* not enough memory to write data to -> don't write data at all */
	    STARTEXPORT(expData);
	    ADD_LIST(0);
	    END_LIST();
	    ENDEXPORT(exp, len);
	    return -1;
	}
    }


    STARTEXPORT(expData);
    ADD_LIST( data->nrows );

    pkt = data->pkt;

    for (i = 0; i < data->nrows; i++) {

	ADD_UINT8(  pkt->ipversion );
	ADD_UINT8(  pkt->ttl );
	ADD_UINT16( pkt->pktlen );
	ADD_UINT16( pkt->iphdrlen );
	
	ADD_UINT16( pkt->proto );
	ADD_UINT16( pkt->tcpudphdrlen );
	
	ADD_STRING( pkt->srcip );
	ADD_UINT16( pkt->srcport );
	
	ADD_STRING( pkt->dstip );
	ADD_UINT16( pkt->dstport );

	ADD_UINT32( pkt->tcpseqno );
	ADD_STRING( printFlags(pkt->tcpflags) );

	pkt++;
    }

    END_LIST();
    ENDEXPORT(exp, len);

    data->nrows = 0;
    
    return 0;
}
コード例 #10
0
ファイル: ProtocolWriterABF2.cpp プロジェクト: yamad/libabf
//===============================================================================================
// FUNCTION: WriteADCInfo
// PURPOSE:  Writes the ADC info to the data file.
//
BOOL CProtocolWriterABF2::WriteADCInfo()
{
   MEMBERASSERT();

   BOOL bOK = TRUE;
   ABF_ADCInfo ADCInfo;

   // Channel Index. The channel index is stored in the Sampling Sequence.
   UINT ch = 0;

   for( int a=0; a<m_pFH->nADCNumChannels; a++ )
   {
      // Get the channel index from the sampling sequence array.
      ch = m_pFH->nADCSamplingSeq[a];

      ADCInfo.nADCNum                       = short(ch); 
      ADCInfo.nTelegraphEnable              = m_pFH->nTelegraphEnable[ch]; 
      ADCInfo.nTelegraphInstrument          = m_pFH->nTelegraphInstrument[ch]; 
      ADCInfo.fTelegraphAdditGain           = m_pFH->fTelegraphAdditGain[ch]; 
      ADCInfo.fTelegraphFilter              = m_pFH->fTelegraphFilter[ch]; 
      ADCInfo.fTelegraphMembraneCap         = m_pFH->fTelegraphMembraneCap[ch]; 
      ADCInfo.nTelegraphMode                = m_pFH->nTelegraphMode[ch]; 
      ADCInfo.fTelegraphAccessResistance    = m_pFH->fTelegraphAccessResistance[ch]; 
      ADCInfo.nADCPtoLChannelMap            = m_pFH->nADCPtoLChannelMap[ch]; 
      ADCInfo.fADCProgrammableGain          = m_pFH->fADCProgrammableGain[ch]; 
      ADCInfo.fADCDisplayAmplification      = m_pFH->fADCDisplayAmplification[ch]; 
      ADCInfo.fADCDisplayOffset             = m_pFH->fADCDisplayOffset[ch]; 
      ADCInfo.fInstrumentScaleFactor        = m_pFH->fInstrumentScaleFactor[ch]; 
      ADCInfo.fInstrumentOffset             = m_pFH->fInstrumentOffset[ch]; 
      ADCInfo.fSignalGain                   = m_pFH->fSignalGain[ch]; 
      ADCInfo.fSignalOffset                 = m_pFH->fSignalOffset[ch]; 
      ADCInfo.fSignalLowpassFilter          = m_pFH->fSignalLowpassFilter[ch]; 
      ADCInfo.fSignalHighpassFilter         = m_pFH->fSignalHighpassFilter[ch]; 
      ADCInfo.nLowpassFilterType            = m_pFH->nLowpassFilterType[ch]; 
      ADCInfo.nHighpassFilterType           = m_pFH->nHighpassFilterType[ch]; 
      ADCInfo.fPostProcessLowpassFilter     = m_pFH->fPostProcessLowpassFilter[ch]; 
      ADCInfo.nPostProcessLowpassFilterType = m_pFH->nPostProcessLowpassFilterType[ch]; 
      ADCInfo.nStatsChannelPolarity         = m_pFH->nStatsChannelPolarity[ch]; 

      ADCInfo.lADCChannelNameIndex = ADD_STRING( m_pFH->sADCChannelName[ADCInfo.nADCNum] );
      ADCInfo.lADCUnitsIndex       = ADD_STRING( m_pFH->sADCUnits[ADCInfo.nADCNum] );
      
      m_FileInfo.ADCSection.Set( m_lNextBlock, sizeof( ADCInfo ), a+1 );
      m_pFI->Write( &ADCInfo, sizeof( ADCInfo ) );
   }
   bOK &= m_pFI->FillCurrentBlock( &m_lNextBlock );

   return bOK;
}
コード例 #11
0
ファイル: multi_respawn.cpp プロジェクト: lubomyr/freespace2
// send a broadcast pack indicating a player has respawned
void multi_respawn_broadcast(net_player *np)
{
	ubyte data[50],val;
	int packet_size = 0;
	ushort signature;
	vector pos;

	// broadcast the packet to all players
	Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER);

	signature = Objects[np->player->objnum].net_signature;
	pos = Objects[np->player->objnum].pos;

	// build the header and add the opcode
	BUILD_HEADER(RESPAWN_NOTICE);
	val = RESPAWN_BROADCAST;
	ADD_DATA(val);

	// add the data for the respawn
	ADD_USHORT(signature);
    add_vector_data( data, &packet_size, pos );
	ADD_SHORT(np->player_id);
	ADD_DATA(np->s_info.cur_primary_bank);
	ADD_DATA(np->s_info.cur_secondary_bank);
	ADD_DATA(np->s_info.cur_link_status);
	ADD_USHORT(np->s_info.ship_ets);
	ADD_STRING(np->p_info.p_objp->name);

	Assert( np->s_info.ship_ets != 0 );		// find dave or allender

	multi_io_send_to_all_reliable(data, packet_size);
}
コード例 #12
0
ファイル: ProtocolWriterABF2.cpp プロジェクト: yamad/libabf
//===============================================================================================
// FUNCTION: WriteUserList
// PURPOSE:  Writes the user list to the data file.
//
BOOL CProtocolWriterABF2::WriteUserList()
{
   MEMBERASSERT();

   BOOL bOK    = TRUE;
   UINT uCount = 1;
   ABF_UserListInfo UserList;
   for( short u=0; u<ABF_DACCOUNT; u++ )
   {
      if( m_pFH->nULEnable[u] )
      {
         UserList.nListNum       = u;
         UserList.nULParamToVary = m_pFH->nULParamToVary[u];
         UserList.nULRepeat      = m_pFH->nULRepeat[u];

         UserList.lULParamValueListIndex = ADD_STRING( m_pFH->sULParamValueList[u] );

         m_FileInfo.UserListSection.Set( m_lNextBlock, sizeof( UserList ), uCount++ );
         bOK &= m_pFI->Write( &UserList, sizeof( UserList ) );
      }
   }
   bOK &= m_pFI->FillCurrentBlock( &m_lNextBlock );

   return bOK;
}
コード例 #13
0
ファイル: stralloc.c プロジェクト: Yuffster/fluffOS
char *int_new_string (int size)
#endif
{
    malloc_block_t *mbt;

#if 0
    if (!size) {
        the_null_string_blocks[0].ref++;
        ADD_NEW_STRING(0, sizeof(malloc_block_t));
        return the_null_string;
    }
#endif
    
    mbt = (malloc_block_t *)DXALLOC(size + sizeof(malloc_block_t) + 1, TAG_MALLOC_STRING, tag);
    if (size < USHRT_MAX) {
        mbt->size = size;
        ADD_NEW_STRING(size, sizeof(malloc_block_t));
    } else {
        mbt->size = USHRT_MAX;
        ADD_NEW_STRING(USHRT_MAX, sizeof(malloc_block_t));
    }
    mbt->ref = 1;
    ADD_STRING(mbt->size);
    CHECK_STRING_STATS;
    return (char *)(mbt + 1);
}
コード例 #14
0
ファイル: zend_persist_calc.c プロジェクト: Crell/php-src
uint zend_accel_script_persist_calc(zend_persistent_script *new_persistent_script, char *key, unsigned int key_length)
{
	new_persistent_script->mem = NULL;
	new_persistent_script->size = 0;
	new_persistent_script->arena_mem = NULL;
	new_persistent_script->arena_size = 0;
	ZCG(current_persistent_script) = new_persistent_script;

	ADD_DUP_SIZE(new_persistent_script, sizeof(zend_persistent_script));
	if (key) {
		ADD_DUP_SIZE(key, key_length + 1);
	}
	ADD_STRING(new_persistent_script->full_path);

#ifdef __SSE2__
	/* Align size to 64-byte boundary */
	new_persistent_script->size = (new_persistent_script->size + 63) & ~63;
#endif

	zend_accel_persist_class_table_calc(&new_persistent_script->class_table);
	zend_hash_persist_calc(&new_persistent_script->function_table, zend_persist_op_array_calc);
	zend_persist_op_array_calc_ex(&new_persistent_script->main_op_array);

#ifdef __SSE2__
	/* Align size to 64-byte boundary */
	new_persistent_script->arena_size = (new_persistent_script->arena_size + 63) & ~63;
#endif

	new_persistent_script->size += new_persistent_script->arena_size;

	ZCG(current_persistent_script) = NULL;

	return new_persistent_script->size;
}
コード例 #15
0
ファイル: dbus_player.c プロジェクト: chouquette/vlc
/**
 * PropertiesChangedSignal() synthetizes and sends the
 * org.freedesktop.DBus.Properties.PropertiesChanged signal
 */
static DBusHandlerResult
PropertiesChangedSignal( intf_thread_t    *p_intf,
                         vlc_dictionary_t *p_changed_properties )
{
    DBusConnection  *p_conn = p_intf->p_sys->p_conn;
    DBusMessageIter changed_properties, invalidated_properties;
    const char *psz_interface_name = DBUS_MPRIS_PLAYER_INTERFACE;
    char **ppsz_properties = NULL;

    SIGNAL_INIT( DBUS_INTERFACE_PROPERTIES,
                 DBUS_MPRIS_OBJECT_PATH,
                 "PropertiesChanged" );

    OUT_ARGUMENTS;
    ADD_STRING( &psz_interface_name );

    if( !dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "{sv}",
                                           &changed_properties ) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );

    if( unlikely(!ppsz_properties) )
    {
        dbus_message_iter_abandon_container( &args, &changed_properties );
        return DBUS_HANDLER_RESULT_NEED_MEMORY;
    }

    for( int i = 0; ppsz_properties[i]; i++ )
    {
        PROPERTY_MAPPING_BEGIN
        PROPERTY_ENTRY( Metadata,       "a{sv}" )
        PROPERTY_ENTRY( PlaybackStatus, "s"     )
        PROPERTY_ENTRY( LoopStatus,     "s"     )
        PROPERTY_ENTRY( Rate,           "d"     )
        PROPERTY_ENTRY( Shuffle,        "b"     )
        PROPERTY_ENTRY( Volume,         "d"     )
        PROPERTY_ENTRY( CanSeek,        "b"     )
        PROPERTY_ENTRY( CanPlay,        "b"     )
        PROPERTY_ENTRY( CanPause,       "b"     )
        PROPERTY_MAPPING_END

        free( ppsz_properties[i] );
    }

    free( ppsz_properties );

    if( !dbus_message_iter_close_container( &args, &changed_properties ) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    if( !dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "s",
                                           &invalidated_properties ) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    if( !dbus_message_iter_close_container( &args, &invalidated_properties ) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    SIGNAL_SEND;
}
コード例 #16
0
ファイル: dbus_tracklist.c プロジェクト: 371816210/vlc_vlc
/**
 * PropertiesChangedSignal: synthetizes and sends the
 * org.freedesktop.DBus.Properties.PropertiesChanged signal
 */
static DBusHandlerResult
PropertiesChangedSignal( intf_thread_t    *p_intf,
                         vlc_dictionary_t *p_changed_properties )
{
    DBusConnection  *p_conn = p_intf->p_sys->p_conn;
    DBusMessageIter changed_properties, invalidated_properties;
    const char *psz_interface_name = DBUS_MPRIS_TRACKLIST_INTERFACE;
    char **ppsz_properties = NULL;
    int i_properties = 0;

    SIGNAL_INIT( DBUS_INTERFACE_PROPERTIES,
                 DBUS_MPRIS_OBJECT_PATH,
                 "PropertiesChanged" );

    OUT_ARGUMENTS;
    ADD_STRING( &psz_interface_name );

    if( unlikely(!dbus_message_iter_open_container( &args,
                                                    DBUS_TYPE_ARRAY, "{sv}",
                                                    &changed_properties )) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    if( unlikely(!dbus_message_iter_close_container( &args,
                                                     &changed_properties )) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    if( unlikely(!dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "s",
                                                    &invalidated_properties )) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    i_properties    = vlc_dictionary_keys_count( p_changed_properties );
    ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );

    if( unlikely(!ppsz_properties) )
    {
        dbus_message_iter_abandon_container( &args, &invalidated_properties );
        return DBUS_HANDLER_RESULT_NEED_MEMORY;
    }

    for( int i = 0; i < i_properties; i++ )
    {
        if( !strcmp( ppsz_properties[i], "Tracks" ) )
            dbus_message_iter_append_basic( &invalidated_properties,
                                            DBUS_TYPE_STRING,
                                            &ppsz_properties[i] );

        free( ppsz_properties[i] );
    }

    free( ppsz_properties );

    if( unlikely(!dbus_message_iter_close_container( &args,
                    &invalidated_properties )) )
        return DBUS_HANDLER_RESULT_NEED_MEMORY;

    SIGNAL_SEND;
}
コード例 #17
0
/*
 * token ID		1 byte
 * privtstrlen		2 bytes
 * privtstr		N bytes + 1
 * privstrlen		2 bytes
 * privstr		N bytes + 1
 */
token_t *
au_to_privset(char *privtypestr, char *privstr)
{
	u_int16_t	 type_len, priv_len;
	u_char		*dptr;
	token_t		*t;

	type_len = strlen(privtypestr) + 1;
	priv_len = strlen(privstr) + 1;
	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) +
	    sizeof(u_int16_t) + type_len + priv_len);

	ADD_U_CHAR(dptr, AUT_PRIV);
	ADD_U_INT16(dptr, type_len);
	ADD_STRING(dptr, privtypestr, type_len);
	ADD_U_INT16(dptr, priv_len);
	ADD_STRING(dptr, privstr, priv_len);
	return (t);
}
コード例 #18
0
ファイル: zend_persist_calc.c プロジェクト: vucms/php-src
static void zend_persist_property_info_calc(zval *zv)
{
	zend_property_info *prop = Z_PTR_P(zv);

	ADD_ARENA_SIZE(sizeof(zend_property_info));
	ADD_INTERNED_STRING(prop->name, 0);
	if (ZCG(accel_directives).save_comments && prop->doc_comment) {
		ADD_STRING(prop->doc_comment);
	}
}
コード例 #19
0
wxString COARfile::FormatLocusAlerts(
  const COARsample *pSample,
  COARlocus *pLocus,
  const CAlertViewStatus &viewStatus,
  const wxDateTime *pTime) const
{
  COmittedAlerts mapOmitted;
  wxString sRtn;
  vector<wxString> vs;
  size_t nLen = 0;
  bool bOmit = !viewStatus.GetSampleLocus();
  if(pLocus != NULL)
  {
    wxString s;
    wxString sReview;
    wxString sTitle;
    wxString sNotes = pLocus->GetNotes(pTime);;
    vector<int> vn;
    pLocus->AppendAlerts(&vn,pTime);
    if(bOmit)
    {
      int n = CountMessages(vn,pTime);
      mapOmitted.Add(CAlertViewStatus::SAMPLE_LOCUS,n);
    }
    else
    {
      if(CanEditArtifacts())
      {
        int nReview;
        int nAccept;
        GetReviewerCounts(&nReview,&nAccept,CLabReview::REVIEW_LOCUS);
        sReview = pLocus->FormatReviewAcceptance(pTime);
        s = CheckLocusStatus(pLocus,nReview,nAccept,pTime);
        APPEND_STRING(sReview,s);
        s.Clear();
      }
      if(vn.size())
      {
        s = FormatMessages(vn,2,pTime);
      }
      if( !(s.IsEmpty() && sNotes.IsEmpty() && sReview.IsEmpty()) )
      {
        sTitle = pLocus->GetName();
        sTitle.Append(_T(" " COAR_NOTICE_DISPLAY ":"));
        ADD_STRING(sTitle);
        ADD_STRINGE(s);
        ADD_REVIEW_NOTES(sReview,sNotes,2);
        s.Empty();
      }
    }
  }
  _FormatCommonAlerts(&mapOmitted,pSample,vs,nLen,viewStatus, pTime,true);
  _JoinStrings(sRtn,vs,&mapOmitted,nLen);
  return sRtn;
}
コード例 #20
0
ファイル: dbus_root.c プロジェクト: Mettbrot/vlc
static DBusHandlerResult
PropertiesChangedSignal( intf_thread_t    *p_intf,
                         vlc_dictionary_t *p_changed_properties )
{
    DBusConnection  *p_conn = p_intf->p_sys->p_conn;
    DBusMessageIter changed_properties, invalidated_properties, entry, variant;
    const char *psz_interface_name = DBUS_MPRIS_ROOT_INTERFACE;
    char **ppsz_properties = NULL;
    int i_properties = 0;

    SIGNAL_INIT( DBUS_INTERFACE_PROPERTIES,
                 DBUS_MPRIS_OBJECT_PATH,
                 "PropertiesChanged" );

    OUT_ARGUMENTS;
    ADD_STRING( &psz_interface_name );
    dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "{sv}",
                                      &changed_properties );

    i_properties = vlc_dictionary_keys_count( p_changed_properties );
    ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );

    for( int i = 0; i < i_properties; i++ )
    {
        dbus_message_iter_open_container( &changed_properties,
                                          DBUS_TYPE_DICT_ENTRY, NULL,
                                          &entry );

        dbus_message_iter_append_basic( &entry, DBUS_TYPE_STRING,
                                        &ppsz_properties[i] );

        if( !strcmp( ppsz_properties[i], "Fullscreen" ) )
        {
            dbus_message_iter_open_container( &entry,
                                              DBUS_TYPE_VARIANT, "b",
                                              &variant );
            MarshalFullscreen( p_intf, &variant );
            dbus_message_iter_close_container( &entry, &variant );
        }

        dbus_message_iter_close_container( &changed_properties, &entry );
        free( ppsz_properties[i] );
    }

    dbus_message_iter_close_container( &args, &changed_properties );

    dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "s",
                                      &invalidated_properties );

    dbus_message_iter_close_container( &args, &invalidated_properties );
    free( ppsz_properties );

    SIGNAL_SEND;
}
コード例 #21
0
ファイル: zend_persist_calc.c プロジェクト: Crell/php-src
static void zend_persist_property_info_calc(zval *zv)
{
	zend_property_info *prop = Z_PTR_P(zv);

	if (!zend_shared_alloc_get_xlat_entry(prop)) {
		zend_shared_alloc_register_xlat_entry(prop, prop);
		ADD_ARENA_SIZE(sizeof(zend_property_info));
		ADD_INTERNED_STRING(prop->name, 0);
		if (ZCG(accel_directives).save_comments && prop->doc_comment) {
			ADD_STRING(prop->doc_comment);
		}
	}
}
コード例 #22
0
ファイル: webjames.c プロジェクト: chosen1/php-src
static void sapi_webjames_register_variables(zval *track_vars_array)
{
	char buf[BUF_SIZE + 1];
	char *docroot;

	buf[BUF_SIZE] = '\0';

	ADD_STRING("SERVER_SOFTWARE", configuration.server);
	ADD_STRING("SERVER_NAME", configuration.serverip);
	ADD_FIELD("SERVER_PROTOCOL", protocol);
	ADD_NUM("SERVER_PORT", port);
	ADD_STRING("SERVER_ADMIN",configuration.webmaster);
	ADD_STRING("GATEWAY_INTERFACE", "CGI/1.1");

	docroot = __unixify(WG(conn)->homedir,0,NULL,1024,0);
	if (docroot) ADD_STRING("DOCUMENT_ROOT", docroot);

	ADD_FIELD("REQUEST_METHOD", methodstr);
	ADD_FIELD("REQUEST_URI", requesturi);
	ADD_STRING("PATH_TRANSLATED", SG(request_info).path_translated);
	ADD_FIELD("SCRIPT_NAME", uri);
	ADD_FIELD("PHP_SELF", uri);
	ADD_FIELD("QUERY_STRING", args);


	snprintf(buf, BUF_SIZE, "%d.%d.%d.%d", WG(conn)->ipaddr[0], WG(conn)->ipaddr[1], WG(conn)->ipaddr[2], WG(conn)->ipaddr[3]);
	ADD_STRING("REMOTE_ADDR", buf);
	if (WG(conn)->dnsstatus == DNS_OK) ADD_FIELD("REMOTE_HOST", host);

	if ((WG(conn)->method == METHOD_POST) || (WG(conn)->method == METHOD_PUT)) {
		ADD_NUM("CONTENT_LENGTH", bodysize);
		ADD_FIELD("CONTENT_TYPE", type);
	}

	if ((WG(conn)->method == METHOD_PUT) || (WG(conn)->method == METHOD_DELETE)) ADD_FIELD("ENTITY_PATH", requesturi);

	if (WG(conn)->pwd) {
		ADD_STRING("AUTH_TYPE", "basic");
		ADD_FIELD("REMOTE_USER", authorization);
	}

	ADD_FIELD("HTTP_COOKIE", cookie);
	ADD_FIELD("HTTP_USER_AGENT", useragent);
	ADD_FIELD("HTTP_REFERER", referer);
	ADD_FIELD("HTTP_ACCEPT", accept);
	ADD_FIELD("HTTP_ACCEPT_LANGUAGE", acceptlanguage);
	ADD_FIELD("HTTP_ACCEPT_CHARSET", acceptcharset);
	ADD_FIELD("HTTP_ACCEPT_ENCODING", acceptencoding);
}
コード例 #23
0
/*
 * token ID                1 byte
 * zonename length         2 bytes
 * zonename                N bytes + 1 terminating NULL byte
 */
token_t *
au_to_zonename(const char *zonename)
{
	u_char *dptr = NULL;
	u_int16_t textlen;
	token_t *t;

	textlen = strlen(zonename) + 1;
	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) + textlen);

	ADD_U_CHAR(dptr, AUT_ZONENAME);
	ADD_U_INT16(dptr, textlen);
	ADD_STRING(dptr, zonename, textlen);
	return (t);
}
コード例 #24
0
/*
 * token ID                1 byte
 * socket family           2 bytes
 * path                    (up to) 104 bytes + NULL  (NULL terminated string)
 */
token_t *
au_to_sock_unix(struct sockaddr_un *so)
{
	token_t *t;
	u_char *dptr;

	GET_TOKEN_AREA(t, dptr, 3 * sizeof(u_char) + strlen(so->sun_path) + 1);

	ADD_U_CHAR(dptr, AUT_SOCKUNIX);
	/* BSM token has two bytes for family */
	ADD_U_CHAR(dptr, 0);
	ADD_U_CHAR(dptr, so->sun_family);
	ADD_STRING(dptr, so->sun_path, strlen(so->sun_path) + 1);

	return (t);
}
コード例 #25
0
ファイル: stralloc.c プロジェクト: Yuffster/fluffOS
const char *
ref_string (const char * str)
{
    block_t *b;

    b = BLOCK(str);
#ifdef DEBUG
    if (b != findblock(str)) {
        fatal("stralloc.c: called ref_string on non-shared string: %s.\n", str);
    }
#endif                          /* defined(DEBUG) */
    if (REFS(b))
        REFS(b)++;
    NDBG(b);
    ADD_STRING(SIZE(b));
    return str;
}
コード例 #26
0
/*
 * token ID                1 byte
 * success/failure         1 byte
 * privstrlen              2 bytes
 * privstr                 N bytes + 1 (\0 byte)
 */
token_t *
au_to_upriv(char sorf, char *priv)
{
	u_int16_t textlen;
	u_char *dptr;
	token_t *t;

	textlen = strlen(priv) + 1;
	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_char) +
	    sizeof(u_int16_t) + textlen);

	ADD_U_CHAR(dptr, AUT_UPRIV);
	ADD_U_CHAR(dptr, sorf);
	ADD_U_INT16(dptr, textlen);
	ADD_STRING(dptr, priv, textlen);
	return (t);
}
コード例 #27
0
/* {{{ Helpers */
void retval_point_from_coordinates(zval *return_value, double lon, double lat)
{
	zval *coordinates;

	array_init(return_value);
	GEOSPAT_MAKE_STD_ZVAL(coordinates);
	array_init(coordinates);
	ADD_STRING(return_value, "type", "Point");
	add_next_index_double(coordinates, lon);
	add_next_index_double(coordinates, lat);
#if PHP_VERSION_ID >= 70000
	add_assoc_zval_ex(return_value, "coordinates", sizeof("coordinates") - 1, coordinates);
	efree(coordinates);
#else
	add_assoc_zval_ex(return_value, "coordinates", sizeof("coordinates"), coordinates);
#endif
}
コード例 #28
0
ファイル: stralloc.c プロジェクト: Yuffster/fluffOS
char *
     make_shared_string (const char * str)
{
    block_t *b;
    int h;

    b = hfindblock(str, h);     /* hfindblock macro sets h = StrHash(s) */
    if (!b) {
        b = alloc_new_string(str, h);
    } else {
        if (REFS(b))
            REFS(b)++;
        ADD_STRING(SIZE(b));
    }
    NDBG(b);
    return (STRING(b));
}
コード例 #29
0
/*
 * token ID                1 byte
 * path length             2 bytes
 * path                    N bytes + 1 terminating NULL byte
 */
token_t *
au_to_path(const char *text)
{
	token_t *t;
	u_char *dptr = NULL;
	u_int16_t textlen;

	textlen = strlen(text);
	textlen += 1;

	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) + textlen);

	ADD_U_CHAR(dptr, AUT_PATH);
	ADD_U_INT16(dptr, textlen);
	ADD_STRING(dptr, text, textlen);

	return (t);
}
コード例 #30
0
/*
 * token ID                1 byte
 * text length             2 bytes
 * text                    N bytes + 1 terminating NULL byte
 */
token_t *
au_to_text(const char *text)
{
	token_t *t;
	u_char *dptr = NULL;
	u_int16_t textlen;

	textlen = strlen(text);
	textlen += 1;

	/* XXXRW: Should validate length against token size limit. */

	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) + textlen);

	ADD_U_CHAR(dptr, AUT_TEXT);
	ADD_U_INT16(dptr, textlen);
	ADD_STRING(dptr, text, textlen);

	return (t);
}