コード例 #1
0
ファイル: functions.c プロジェクト: BenPalmer1983/potfit
void ms_shift(double r, double *p, double *f)
{
  static double pot, grad, pot_cut, grad_cut;

  ms_init(r, &pot, &grad, p);
  ms_init(dp_cut, &pot_cut, &grad_cut, p);

  *f = pot - pot_cut - (r - dp_cut) * grad_cut;

  return;
}
コード例 #2
0
ファイル: bench.c プロジェクト: biddyweb/azfone-ios
int main(int argc, char *argv[]){
	int pos;
	int count;
	ortp_init();
	ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
	ms_init();
	rtp_profile_set_payload(&av_profile,115,&payload_type_lpc1015);
	rtp_profile_set_payload(&av_profile,110,&payload_type_speex_nb);
	rtp_profile_set_payload(&av_profile,111,&payload_type_speex_wb);
	rtp_profile_set_payload(&av_profile,112,&payload_type_ilbc);

	signal(SIGINT,stop);

	count=0;
	for (pos=0;cfg[pos].num_session!=0;pos++)
		{
			count = count + init_bench(&cfg[pos]);
			ms_sleep(10);
		}

	ms_message("Number of session started: %i.", count);

	while(run)
		ms_sleep(1);

	for (pos=0;cfg[pos].num_session!=0;pos++)
		{
			uninit_bench(&cfg[pos]);
		}

	return 0;
}
コード例 #3
0
ファイル: array_utility.hpp プロジェクト: robhz786/smart_ptr
 inline void ms_init
     ( const boost::detail::shared_initializer& initializer
     , T* memory
     , std::size_t size) {
     boost::has_trivial_default_constructor<T> trivial;
     ms_init(initializer, memory, size, trivial);
 }
コード例 #4
0
ファイル: ms.c プロジェクト: AlekSi/beanstalkd
void
ms_clear(ms a)
{
    while (ms_delete(a, 0));
    free(a->items);
    ms_init(a, a->oninsert, a->onremove);
}
コード例 #5
0
static void test_filterdesc_enable_disable_base(const char* mime, const char* filtername,bool_t is_enc) {
	MSFilter *filter;

	ms_init();

	if (is_enc)
			filter = ms_filter_create_encoder(mime);
		else
			filter = ms_filter_create_decoder(mime);

	BC_ASSERT_PTR_NOT_NULL(filter);
	ms_filter_destroy(filter);

	BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(ms_factory_get_fallback(),filtername,FALSE));
	BC_ASSERT_FALSE(ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),filtername));
	if (is_enc)
			filter = ms_filter_create_encoder(mime);
		else
			filter = ms_filter_create_decoder(mime);
	BC_ASSERT_PTR_NULL(filter);

	BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(ms_factory_get_fallback(),filtername,TRUE));
	BC_ASSERT_TRUE(ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),filtername));
	if (is_enc)
		filter = ms_filter_create_encoder(mime);
	else
		filter = ms_filter_create_decoder(mime);
	BC_ASSERT_PTR_NOT_NULL(filter);

	ms_filter_destroy(filter);
	ms_exit();
}
コード例 #6
0
ファイル: mouse_1.c プロジェクト: anarsoul/xynth-server
static int mouse_init_return_fd (char *dev, int type, int samplerate)
{
	struct sigaction siga;

	if (!ms.mouse_open) {
		if (strcmp(dev, "") == 0)
			ms.dev = "/dev/mouse";
		else
			ms.dev = dev;
		ms.type = type & MOUSE_TYPE_MASK;
		ms.modem_ctl = type & ~MOUSE_TYPE_MASK;
		ms.sample = samplerate;
		ms.currentinthandler = NULL;
		/* Initialize mouse device. */
		if (ms.type == MOUSE_NONE || ms.type < MOUSE_MICROSOFT || ms.type > MOUSE_LAST)
			return -1;
		if (ms_init())
			return -1;
		/* Install interrupt handler. */
		ms.currentinthandler = mouse_int_handler;
		siga.sa_handler = mouse_int_handler;
		siga.sa_flags = 0;
		zero_sa_mask(&(siga.sa_mask));
		sigaction(SIGINT, &siga, &ms.oldsiga);
		ms.mouse_open = 1;
	}
	return ms.fd;	/* Return mouse fd. */
}
コード例 #7
0
static int tester_init(void) {
	ms_init();
	ortp_init();
	rtp_profile_set_payload(&rtp_profile, T140_PAYLOAD_TYPE, &payload_type_t140);
	rtp_profile_set_payload(&rtp_profile, T140_RED_PAYLOAD_TYPE, &payload_type_t140_red);
	return 0;
}
コード例 #8
0
ファイル: menustate.c プロジェクト: ratalaika/big-15
/**
 * Menustate implementation. Must initialize it, run the loop and clean it up
 * 
 * @return To which state it's switching
 */
