这篇教程C++ ERROR0函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ERROR0函数的典型用法代码示例。如果您正苦于以下问题:C++ ERROR0函数的具体用法?C++ ERROR0怎么用?C++ ERROR0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ERROR0函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Java_com_sun_media_sound_MixerSynth_nDestroySynthesizerJNIEXPORT void JNICALL Java_com_sun_media_sound_MixerSynth_nDestroySynthesizer(JNIEnv* e, jobject thisObj, jlong id) { GM_Song *pSong = (GM_Song *) (INT_PTR) id; TRACE0("Java_com_sun_media_sound_MixerSynth_nDestroySynthesizer./n"); if (pSong) { GM_KillSongNotes(pSong); pSong->disposeSongDataWhenDone = TRUE; // free our midi pointer GM_FreeSong((void *)e, pSong); } else { ERROR0("pSong is NULL/n"); } TRACE0("Java_com_sun_media_sound_MixerSynth_nDestroySynthesizer completed./n");}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:21,
示例2: anongame_wol_matchlist_destroyextern int anongame_wol_matchlist_destroy(void){ t_anongame_wol_player * player; t_elem * curr; if (anongame_wol_matchlist_head) { LIST_TRAVERSE(anongame_wol_matchlist_head,curr) { if (!(player = (t_anongame_wol_player*)elem_get_data(curr))) { /* should not happen */ ERROR0("wol_matchlist contains NULL item"); continue; } anongame_wol_player_destroy(player,&curr); } if (list_destroy(anongame_wol_matchlist_head)<0) return -1; anongame_wol_matchlist_head = NULL; } return 0;}
开发者ID:blast-hardcheese,项目名称:pvpgn,代码行数:21,
示例3: Java_com_sun_media_sound_MidiInDevice_nOpenJNIEXPORT jlong JNICALL Java_com_sun_media_sound_MidiInDevice_nOpen(JNIEnv* e, jobject thisObj, jint index) { MidiDeviceHandle* deviceHandle = NULL; TRACE1("Java_com_sun_media_sound_MidiInDevice_nOpen: index: %d/n", index);#if USE_PLATFORM_MIDI_IN == TRUE deviceHandle = MIDI_IN_OpenDevice((INT32) index);#endif // if we didn't get a valid handle, throw a MidiUnavailableException // $$kk: 06.24.99: should be getting more information here! if ( !deviceHandle ) { char *msg = "Failed to open the device./0"; ERROR0("Java_com_sun_media_sound_MidiInDevice_nOpen: Failed to open the device/n"); ThrowJavaMessageException(e, JAVA_MIDI_PACKAGE_NAME"/MidiUnavailableException", msg); } TRACE0("Java_com_sun_media_sound_MidiInDevice_nOpen succeeded/n"); return (jlong) (UINT_PTR) deviceHandle;}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:21,
示例4: apireglist_destroyextern int apireglist_destroy(void){ t_apiregmember * apiregmember; t_elem * curr; if (apireglist_head) { LIST_TRAVERSE(apireglist_head,curr) { if (!(apiregmember = (t_apiregmember*)elem_get_data(curr))) { ERROR0("channel list contains NULL item"); continue; } apiregmember_destroy(apiregmember,&curr); } if (list_destroy(apireglist_head)<0) return -1; apireglist_head = NULL; } return 0;}
开发者ID:DizKragnet,项目名称:pvpgn,代码行数:21,
示例5: switch char const * Directory::read() const { const char * result;#ifdef WIN32 switch (status) { default: case -1: /* couldn't rewind */ ERROR0("got status -1"); return 0; case 0: /* freshly opened */ status = 1; if (lFindHandle < 0) return 0; result = fileinfo.name; break; case 1: /* reading */ if (lFindHandle < 0) return 0; if (_findnext(lFindHandle, &fileinfo) < 0) { status = 2; return 0; } else result = fileinfo.name; break; case 2: /* EOF */ return 0; }#else /* POSIX */ struct dirent *dentry = dir ? readdir(dir) : 0; if (!dentry) return 0; result = dentry->d_name;#endif /* WIN32-POSIX */ if (!(strcmp(result, ".") && strcmp(result, ".."))) /* here we presume we don't get an infinite number of "." or ".." ;) */ return read(); return result; }
开发者ID:AleXoundOS,项目名称:pvpgn,代码行数:40,
示例6: DAUDIO_Write// returns -1 on errorint DAUDIO_Write(void* id, char* data, int byteSize) { AlsaPcmInfo* info = (AlsaPcmInfo*) id; int ret, count; snd_pcm_sframes_t frameSize, writtenFrames; TRACE1("> DAUDIO_Write %d bytes/n", byteSize); /* sanity */ if (byteSize <= 0 || info->frameSize <= 0) { ERROR2(" DAUDIO_Write: byteSize=%d, frameSize=%d!/n", (int) byteSize, (int) info->frameSize); TRACE0("< DAUDIO_Write returning -1/n"); return -1; } count = 2; // maximum number of trials to recover from underrun //frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize); frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize); do { writtenFrames = snd_pcm_writei(info->handle, (const void*) data, (snd_pcm_uframes_t) frameSize); if (writtenFrames < 0) { ret = xrun_recovery(info, (int) writtenFrames); if (ret <= 0) { TRACE1("DAUDIO_Write: xrun recovery returned %d -> return./n", ret); return ret; } if (count-- <= 0) { ERROR0("DAUDIO_Write: too many attempts to recover from xrun/suspend/n"); return -1; } } else { break; } } while (TRUE); //ret = snd_pcm_frames_to_bytes(info->handle, writtenFrames); ret = (int) (writtenFrames * info->frameSize); TRACE1("< DAUDIO_Write: returning %d bytes./n", ret); return ret;}
开发者ID:michalwarecki,项目名称:ManagedRuntimeInitiative,代码行数:40,
示例7: _handle_stats_requeststatic void _handle_stats_request(connection_t *con, http_parser_t *parser, char *uri){ stats_connection_t *stats; stats_event_inc(NULL, "stats_connections"); if (!connection_check_admin_pass(parser)) { ERROR0("Bad password for stats connection"); connection_close(con); httpp_destroy(parser); return; } stats_event_inc(NULL, "stats"); /* create stats connection and create stats handler thread */ stats = (stats_connection_t *)malloc(sizeof(stats_connection_t)); stats->parser = parser; stats->con = con; thread_create("Stats Connection", stats_connection, (void *)stats, THREAD_DETACHED);}
开发者ID:miksago,项目名称:icecast,代码行数:23,
示例8: _parse_directorystatic int _parse_directory (xmlNodePtr node, void *arg){ ice_config_t *config = arg; struct cfg_tag icecast_tags[] = { { "yp-url", config_get_str, &config->yp_url [config->num_yp_directories]}, { "yp-url-timeout", config_get_int, &config->yp_url_timeout [config->num_yp_directories]}, { "touch-interval", config_get_int, &config->yp_touch_interval [config->num_yp_directories]}, { NULL, NULL, NULL } }; if (config->num_yp_directories >= MAX_YP_DIRECTORIES) { ERROR0("Maximum number of yp directories exceeded!"); return -1; } if (parse_xml_tags (node, icecast_tags)) return -1; config->num_yp_directories++; return 0;}
开发者ID:miksago,项目名称:icecast,代码行数:23,
示例9: Java_com_sun_media_sound_MixerSynth_nStartSynthesizerJNIEXPORT jboolean JNICALL Java_com_sun_media_sound_MixerSynth_nStartSynthesizer(JNIEnv* e, jobject thisObj, jlong id) { OPErr opErr = NO_ERR; GM_Song *pSong = (GM_Song *) (INT_PTR) id; TRACE0("Java_com_sun_media_sound_MixerSynth_nStartSynthesizer./n"); // $$kk: 03.23.98: hard coding instrument loading here opErr = GM_StartLiveSong(pSong, 1); if (opErr) { ERROR0("FAILED TO START MIDI DIRECT: error on GM_StartLiveSong/n"); // $$kk: 09.17.98: what to do here? return (jboolean)FALSE; } TRACE0("Java_com_sun_media_sound_MixerSynth_nStartSynthesizer.completed/n"); return (jboolean)TRUE;}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:23,
示例10: sizeofintFDWEpollBackend::add(int idx, unsigned rw){// eventlog(eventlog_level_trace, __FUNCTION__, "called fd: %d rw: %d", fd, rw); struct epoll_event tmpev; std::memset(&tmpev, 0, sizeof(tmpev)); tmpev.events = 0; if (rw & fdwatch_type_read) tmpev.events |= EPOLLIN; if (rw & fdwatch_type_write) tmpev.events |= EPOLLOUT; int op = fdw_rw(fdw_fds + idx) ? EPOLL_CTL_MOD : EPOLL_CTL_ADD; tmpev.data.fd = idx; if (epoll_ctl(epfd, op, fdw_fd(fdw_fds + idx), &tmpev)) { ERROR0("got error from epoll_ctl()"); return -1; } return 0;}
开发者ID:DizKragnet,项目名称:pvpgn,代码行数:23,
示例11: MIDI_Utils_StopDeviceINT32 MIDI_Utils_StopDevice(MacMidiDeviceHandle* handle) { OSStatus err = noErr; if (!handle || !handle->h.deviceHandle) { ERROR0("ERROR: MIDI_Utils_StopDevice: handle or native handle is NULL/n"); return MIDI_INVALID_HANDLE; } if (handle->isStarted) { /* set the flag that we don't want to receive messages anymore */ handle->isStarted = FALSE; if (handle->direction == MIDI_IN) { err = MIDIPortDisconnectSource(inPort, (MIDIEndpointRef) (intptr_t) (handle->h.deviceHandle)); } else if (handle->direction == MIDI_OUT) { // Unschedules previously-sent packets. err = MIDIFlushOutput((MIDIEndpointRef) (intptr_t) handle->h.deviceHandle); } MIDI_CHECK_ERROR; } return MIDI_SUCCESS;}
开发者ID:kgilmer,项目名称:openjdk-7-mermaid,代码行数:23,
示例12: CreatePortControl// returns java controlstatic void* CreatePortControl(PortMixer *mixer, PortControlCreator *creator, PortControl::ControlType type, AudioControl **audioControls, int offset, int len) { void *jControl = NULL; PortControl *control = (PortControl *)calloc(1, sizeof(PortControl)); float precision = 0.01; control->type = type; control->controlCount = len; control->audioControls = (AudioControl **)malloc(len * sizeof(AudioControl *)); memcpy(control->audioControls, audioControls + offset, len * sizeof(AudioControl *)); switch (control->type) { case PortControl::Volume: jControl = creator->newFloatControl(creator, control, CONTROL_TYPE_VOLUME, 0, 1, precision, ""); break; case PortControl::Mute: jControl = creator->newBooleanControl(creator, control, CONTROL_TYPE_MUTE); break; case PortControl::Balance: jControl = creator->newFloatControl(creator, control, CONTROL_TYPE_BALANCE, -1, 1, precision, ""); break; }; if (jControl == NULL) { ERROR0("CreatePortControl: javaControl was not created/n"); free(control->audioControls); free(control); return NULL; } // add the control to mixer control list; control->next = mixer->portControls; mixer->portControls = control; return jControl;}
开发者ID:1d7500,项目名称:jdk7u-jdk,代码行数:37,
示例13: DAUDIO_Flushint DAUDIO_Flush(void* id, int isSource) { DS_Info* info = (DS_Info*) id; //TRACE0("DAUDIO_Flush/n"); if (info->isSource) { info->playBuffer->Stop(); DS_clearBuffer(info, false /* entire buffer */); } else { DWORD captureCursor, readCursor; /* set the read pointer to the current read position */ if (FAILED(info->captureBuffer->GetCurrentPosition(&captureCursor, &readCursor))) { ERROR0("DAUDIO_Flush: ERROR: Failed to get current position."); return false; } DS_clearBuffer(info, false /* entire buffer */); /* SHOULD set to *captureCursor*, * but that would be detected as overflow * in a subsequent GetAvailable() call. */ info->writePos = (int) readCursor; } return true;}
开发者ID:bao-boyle,项目名称:CZPlayer,代码行数:24,
示例14: process_initial_page/* a new BOS page has been seen so check which codec it is */static int process_initial_page (format_plugin_t *plugin, ogg_page *page){ ogg_state_t *ogg_info = plugin->_state; ogg_codec_t *codec; if (ogg_info->bos_completed) { ogg_info->bitrate = 0; ogg_info->codec_sync = NULL; /* need to zap old list of codecs when next group of BOS pages appear */ free_ogg_codecs (ogg_info); } do { codec = initial_vorbis_page (plugin, page); if (codec) break;#ifdef HAVE_THEORA codec = initial_theora_page (plugin, page); if (codec) break;#endif /* any others */ ERROR0 ("Seen BOS page with unknown type"); return -1; } while (0); if (codec) { /* add codec to list */ codec->next = ogg_info->codecs; ogg_info->codecs = codec; } return 0;}
开发者ID:kitsune-dsu,项目名称:kitsune-icecast,代码行数:37,
示例15: _parse_directorystatic void _parse_directory(xmlDocPtr doc, xmlNodePtr node, ice_config_t *configuration){ char *tmp; if (configuration->num_yp_directories >= MAX_YP_DIRECTORIES) { ERROR0("Maximum number of yp directories exceeded!"); return; } do { if (node == NULL) break; if (xmlIsBlankNode(node)) continue; if (xmlStrcmp (node->name, XMLSTR("yp-url")) == 0) { if (configuration->yp_url[configuration->num_yp_directories]) xmlFree(configuration->yp_url[configuration->num_yp_directories]); configuration->yp_url[configuration->num_yp_directories] = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); } else if (xmlStrcmp (node->name, XMLSTR("yp-url-timeout")) == 0) { tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); configuration->yp_url_timeout[configuration->num_yp_directories] = atoi(tmp); if (tmp) xmlFree(tmp); } else if (xmlStrcmp (node->name, XMLSTR("server")) == 0) { _add_server(doc, node->xmlChildrenNode, configuration); } else if (xmlStrcmp (node->name, XMLSTR("touch-interval")) == 0) { tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); configuration->yp_touch_interval[configuration->num_yp_directories] = atoi(tmp); if (tmp) xmlFree(tmp); } } while ((node = node->next)); if (configuration->yp_url [configuration->num_yp_directories] == NULL) return; configuration->num_yp_directories++;}
开发者ID:xaiki,项目名称:IceCast,代码行数:36,
示例16: Java_com_sun_media_sound_HeadspaceSoundbank_nGetInstrumentsJNIEXPORT void JNICALL Java_com_sun_media_sound_HeadspaceSoundbank_nGetInstruments(JNIEnv* e, jobject thisObj, jlong id, jobject instruments){ int index = 0; // current index as we iterate through the set of instruments in the bank int nameLength; // variables for vector operations jclass vectorClass; jmethodID addElementMethodID; // variables for java instrument manipulations jclass instrumentClass; jmethodID initMethodID; jobject newInstrumentObject; jstring newName; // variables for the XGetIndexedFileResource call XPTR pData; INT32 instrumentSize; XLongResourceID instrumentId; char instrumentName[BANK_NAME_MAX_SIZE]; //$$kk: what should the size be?? TRACE0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetInstruments/n"); // get the vector stuff set up vectorClass = (*e)->GetObjectClass(e, instruments); if (vectorClass == NULL) { ERROR0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetInstruments: vectorClass is NULL/n"); return; } addElementMethodID = (*e)->GetMethodID(e, vectorClass, "addElement", "(Ljava/lang/Object;)V"); if (addElementMethodID == NULL) { ERROR0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetInstruments: addElementMethodID is NULL/n"); return; } // get the HeadspaceInstrument class, init method id, etc. instrumentClass = (*e)->FindClass(e, "com/sun/media/sound/HeadspaceInstrument"); if (instrumentClass == NULL) { ERROR0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetInstruments: instrumentClass is NULL/n"); return; } initMethodID = (*e)->GetMethodID(e, instrumentClass, "<init>", "(Lcom/sun/media/sound/HeadspaceSoundbank;Ljava/lang/String;II)V"); if (initMethodID == NULL) { ERROR0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetInstruments: initMethodID is NULL/n"); return; } while (TRUE) { // get the next instrument pData = XGetIndexedFileResource((XFILE) (INT_PTR) id, ID_INST, &instrumentId, index, instrumentName, &instrumentSize); if (pData == NULL) { /* done getting instruments */ break; } XPtoCstr(instrumentName); // fix for 4429762: Some instrument names in some soundbanks include bad extra characters // since XPtoCstr() modifies the contents of instrumentName[], we can do so, too! nameLength = 0; while(instrumentName[nameLength]) nameLength++; while(nameLength > 0 && instrumentName[nameLength-1] < 32) { instrumentName[nameLength-1] = 0; nameLength--; } newName = (*e)->NewStringUTF(e, instrumentName); // create a HeadspaceInstrument object newInstrumentObject = (*e)->NewObject(e, instrumentClass, initMethodID, thisObj, (jstring)newName, (jint)instrumentId, (jint)instrumentSize); if (newInstrumentObject == NULL) { ERROR1("Java_com_sun_media_sound_HeadspaceSoundbank_nGetInstruments: Failed to get instantiate HeadspaceInstrument object for instrument id %lu./n", instrumentId); } else { // add it to the vector (*e)->CallVoidMethod(e, instruments, addElementMethodID, newInstrumentObject); } index++; }//.........这里部分代码省略.........
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:101,
示例17: Java_com_sun_media_sound_HeadspaceSoundbank_nGetSamplesJNIEXPORT void JNICALL Java_com_sun_media_sound_HeadspaceSoundbank_nGetSamples(JNIEnv* e, jobject thisObj, jlong id, jobject samples){ int index = 0; // current index as we iterate through the set of samples in the bank // variables for vector operations jclass vectorClass; jmethodID addElementMethodID; // variables for java sample manipulations jclass sampleClass; jmethodID initMethodID; jobject newSampleObject; jstring newName; // variables for the XGetIndexedFileResource call XPTR pData; INT32 sampleSize; XLongResourceID sampleId; char sampleName[BANK_NAME_MAX_SIZE]; //$$kk: what should the size be?? TRACE0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetSamples/n"); // get the vector stuff set up vectorClass = (*e)->GetObjectClass(e, samples); if (vectorClass == NULL) { ERROR0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetSamples: vectorClass is NULL/n"); return; } addElementMethodID = (*e)->GetMethodID(e, vectorClass, "addElement", "(Ljava/lang/Object;)V"); if (addElementMethodID == NULL) { ERROR0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetSamples: addElementMethodID is NULL/n"); return; } // get the HeadspaceSample class, init method id, etc. sampleClass = (*e)->FindClass(e, "com/sun/media/sound/HeadspaceSample"); if (sampleClass == NULL) { ERROR0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetSamples: sampleClass is NULL/n"); return; } initMethodID = (*e)->GetMethodID(e, sampleClass, "<init>", "(Lcom/sun/media/sound/HeadspaceSoundbank;Ljava/lang/String;III)V"); if (initMethodID == NULL) { ERROR0("Java_com_sun_media_sound_HeadspaceSoundbank_nGetSamples: initMethodID is NULL/n"); return; } while (TRUE) { // get the next instrument pData = XGetIndexedFileResource((XFILE) (INT_PTR) id, ID_INST, &sampleId, index, sampleName, &sampleSize); // look for compressed version first pData = XGetIndexedFileResource((XFILE) (INT_PTR) id, ID_CSND, &sampleId, index, sampleName, &sampleSize); if (pData == NULL) { // look for standard version pData = XGetIndexedFileResource((XFILE) (INT_PTR) id, ID_SND, &sampleId, index, sampleName, &sampleSize); if (pData == NULL) { // look for encrypted version pData = XGetIndexedFileResource((XFILE) (INT_PTR) id, ID_ESND, &sampleId, index, sampleName, &sampleSize); } } if (pData == NULL) { /* done getting instruments */ break; } XPtoCstr(sampleName); newName = (*e)->NewStringUTF(e, sampleName); // create a HeadspaceSample object newSampleObject = (*e)->NewObject(e, sampleClass, initMethodID, thisObj, (jstring)newName, (jint)index, (jint)sampleId, (jint)sampleSize); if (newSampleObject == NULL) { ERROR1("Java_com_sun_media_sound_HeadspaceSoundbank_nGetSamples: Failed to get instantiate HeadspaceSample object for sample id %lu./n", sampleId); } else {//.........这里部分代码省略.........
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:101,
示例18: pass_on//.........这里部分代码省略......... if (written < 0 && errno == EAGAIN) { /* * Nothing was written - this is really strange because * select() told us we could write. Ignore. */ } else if (written < 0) { /* * A write error. Assume that to_erl has terminated. */ clear_outbuf(); sf_close(wfd); wfd = 0; } else { /* Delete the written part (or all) from the buffer. */ outbuf_delete(written); } } /* * Read master pty and write to FIFO. */ if (FD_ISSET(mfd, &readfds)) {#ifdef DEBUG status("Pty master read; ");#endif if ((len = sf_read(mfd, buf, BUFSIZ)) <= 0) { sf_close(rfd); if(wfd) sf_close(wfd); sf_close(mfd); unlink(fifo1); unlink(fifo2); if (len < 0) { if(errno == EIO) ERROR0(LOG_ERR,"Erlang closed the connection."); else ERRNO_ERR0(LOG_ERR,"Error in reading from terminal"); exit(1); } exit(0); } write_to_log(&lfd, &lognum, buf, len); /* * Save in the output queue. */ if (wfd) { outbuf_append(buf, len); } } /* * Read from FIFO, write to master pty */ if (FD_ISSET(rfd, &readfds)) {#ifdef DEBUG status("FIFO read; ");#endif if ((len = sf_read(rfd, buf, BUFSIZ)) < 0) { sf_close(rfd); if(wfd) sf_close(wfd); sf_close(mfd); unlink(fifo1); unlink(fifo2); ERRNO_ERR0(LOG_ERR,"Error in reading from FIFO.");
开发者ID:aiyuefine,项目名称:otp,代码行数:67,
示例19: open_pty_master//.........这里部分代码省略......... { /* Unix98 style /dev/ptym/ptyXY and /dev/pty/ttyXY */ static char ptyname[] = "/dev/ptym/ptyXY"; static char ttyname[] = "/dev/pty/ttyXY"; for (major = majorchars; *major; major++) { ptyname[13] = *major; for (minor = minorchars; *minor; minor++) { ptyname[14] = *minor; if ((mfd = sf_open(ptyname, O_RDWR, 0)) >= 0) { ttyname[12] = *major; ttyname[13] = *minor; *ptyslave = ttyname; return mfd; } } } } { /* Old style /dev/ptyXY */ static char ptyname[] = "/dev/ptyXY"; for (major = majorchars; *major; major++) { ptyname[8] = *major; for (minor = minorchars; *minor; minor++) { ptyname[9] = *minor; if ((mfd = sf_open(ptyname, O_RDWR, 0)) >= 0) { ptyname[5] = 't'; *ptyslave = ptyname; return mfd; } } } }#endif /* !HAVE_OPENPTY */ return -1;}static int open_pty_slave(char *name){ int sfd; struct termios tty_rmode; if ((sfd = sf_open(name, O_RDWR, 0)) < 0) { return -1; }#if defined(__sun) && defined(__SVR4) /* Load the necessary STREAMS modules for Solaris */ if ((ioctl(sfd, I_FIND, "ldterm")) < 0) { ERROR0(LOG_ERR, "Failed to find ldterm STREAMS module"); return -1; } if (ioctl(sfd, I_PUSH, "ptem") < 0) { ERROR0(LOG_ERR, "Failed to push ptem STREAMS module"); return -1; } if (ioctl(sfd, I_PUSH, "ldterm") < 0) { ERROR0(LOG_ERR, "Failed to push ldterm STREAMS module"); return -1; } if (ioctl(sfd, I_PUSH, "ttcompat") < 0) { ERROR0(LOG_ERR, "Failed to push ttcompat STREAMS module"); return -1; }#endif if (getenv("RUN_ERL_DISABLE_FLOWCNTRL")) { if (tcgetattr(sfd, &tty_rmode) < 0) { fprintf(stderr, "Cannot get terminal's current mode/n"); exit(-1); } tty_rmode.c_iflag &= ~IXOFF; if (tcsetattr(sfd, TCSANOW, &tty_rmode) < 0) { fprintf(stderr, "Cannot disable terminal's flow control on input/n"); exit(-1); } tty_rmode.c_iflag &= ~IXON; if (tcsetattr(sfd, TCSANOW, &tty_rmode) < 0) { fprintf(stderr, "Cannot disable terminal's flow control on output/n"); exit(-1); } }#ifdef DEBUG if (tcgetattr(sfd, &tty_rmode) < 0) { fprintf(stderr, "Cannot get terminals current mode/n"); exit(-1); } show_terminal_settings(&tty_rmode);#endif return sfd;}
开发者ID:aiyuefine,项目名称:otp,代码行数:101,
示例20: DAUDIO_Openvoid* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource, int encoding, float sampleRate, int sampleSizeInBits, int frameSize, int channels, int isSigned, int isBigEndian, int bufferSizeInBytes) { snd_pcm_format_mask_t* formatMask; snd_pcm_format_t format; int dir; int ret = 0; AlsaPcmInfo* info = NULL; /* snd_pcm_uframes_t is 64 bit on 64-bit systems */ snd_pcm_uframes_t alsaPeriodSize = 0; snd_pcm_uframes_t alsaBufferSizeInFrames = 0; TRACE0("> DAUDIO_Open/n");#ifdef USE_TRACE // for using ALSA debug dump methods if (ALSA_OUTPUT == NULL) { snd_output_stdio_attach(&ALSA_OUTPUT, stdout, 0); }#endif info = (AlsaPcmInfo*) malloc(sizeof(AlsaPcmInfo)); if (!info) { ERROR0("Out of memory/n"); return NULL; } memset(info, 0, sizeof(AlsaPcmInfo)); ret = openPCMfromDeviceID(deviceID, &(info->handle), isSource, FALSE /* do open device*/); if (ret == 0) { // set to blocking mode snd_pcm_nonblock(info->handle, 0); ret = snd_pcm_hw_params_malloc(&(info->hwParams)); if (ret != 0) { ERROR1(" snd_pcm_hw_params_malloc returned error %d/n", ret); } else { ret = -1; if (getAlsaFormatFromFormat(&format, frameSize / channels, sampleSizeInBits, isSigned, isBigEndian, encoding)) { if (setHWParams(info, sampleRate, channels, bufferSizeInBytes / frameSize, format)) { info->frameSize = frameSize;#ifdef ALSA_PCM_NEW_HW_PARAMS_API ret = snd_pcm_hw_params_get_period_size(info->hwParams, &alsaPeriodSize, &dir); info->periodSize = (int) alsaPeriodSize; if (ret < 0) { ERROR1("ERROR: snd_pcm_hw_params_get_period: %s/n", snd_strerror(ret)); } snd_pcm_hw_params_get_periods(info->hwParams, &(info->periods), &dir); snd_pcm_hw_params_get_buffer_size(info->hwParams, &alsaBufferSizeInFrames); info->bufferSizeInBytes = (int) alsaBufferSizeInFrames * frameSize;#else info->periodSize = snd_pcm_hw_params_get_period_size(info->hwParams, &dir); info->periods = snd_pcm_hw_params_get_periods(info->hwParams, &dir); info->bufferSizeInBytes = snd_pcm_hw_params_get_buffer_size(info->hwParams) * frameSize; ret = 0;#endif TRACE3(" DAUDIO_Open: period size = %d frames, periods = %d. Buffer size: %d bytes./n", (int) info->periodSize, info->periods, info->bufferSizeInBytes); } } } if (ret == 0) { // set software parameters ret = snd_pcm_sw_params_malloc(&(info->swParams)); if (ret != 0) { ERROR1("snd_pcm_hw_params_malloc returned error %d/n", ret); } else { if (!setSWParams(info)) { ret = -1; } } } if (ret == 0) { // prepare device ret = snd_pcm_prepare(info->handle); if (ret < 0) { ERROR1("ERROR: snd_pcm_prepare: %s/n", snd_strerror(ret)); } }#ifdef GET_POSITION_METHOD2 if (ret == 0) { ret = snd_pcm_status_malloc(&(info->positionStatus)); if (ret != 0) { ERROR1("ERROR in snd_pcm_status_malloc: %s/n", snd_strerror(ret)); } }#endif } if (ret != 0) { DAUDIO_Close((void*) info, isSource); info = NULL; } else { // set to non-blocking mode snd_pcm_nonblock(info->handle, 1);//.........这里部分代码省略.........
开发者ID:michalwarecki,项目名称:ManagedRuntimeInitiative,代码行数:101,
示例21: pass_onint pass_on(ProgramState *s) { SIGSELECT sigsel[] = {0,FM_READ_PTR_REPLY}; union SIGNAL *sig; char child_read_buff[BUFSIZ], pipe_read_buff[BUFSIZ]; struct aiocb child_read_req, pipe_read_req; int rfd, wfd = 0; FmHandle rfh, child_rfh; int outstanding_writes = 0, got_some = 0, child_done = 0; if ((rfd = sf_open(s->r_pipe, O_RDONLY, 0)) < 0) { ERRNO_ERR1(LOG_ERR,"Could not open FIFO '%s' for reading./n", s->r_pipe); rfd = 0; return 1; } attach(NULL,s->progpid); /* Open the log file */ erts_run_erl_log_open(); efs_examine_fd(rfd,FLIB_FD_HANDLE,&rfh); efs_examine_fd(s->ifd,FLIB_FD_HANDLE,&child_rfh); READ_AIO(child_read_req,s->ifd,BUFSIZ,child_read_buff); READ_AIO(pipe_read_req,rfd,BUFSIZ,pipe_read_buff); while (1) { time_t now,last_activity; time(&last_activity); sig = receive_w_tmo(erts_run_erl_log_alive_minutes()*60000,sigsel); time(&now); if (sig) { erts_run_erl_log_activity(0,now,last_activity); } else { /* timeout */ erts_run_erl_log_activity(1,now,last_activity); continue; } switch (sig->signo) { case OS_ATTACH_SIG: { if (rfd) { sf_close(rfd); rfd = 0; } free_buf(&sig); child_done = 1; /* Make sure to to let all outstanding write request finish */ if (outstanding_writes) break; if (wfd) sf_close(wfd); return 0; } case FM_WRITE_PTR_REPLY: { if (sig->fm_write_ptr.status == EFS_SUCCESS) { if (sig->fm_write_ptr.actual < sig->fm_write_ptr.requested) { WRITE_AIO(wfd, sig->fm_write_ptr.requested-sig->fm_write_ptr.actual, sig->fm_write_ptr.buffer+sig->fm_write_ptr.actual); } } else { /* Assume to_erl has terminated. */ sf_close(wfd); wfd = 0; } free((char*)sig->fm_write_ptr.buffer); aio_dispatch(sig); if ((--outstanding_writes == 0) && child_done) { if (wfd) sf_close(wfd); return 0; } break; } case FM_READ_PTR_REPLY: { /* Child fd */ if (sig->fm_read_ptr.handle == child_rfh) { /* Child terminated */ if (sig->fm_read_ptr.status != EFS_SUCCESS || sig->fm_read_ptr.actual == 0) { if (rfd) { sf_close(rfd); rfd = 0; } if (sig->fm_read_ptr.status != EFS_SUCCESS) { ERROR0(LOG_ERR,"Erlang closed the connection."); aio_dispatch(sig); return 1; } /* child closed connection gracefully */ aio_dispatch(sig); if (outstanding_writes) { child_done = 1; break; } if (wfd) sf_close(wfd); return 0; } else { erts_run_erl_log_write(sig->fm_read_ptr.buffer,//.........这里部分代码省略.........
开发者ID:NaughtyCode,项目名称:otp,代码行数:101,
示例22: iteratePCMDevices// for each ALSA device, call iterator. userData is passed to the iterator// returns total number of iterationsint iteratePCMDevices(DeviceIteratorPtr iterator, void* userData) { int count = 0; int subdeviceCount; int card, dev, subDev; char devname[16]; int err; snd_ctl_t *handle; snd_pcm_t *pcm; snd_pcm_info_t* pcminfo; snd_ctl_card_info_t *cardinfo, *defcardinfo = NULL; UINT32 deviceID; int doContinue = TRUE; snd_pcm_info_malloc(&pcminfo); snd_ctl_card_info_malloc(&cardinfo); // 1st try "default" device err = snd_pcm_open(&pcm, ALSA_DEFAULT_DEVICE_NAME, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); if (err < 0) { // try with the other direction err = snd_pcm_open(&pcm, ALSA_DEFAULT_DEVICE_NAME, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK); } if (err < 0) { ERROR1("ERROR: snd_pcm_open (/"default/"): %s/n", snd_strerror(err)); } else { err = snd_pcm_info(pcm, pcminfo); snd_pcm_close(pcm); if (err < 0) { ERROR1("ERROR: snd_pcm_info (/"default/"): %s/n", snd_strerror(err)); } else { // try to get card info card = snd_pcm_info_get_card(pcminfo); if (card >= 0) { sprintf(devname, ALSA_HARDWARE_CARD, card); if (snd_ctl_open(&handle, devname, SND_CTL_NONBLOCK) >= 0) { if (snd_ctl_card_info(handle, cardinfo) >= 0) { defcardinfo = cardinfo; } snd_ctl_close(handle); } } // call callback function for the device if (iterator != NULL) { doContinue = (*iterator)(ALSA_DEFAULT_DEVICE_ID, pcminfo, defcardinfo, userData); } count++; } } // iterate cards card = -1; while (doContinue) { if (snd_card_next(&card) < 0) { break; } if (card < 0) { break; } sprintf(devname, ALSA_HARDWARE_CARD, card); TRACE1("Opening alsa device /"%s/".../n", devname); err = snd_ctl_open(&handle, devname, SND_CTL_NONBLOCK); if (err < 0) { ERROR2("ERROR: snd_ctl_open, card=%d: %s/n", card, snd_strerror(err)); } else { err = snd_ctl_card_info(handle, cardinfo); if (err < 0) { ERROR2("ERROR: snd_ctl_card_info, card=%d: %s/n", card, snd_strerror(err)); } else { dev = -1; while (doContinue) { if (snd_ctl_pcm_next_device(handle, &dev) < 0) { ERROR0("snd_ctl_pcm_next_device/n"); } if (dev < 0) { break; } snd_pcm_info_set_device(pcminfo, dev); snd_pcm_info_set_subdevice(pcminfo, 0); snd_pcm_info_set_stream(pcminfo, SND_PCM_STREAM_PLAYBACK); err = snd_ctl_pcm_info(handle, pcminfo); if (err == -ENOENT) { // try with the other direction snd_pcm_info_set_stream(pcminfo, SND_PCM_STREAM_CAPTURE); err = snd_ctl_pcm_info(handle, pcminfo); } if (err < 0) { if (err != -ENOENT) { ERROR2("ERROR: snd_ctl_pcm_info, card=%d: %s", card, snd_strerror(err)); } } else { subdeviceCount = needEnumerateSubdevices(ALSA_PCM) ?//.........这里部分代码省略.........
开发者ID:Gustfh,项目名称:jdk8u-dev-jdk,代码行数:101,
示例23: Generate//.........这里部分代码省略......... DASSERT(ctrl->opt_allow_cmd); u8 * src = ctrl->opt_allow_cmd + info->index * ctrl->n_opt_specific; u8 * dest = opt_allow; int count = ctrl->n_opt_specific; while ( count-- > 0 ) *dest++ |= *src++; } } else if ( info->type & T_COPY_GRP ) { dest += sprintf(dest,"/n///t/t/t/t| OB_GRP_%s",info->c_name); if ( opt_allow && ctrl->opt_allow_grp ) { //PRINT("OR GRP %u/%s/n",info->index,info->c_name); u8 * src = ctrl->opt_allow_grp + info->index * ctrl->n_opt_specific; u8 * dest = opt_allow; int count = ctrl->n_opt_specific; while ( count-- > 0 ) *dest++ |= *src++; } } else if ( info->type & T_CMD_OPT ) { if (FindStringField(&ctrl->copt,info->c_name)) { dest += sprintf(dest,"/n///t/t/t/t| OB_%s",info->c_name); if ( opt_allow && info->index ) { //PRINT("ALLOW OPT %u/%s/n",info->index,info->c_name); opt_allow[info->index] = 1; } } else if (!FindStringField(&ctrl->gopt,info->c_name)) ERROR0(ERR_SEMANTIC,"Option not defined: %s %s --%s", tool_name, cmd_name, info->c_name ); } else if ( info->type & (T_CMD_BEG|T_GRP_BEG) ) break; ASSERT( dest < iobuf + sizeof(iobuf) ); info++; } if ( dest == iobuf ) fprintf(hf," 0,/n"); else fprintf(hf,"%s,/n",iobuf+8); } fprintf(hf,"///n//} enumOptionsBit;/n"); } //----- print enum enumCommands & CommandTab[] print_section(hf,sep1,"enum enumCommands"); fprintf(hf, "typedef enum enumCommands/n" "{/n" "/tCMD__NONE," ); if ( ctrl->n_cmd ) { print_section(cf,sep1,"CommandTab[]"); fputs("/n/n",hf); var_ptr += snprintf(var_ptr,var_end-var_ptr,
开发者ID:mirror,项目名称:wiimms-iso-tools,代码行数:67,
示例24: parsemaxmatoptions//.........这里部分代码省略......... break; case OPTCHUNKS: argnum++; if(argnum > (Uint) (argc-2)) { ERROR1("missing argument for option %s", options[OPTCHUNKS].optname); return -2; } if(sscanf(argv[argnum],"%ld",&readint) != 1 || readint <= 0) { ERROR2("argument %s for option %s is not a positive integer", argv[argnum],options[OPTCHUNKS].optname); return -3; } mmcallinfo->chunks = (Uint) readint; break; case OPTPREFIXLENGTH: argnum++; if(argnum > (Uint) (argc-2)) { ERROR1("missing argument for option %s", options[OPTPREFIXLENGTH].optname); return -2; } if(sscanf(argv[argnum],"%ld",&readint) != 1 || readint <= 0) { ERROR2("argument %s for option %s is not a positive integer", argv[argnum],options[OPTPREFIXLENGTH].optname); return -3; } mmcallinfo->prefix = (Uint) readint; break; case OPTH: case OPTHELP: showusage(argv[0],&options[0],(Uint) NUMOFOPTIONS); return 1; } } if(argnum > (Uint) (argc-2)) { ERROR0("missing file arguments"); return -4; } if(safestringcopy(&mmcallinfo->program[0],argv[0],PATH_MAX) != 0) { return -5; } if(safestringcopy(&mmcallinfo->subjectfile[0],argv[argnum],PATH_MAX) != 0) { return -6; } for(argnum++, mmcallinfo->numofqueryfiles = 0; argnum < (Uint) argc; mmcallinfo->numofqueryfiles++, argnum++) { if(mmcallinfo->numofqueryfiles >= (Uint) MAXNUMOFQUERYFILES) { ERROR1("too many query files, maximal number is %d", (int) MAXNUMOFQUERYFILES); return -7; } if(safestringcopy(&mmcallinfo->queryfilelist [mmcallinfo->numofqueryfiles][0], argv[argnum],PATH_MAX) != 0) { return -8; } } /* verify that mum options are not interchanged */ OPTIONEXCLUDE(OPTMUM,OPTMUMCAND); OPTIONEXCLUDE(OPTMUM,OPTMUMREF); OPTIONEXCLUDE(OPTMUM,OPTMAXMATCH); OPTIONEXCLUDE(OPTMUMCAND,OPTMAXMATCH); OPTIONEXCLUDE(OPTMUMREF,OPTMAXMATCH); if ( mmcallinfo->cmaxmatch ) { mmcallinfo->cmum = false; mmcallinfo->cmumcand = false; } else if ( mmcallinfo->cmum ) { } else /* default to cmumcand */ { mmcallinfo->cmumcand = true; } /* verify that the options -b and -r are not used at the same time */ OPTIONEXCLUDE(OPTCOMPUTEBOTHDIRECTIONS,OPTONLYREVERSECOMPLEMENT); /* verify that -c is only used in combination with either -b or -r */ OPTIONIMPLYEITHER2(OPTSHOWREVERSEPOSITIONS, OPTCOMPUTEBOTHDIRECTIONS,OPTONLYREVERSECOMPLEMENT); return 0;}
开发者ID:garviz,项目名称:Toci,代码行数:101,
示例25: get_authenticatorstatic int get_authenticator (auth_t *auth, config_options_t *options){ if (auth->type == NULL) { WARN0 ("no authentication type defined"); return -1; } do { DEBUG1 ("type is %s", auth->type); if (strcmp (auth->type, "url") == 0) {#ifdef HAVE_AUTH_URL if (auth_get_url_auth (auth, options) < 0) return -1; break;#else ERROR0 ("Auth URL disabled, no libcurl support"); return -1;#endif } if (strcmp (auth->type, "command") == 0) {#ifdef WIN32 ERROR1("Authenticator type: /"%s/" not supported on win32 platform", auth->type); return -1;#else if (auth_get_cmd_auth (auth, options) < 0) return -1; break;#endif } if (strcmp (auth->type, "htpasswd") == 0) { if (auth_get_htpasswd_auth (auth, options) < 0) return -1; break; } ERROR1("Unrecognised authenticator type: /"%s/"", auth->type); return -1; } while (0); while (options) { if (strcmp (options->name, "allow_duplicate_users") == 0) auth->flags |= atoi (options->value) ? AUTH_ALLOW_LISTENER_DUP : 0; else if (strcmp(options->name, "realm") == 0) auth->realm = (char*)xmlStrdup (XMLSTR(options->value)); else if (strcmp(options->name, "drop_existing_listener") == 0) auth->flags |= atoi (options->value) ? AUTH_DEL_EXISTING_LISTENER : 0; else if (strcmp (options->name, "rejected_mount") == 0) auth->rejected_mount = (char*)xmlStrdup (XMLSTR(options->value)); else if (strcmp(options->name, "handlers") == 0) auth->handlers = atoi (options->value); options = options->next; } if (auth->handlers < 1) auth->handlers = 3; if (auth->handlers > 100) auth->handlers = 100; return 0;}
开发者ID:balbinus,项目名称:icecast-kh,代码行数:62,
注:本文中的ERROR0函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ERROR2IF函数代码示例 C++ ERROR函数代码示例 |