state menustate() {
    GFraMe_ret rv;
    state ret;
    struct stMenustate ms;
    
    ret = -1;
    rv = ms_init(&ms);
    GFraMe_assertRet(rv == GFraMe_ret_ok, "Failed to init menustate", __ret);
    
    GFraMe_event_init(GAME_UFPS, GAME_DFPS);
    
    // Run the menu
    while (gl_running && ms.runMenu) {
        ms_event(&ms);
        ms_update(&ms);
        ms_draw(&ms);
    }
    // Set the next menu
    if (ms.curOpt == OPT_CONTINUE)
        ret = CNT_PLAYSTATE;
    else if (ms.curOpt == OPT_NEWGAME)
        ret = NEW_PLAYSTATE;
    else if (ms.curOpt == OPT_OPTIONS)
        ret = OPTIONS;
    else if (ms.curOpt == OPT_MAX)
        ret = DEMO;
__ret:
    ms_clean(&ms);
    return ret;
}
コード例 #9
0
ファイル: ring.c プロジェクト: Distrotech/mediastreamer2
int main(int argc, char *argv[]){
	RingStream *r;
	const char *file;
	MSSndCard *sc;
	const char * card_id=NULL;

	ortp_init();
	ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
	ms_init();
	if (argc>1){
		file=argv[1];
	}else file="/usr/share/sounds/linphone/rings/oldphone.wav";
	if (argc>2){
		card_id=argv[2];
	}

	sc=ms_snd_card_manager_get_card(ms_snd_card_manager_get(),card_id);
#ifdef __linux
	if (sc==NULL)
	  sc = ms_alsa_card_new_custom(card_id, card_id);
#endif

	r=ring_start(file,2000,sc);
	ms_sleep(10);
	ring_stop(r);
	return 0;
}
コード例 #10
0
int main(int argc, char *argv[]){
	MSFilter *f1,*f2;
	MSSndCard *card;
	MSTicker *ticker;
	char *card_id=NULL;
	ms_init();
	
	signal(SIGINT,stop);

	if (argc>1)
		card_id=argv[1];

	if (card_id!=NULL)
		card=ms_snd_card_manager_get_card(ms_snd_card_manager_get(),card_id);
	else card=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get());
	if (card==NULL){
		ms_error("No card.");
		return -1;
	}
	f1=ms_snd_card_create_reader(card);
	f2=ms_snd_card_create_writer(card);
	ticker=ms_ticker_new();
	ms_filter_link(f1,0,f2,0);
	ms_ticker_attach(ticker,f1);
	while(run)
		sleep(1);
	ms_ticker_detach(ticker,f1);
	ms_ticker_destroy(ticker);
	ms_filter_unlink(f1,0,f2,0);
	ms_filter_destroy(f1);
	ms_filter_destroy(f2);
	return 0;
}
コード例 #11
0
myAudioStream::myAudioStream(QString payload)
{
    if (!initialized) {
        ortp_set_log_level_mask(ORTP_DEBUG|ORTP_ERROR);
        ms_init();
        ortp_init();
        initialized = true;
    }

    if (!init_card()) {
        return;
    }
    if (!init_stream()) {
        return;
    }
    if (!init_filters(payload)) {
        return;
    }
    if (!link_filters()) {
        return;
    }
    if (!start_ticker()) {
        return;
    }
}
コード例 #12
0
static int tester_init(void) {
	ms_init();
	ms_filter_enable_statistics(TRUE);
	ortp_init();
	rtp_profile_set_payload(&rtp_profile, VP8_PAYLOAD_TYPE, &payload_type_vp8);
	rtp_profile_set_payload(&rtp_profile, H264_PAYLOAD_TYPE, &payload_type_h264);
	rtp_profile_set_payload(&rtp_profile, MP4V_PAYLOAD_TYPE, &payload_type_mp4v);
	return 0;
}
コード例 #13
0
int main(int argc, char *argv[]){
	
	ms_init();
	if (argc<2){
		ms_error("Usage: mtudiscover [host]");
		return -1;
	}
	ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
	printf("result: %i \n",ms_discover_mtu(argv[1]));
	return 0;
}
コード例 #14
0
ファイル: cclientsocket.c プロジェクト: passedaway/misc
/***************************************************************************************************
功能说明:客户端发送消息到服务器,dest为“999999”,src位“000000”
参数说明:
	输入参数:发送的消息
	输出参数:无
	返回:无
***************************************************************************************************/
int c_send_message_to_server(char *ms)
{
	if(g_c_client_socket_fd > 0 || ms == NULL)
	{
		Message *ms_s;

		if(user && user->userno)
			ms_s = ms_init("999999", user->userno, ms);
		else
			ms_s = ms_init("999999", "000000", ms);

		ms_send_message(g_c_client_socket_fd, ms_s);

		ms_exit(ms_s);

		return 1;
	}

	return 0;
}
コード例 #15
0
static int tester_init(void) {
	ms_init();
	ms_filter_enable_statistics(TRUE);
	ortp_init();
	rtp_profile_set_payload (&rtp_profile,0,&payload_type_pcmu8000);
	rtp_profile_set_payload (&rtp_profile,OPUS_PAYLOAD_TYPE,&payload_type_opus);
	rtp_profile_set_payload (&rtp_profile,SPEEX16_PAYLOAD_TYPE,&payload_type_speex_wb);
	rtp_profile_set_payload (&rtp_profile,SILK16_PAYLOAD_TYPE,&payload_type_silk_wb);
	rtp_profile_set_payload (&rtp_profile,PCMA8_PAYLOAD_TYPE,&payload_type_pcma8000);

	return 0;
}
コード例 #16
0
static void filter_register_tester(void) {
	MSFilter* filter;

	ms_init();
	ms_init();

	CU_ASSERT_PTR_NOT_NULL(ms_filter_lookup_by_name("MSVoidSource"));
	filter= ms_filter_create_decoder("pcma");
	CU_ASSERT_PTR_NOT_NULL(filter);
	ms_filter_destroy(filter);

	ms_exit();

	CU_ASSERT_PTR_NOT_NULL(ms_filter_lookup_by_name("MSVoidSource"));
	filter= ms_filter_create_decoder("pcma");
	CU_ASSERT_PTR_NOT_NULL(filter);
	ms_filter_destroy(filter);

	ms_exit();
	CU_ASSERT_PTR_NULL(ms_factory_get_fallback());
}
コード例 #17
0
ファイル: cclientsocket.c プロジェクト: passedaway/misc
/***************************************************************************************************
功能说明:客户端网络线程函数
参数说明:
	输入参数:
	输出参数:无
	返回:无
***************************************************************************************************/
void c_run_net()
{
	Message *ms = NULL;
	while(1)
    	while(is_run_net)
    	{
    		ms =ms_init(NULL, NULL, NULL);

    		if(ms_recv_message(g_c_client_socket_fd, ms) == -1)
    		{
    			memset(ms->data, 0, 1024);
    			ms = ms_init("000000", "999999", "cmd_exit");
    			c_analyse_message(ms);
    			is_run_net = 0;
    			ms_exit(ms);

    			c_client_socket_exit();
    		}

    		c_analyse_message(ms);
    		ms_exit(ms);
    	}
}
コード例 #18
0
ファイル: addfriendreply.cpp プロジェクト: passedaway/misc
void AddFriendReply::on_pushButtonDisagree_clicked()
{
	char req_info[256];

	Message *ms = ms_init( (char *)"999999", umw->userinfo->userno, NULL);

	memset(req_info, 0, 256);
	sprintf(req_info, "add_disagree+%s", a_userno);
	memcpy(ms->data+2*USERNO_LEN, req_info, strlen(req_info));

	ms_send_message(socket_fd, ms);
	ms_exit(ms);

	this->close();
}
コード例 #19
0
ファイル: message.cpp プロジェクト: passedaway/misc
int ms_send_message_to_server(int socket_fd, char *ms)
{
	if(socket_fd > 0 && ms != NULL)
	{
		Message *ms_s;

		ms_s = ms_init((char *)"999999", (char *)"000000", ms);

		ms_send_message(socket_fd, ms_s);

		ms_exit(ms_s);

		return 1;
	}

	return 0;
}
コード例 #20
0
int main(int argc, char *argv[]){
	VideoStream *vs;
	const char *devname="/dev/video0";
	int i;
	ms_init();

	/* this is to test the sequence start/stop */
	for(i=0;i<1;++i){
		vs=video_preview_start(devname);
#ifdef WIN32
		Sleep(5000);
#else
		sleep(5);
#endif
		video_preview_stop(vs);
	}
	return 0;
}
コード例 #21
0
ファイル: mouse.c プロジェクト: carlosphp/svgalib-1
int mouse_init_return_fd(char *dev, int type, int samplerate)
{
    struct sigaction siga;

    if (!mouse_open) {
	    if (strcmp(dev, "") == 0)
		m_dev = "/dev/mouse";
	    else
		m_dev = dev;
	    m_type = type & MOUSE_TYPE_MASK;
	    m_modem_ctl = type & ~MOUSE_TYPE_MASK;
	
	    m_sample = samplerate;
	
	    currentinthandler = NULL;
	
	    /* Initialize mouse device. */
	    if (m_type == MOUSE_UNCONFIGURED) {
	      fprintf(stderr,
		      "Warning: you have not yet configured your mouse type. If you have no mouse,\n"
		      "setting the type to `none' in " SVGALIB_CONFIG_FILE " will get rid of this\n"
		      "annoying message.\n");
	      return -1;
	    }
	    if (m_type == MOUSE_NONE || m_type < MOUSE_MICROSOFT || m_type > MOUSE_LAST)
		return -1;
	    if (ms_init())
		return -1;

	    /* Install default mouse handler. Old coordinates are preserved. */
	    __svgalib_mouse_eventhandler = default_handler;
	
	    /* Install interrupt handler. */
	    currentinthandler = inthandler;
	    siga.sa_handler = inthandler;
	    siga.sa_flags = 0;
	    zero_sa_mask(&(siga.sa_mask));
	    sigaction(SIGINT, &siga, &oldsiga);
	    mouse_open = 1;
    }
    return __svgalib_mouse_fd;	/* Return mouse fd. */
}
コード例 #22
0
ファイル: main.cpp プロジェクト: FihlaTV/conference
static void WINAPI mainp(int argc, char **argv)
{
#ifdef WIN32
	if (!_verbase) {
		if (regWinService() < 0)
			return;
	}
#endif // 

	log_init();
	ms_init();
	ortp_init();

#ifdef _DEBUG
	putenv("xmpp_domain=qddevsrv.zonekey");
#endif // debug	

	fprintf(stderr, "VER: %s\n", VERSION_STR);

	ortp_set_log_level_mask(ORTP_FATAL);
	zonekey_publisher_register();
	zonekey_void_register();
	zonekey_publisher_set_log_handler(log);
	libmsilbc_init();
	zonekey_audio_mixer_register();
	zonekey_audio_mixer_set_log_handler(log);
	zonekey_video_mixer_register();
	zonekey_video_mixer_set_log_handler(log);

	rtp_profile_set_payload(&av_profile, 100, &payload_type_h264);
	rtp_profile_set_payload(&av_profile, 110, &payload_type_speex_wb);
	rtp_profile_set_payload(&av_profile, 102, &payload_type_ilbc);

	Server server;
	server.run(&_quit);

#ifdef WIN32
	if (!_verbase)
		ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, 0);
	CloseHandle(_global_obj);
#endif
}
コード例 #23
0
ファイル: victory.c プロジェクト: OrangeTide/victory
static int ht_method(struct channel *ch, struct buffer *bu,
	size_t method_len, char *method_str, size_t uri_len, char *uri_str,
	size_t version_len, char *version_str)
{
	struct methodline_state ms;
	struct buffer method, uri, version;

	buffer_init(&method, method_str, method_len);
	buffer_init(&uri, uri_str, uri_len);
	buffer_init(&version, version_str, version_len);
	ms_init(&ms);
	while (!ch_fill(ch)) {
		if (methodline_parse(bu, &ms, &method, &uri, &version)) {
			ch_close(ch);
			return -1;
		}
		if (ms.done)
			break;
	}
	return 0;
}
コード例 #24
0
ファイル: tube.c プロジェクト: AlekSi/beanstalkd
tube
make_tube(const char *name)
{
    tube t;

    t = malloc(sizeof(struct tube));
    if (!t) return NULL;

    t->refs = 0;

    t->name[MAX_TUBE_NAME_LEN - 1] = '\0';
    strncpy(t->name, name, MAX_TUBE_NAME_LEN - 1);
    if (t->name[MAX_TUBE_NAME_LEN - 1] != '\0') twarnx("truncating tube name");

    t->ready.cmp = job_pri_cmp;
    t->delay.cmp = job_delay_cmp;
    t->ready.rec = job_setheappos;
    t->delay.rec = job_setheappos;
    t->buried = (struct job) { };
    t->buried.prev = t->buried.next = &t->buried;
    ms_init(&t->waiting, NULL, NULL);

    t->stat = (struct stats) {0, 0, 0, 0, 0};
    t->using_ct = t->watching_ct = 0;
    t->deadline_at = t->pause = 0;

    return t;
}

static void
tube_free(tube t)
{
    prot_remove_tube(t);
    free(t->ready.data);
    free(t->delay.data);
    ms_clear(&t->waiting);
    free(t);
}
コード例 #25
0
ファイル: zkmcu_hlp.cpp プロジェクト: FihlaTV/conference
void zkmcu_hlp_init()
{
	static bool _inited = false;
	static ost::Mutex _cs;
	
	ost::MutexLock al(_cs);

	if (!_inited) {
		ms_init();
		ortp_init();

		ortp_set_log_level_mask(ORTP_FATAL);

		zonekey_h264_source_register();
		zonekey_yuv_sink_register();
		zonekey_void_register();
		

		rtp_profile_set_payload(&av_profile, 100, &payload_type_h264);
		rtp_profile_set_payload(&av_profile, 110, &payload_type_speex_wb);
		rtp_profile_set_payload(&av_profile, 102, &payload_type_ilbc);
	}
}
コード例 #26
0
int main()
{
	ms_init();

	MSFilter *source = get_source();
	MSFilter *render = get_render();

	ms_filter_link(source, 0, render, 0);

	MSTicker *ticker = ms_ticker_new();
	ms_ticker_attach(ticker, source);

	while (true) {
		ms_sleep(1);
	}

	ms_ticker_destroy(ticker);

	ms_filter_destroy(render);
	ms_filter_destroy(source);

	return 0;
}
コード例 #27
0
ファイル: addfriendreply.cpp プロジェクト: passedaway/misc
void AddFriendReply::on_pushButtonAgree_clicked()
{
	char req_info[256];
	memset(req_info, 0, 256);

	QByteArray ba_nickname = ui->lineEdit->text().toLocal8Bit();
	char *aa_nickname = ba_nickname.data();

	strcpy(req_info, "add_agree+");
	strcpy(req_info+10, a_userno);
	req_info[10+6] = '+';
	memcpy(req_info+17, b_nickname, 64);
	req_info[17+64] = '+';
	strcpy(req_info+17+65, aa_nickname);

	Message *req_ms = ms_init((char *)"999999", umw->userinfo->userno, NULL);
	memcpy(req_ms->data+2*USERNO_LEN, req_info, 256);

	ms_send_message(socket_fd, req_ms);
	ms_exit(req_ms);

	QString *str_tmp = new QString();
	*str_tmp = QString(aa_nickname) + "(" + QString(a_userno) + ")";

	QTreeWidgetItem *child = new QTreeWidgetItem(QStringList(*str_tmp));
	umw->itemA->addChild(child);

	Friend *friend_tmp = (Friend*)malloc(sizeof(Friend));
	memcpy(friend_tmp->userno, a_userno, 7);
	memset(friend_tmp->nickname, 0, 57);
	strcpy(friend_tmp->nickname, aa_nickname);

    friendlist_add(umw->fls, friend_tmp);

	this->close();
}
コード例 #28
0
ファイル: mkdblk.c プロジェクト: danome/mm
int main(int argc, char **argv) {
    int     c;
    int     err;
    uint8_t buf[MS_BUF_SIZE];
    u32_t   pstart, pend, cstart, cend, dstart, dend;
    int     do_dblk_loc, do_panic0;

    while ((c = getopt_long(argc,argv,"c:d:p:DhvVw", longopts, NULL)) != EOF)
	switch (c) {
	  case 'c':
	      fprintf(stderr, "-c not implemented yet, defaults to 8192\n");
	      break;
	  case 'd':
	      fprintf(stderr, "-d not implemented yet, defaults to 0 (rest of partition\n");
	      break;
	  case 'D':
	      debug++;
	      break;
	  case 'h':
	      usage(argv[0]);
	      break;
	  case 'p':
	      fprintf(stderr, "-c not implemented yet, defaults to 128k\n");
	      break;
	  case 'v':
	      verbose++;
	      break;
	  case 'V':
	      fprintf(stderr, VERSION);
	      exit(0);
	      break;
	  case 'w':
	      do_write++;
	      break;
	  default:
	      usage(argv[0]);
	      break;
	}
    if (optind != argc - 1)
	usage(argv[0]);

    if (verbose)
	fprintf(stderr, VERSION);
    fx_hard_init();
    err = ms_init(argv[optind]);
    if (err == MS_READONLY) {
      fprintf(stderr, "mkdblk: %s is read only\n", argv[optind]);
      err = MS_OK;
      do_write = 0;
    }
    if (err) {
	fprintf(stderr, "ms_init: %s (0x%x)\n", ms_dsp_err(err), err);
	exit(1);
    }
    err = fx_set_buf(buf);
    if (err) {
	fprintf(stderr, "fx_set_buf: %s (0x%x)\n", fx_dsp_err(err), err);
	exit(1);
    }
    err = fx_init();
    if (err) {
	fprintf(stderr, "fx_init: %s (0x%x)\n", fx_dsp_err(err), err);
	exit(1);
    }
    if (!do_write) {
	display_info();
	exit(0);
    }
    do_dblk_loc = 1;
    do_panic0   = !msc.panic0_blk;
    err = fx_create_contig("PANIC001", "   ", panic_size, &pstart, &pend);
    if (err) {
	fprintf(stderr, "fx_create_contig: PANIC001: %s (0x%x)\n", fx_dsp_err(err), err);
	pstart = msc.panic_start;
	pend = msc.panic_end;
	do_dblk_loc = 0;
    }
    err = fx_create_contig("CNFG0001", "   ", config_size, &cstart, &cend);
    if (err) {
	fprintf(stderr, "fx_create_contig: CNFG0001: %s (0x%x)\n", fx_dsp_err(err), err);
	cstart = msc.config_start;
	cend   = msc.config_end;
	do_dblk_loc = 0;
    }
    err = fx_create_contig("DBLK0001", "   ", dblk_size, &dstart, &dend);
    if (err) {
	fprintf(stderr, "fx_create_contig: DBLK0001: %s (0x%x)\n", fx_dsp_err(err), err);
	dstart = msc.dblk_start;
	dend   = msc.dblk_end;
	do_dblk_loc = 0;
    }
    if (do_dblk_loc) {
      fprintf(stderr, "*** writing dblk locator\n");
      err = fx_write_locator(pstart, pend, cstart, cend, dstart, dend);
      if (err) {
	fprintf(stderr, "fx_write_locator: %s (0x%x)\n", fx_dsp_err(err), err);
	exit(1);
      }
      do_panic0 = 1;			/* always write if we wrote the dblk locator */
    }

    if (do_panic0) {
      fprintf(stderr, "*** writing PANIC0 blk\n");
      err = fx_write_panic0(pstart, pend);
      if (err) {
	fprintf(stderr, "fx_write_panic: %s (0x%x)\n", fx_dsp_err(err), err);
	exit(1);
      }
    }

    display_info();

    if (!do_dblk_loc && !do_panic0)
      fprintf(stderr, "*** no changes written\n");

    err = fx_set_buf(NULL);
    if (err) {
	fprintf(stderr, "fx_set_buf: %s (0x%x)\n", fx_dsp_err(err), err);
	exit(1);
    }
    return(0);
}
コード例 #29
0
static int sound_card_tester_init(void) {
	ms_init();
	ms_filter_enable_statistics(TRUE);
	return 0;
}
コード例 #30
0
ファイル: mainwindow.cpp プロジェクト: passedaway/misc
int MainWindow::login()
{
	socket_fd = socket_init(ip, port);

	if(!socket_fd)
	{
		return -1;
	}

	ms_send_message_to_server(socket_fd, (char *)"login");

	Message *ms = ms_init(NULL, NULL, NULL);
	ms_recv_message(socket_fd, ms);
	if( ms_is_ms_exit(ms) )
	{
		char *buf = new char[256];
		memset(buf, 0, 256);
		sprintf(buf, "\tSorry about this.\nThe Server has some exceptions, and disconnection to the client!\nPlease restart the client,and try agian!");
		QMessageBox::information(NULL, "ERROR", "Server has some expection!");
		delete buf;

		ms_exit(ms);
		return -1;
	}

	if( strcmp(ms_get_info(ms), (char *)"re-login") )
	{
		//server not reply "re-login"
		QMessageBox::information(NULL, "ERROR", "Server has some expection!");
		socket_close(socket_fd);
		socket_fd = 0;
		ms_exit(ms);
		return -1;
	}

	ms_exit(ms);

	bytea_userno = ui->lineEditUserno->text().toLocal8Bit();
	char *userno_p = bytea_userno.data();

	bytea_passwd = ui->lineEditPasswd->text().toLocal8Bit();
	char *passwd_p = bytea_passwd.data();

	ms = ms_init((char *)"999999", userno_p, passwd_p);
	ms_send_message(socket_fd, ms);
	ms_exit(ms);

	ms = ms_init(NULL, NULL, NULL);
	ms_recv_message(socket_fd, ms);
	if( ms_is_ms_exit(ms) )
	{
		char *buf = new char[256];
		memset(buf, 0, 256);
		sprintf(buf, "\tSorry about this.\nThe Server has some exceptions, and disconnection to the client!\nPlease restart the client,and try agian!");
		QMessageBox::information(NULL, "ERROR", "Server has some expection!");
		delete buf;

		ms_exit(ms);
		return -1;
	}

	if( strncmp(ms_get_info(ms), "login_success", strlen("login_success")) == 0 )
	{
		return 1;
	}else{
		return -2;
	}
}