void unix_cb_ready(bt_dev_t *dev) { DEBUG_STR("Device ready"); DEBUG_STR(dev->name); dev->state = BT_DEV_STATE_INQUIRY; bt_dev_pack_inquiry(dev, 5, NUM_PEERS); bt_dev_flush_hci(dev); }
// Create and start the frame thread int HAE_CreateFrameThread(void* context, HAE_FrameThreadProc proc) { if (proc) { long error; theFrameProc = proc; error = thr_create(NULL, NULL, PV_NativeFrameThreadProc, NULL, THR_BOUND | THR_NEW_LWP, &theFrameThread); if (error == 0) { error = thr_setprio(theFrameThread, 127); if (error == 0) { return 0; } else { DEBUG_STR("Failure to set priority of Solaris thread\n"); } } else { DEBUG_STR("Failure to create Solaris thread\n"); } theFrameProc = NULL; } return -1; }
void H264VideoStreamParser::analyze_hrd_parameters(BitVector& bv) { DEBUG_STR("BEGIN hrd_parameters"); unsigned cpb_cnt_minus1 = bv.get_expGolomb(); DEBUG_PRINT(cpb_cnt_minus1); unsigned bit_rate_scale = bv.getBits(4); DEBUG_PRINT(bit_rate_scale); unsigned cpb_size_scale = bv.getBits(4); DEBUG_PRINT(cpb_size_scale); for (unsigned SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; ++SchedSelIdx) { DEBUG_TAB; unsigned bit_rate_value_minus1 = bv.get_expGolomb(); DEBUG_PRINT(bit_rate_value_minus1); unsigned cpb_size_value_minus1 = bv.get_expGolomb(); DEBUG_PRINT(cpb_size_value_minus1); unsigned cbr_flag = bv.get1Bit(); DEBUG_PRINT(cbr_flag); } unsigned initial_cpb_removal_delay_length_minus1 = bv.getBits(5); DEBUG_PRINT(initial_cpb_removal_delay_length_minus1); unsigned cpb_removal_delay_length_minus1 = bv.getBits(5); DEBUG_PRINT(cpb_removal_delay_length_minus1); unsigned dpb_output_delay_length_minus1 = bv.getBits(5); DEBUG_PRINT(dpb_output_delay_length_minus1); unsigned time_offset_length = bv.getBits(5); DEBUG_PRINT(time_offset_length); DEBUG_STR("END hrd_parameters"); }
static bool invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) { char *argv[20]; char query[20]; int i; char *ptr, *tmp; if (identifier == identifiers->start) { DEBUG_STR("plugin->nmap->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); /* Just the URL argument can be passed from JavaScript */ if (argc != 1 || args[0].type != NPVariantType_String) return false; /* First argument should be command path/name */ i = 0; argv[i++] = ((shell_module *)nmap)->path; /* Set user-defined arguments */ switch (settings.query) { case 1: /* scan local neighboars */ if (snprintf(query, 20, "-sT")) argv[i++] = query; break; case 0: /* scan ports of a host */ default: /* nothing .. default for nmap command */ break; } /* FIXME: */ /* Test if there is ':' char -> IPv6 */ tmp = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); while (*tmp++ != '\0') { if (*tmp == ':') { argv[i++] = "-6"; break; } } /* Set the URL as the last argument */ argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); /* Set NULL-terminating argument */ argv[i++] = NULL; OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); if (shell->run((process *)result->value.objectValue, ((shell_module *)nmap)->path, argv)) return true; else return false; } DEBUG_STR("plugin->nmap->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); return false; }
int bt_serial_init(bt_dev_t *dev) { /* wait for module to reset itself */ DEBUG_STR("waiting for module reset"); uart_receive(dev->buf, 256); DEBUG_STR("module resetted"); return 1; }
static bool hasProperty(NPObject *obj, NPIdentifier identifier) { if (identifier == identifiers->found) { DEBUG_STR("plugin->whois->hasProperty(%s): true", DEBUG_IDENTIFIER(identifier)); return true; } DEBUG_STR("plugin->whois->hasProperty(%s): false", DEBUG_IDENTIFIER(identifier)); return false; }
static bool getProperty(NPObject *obj, NPIdentifier identifier, NPVariant *value) { if (identifier == identifiers->found) { DEBUG_STR("plugin->whois->getProperty(%s): true", DEBUG_IDENTIFIER(identifier)); BOOLEAN_TO_NPVARIANT(((shell_module *)whois)->found, *value); return true; } DEBUG_STR("plugin->whois->getProperty(%s): false", DEBUG_IDENTIFIER(identifier)); return false; }
void dump_vs_data(GX2VertexShader* vs) { DEBUG_INT(vs->size); DEBUG_VAR(vs->mode); DEBUG_INT(vs->uniformBlockCount); for(int i = 0; i < vs->uniformBlockCount; i++) { DEBUG_STR(vs->uniformBlocks[i].name); DEBUG_INT(vs->uniformBlocks[i].offset); DEBUG_INT(vs->uniformBlocks[i].size); } DEBUG_INT(vs->uniformVarCount); for(int i = 0; i < vs->uniformVarCount; i++) { DEBUG_STR(vs->uniformVars[i].name); DEBUG_INT(vs->uniformVars[i].offset); DEBUG_INT(vs->uniformVars[i].type); DEBUG_INT(vs->uniformVars[i].count); DEBUG_INT(vs->uniformVars[i].block); } DEBUG_INT(vs->initialValueCount); for(int i = 0; i < vs->initialValueCount; i++) { DEBUG_INT(vs->initialValues[i].offset); DEBUG_FLOAT(vs->initialValues[i].value[0]); DEBUG_FLOAT(vs->initialValues[i].value[1]); DEBUG_FLOAT(vs->initialValues[i].value[2]); DEBUG_FLOAT(vs->initialValues[i].value[3]); } DEBUG_INT(vs->loopVarCount); for(int i = 0; i < vs->loopVarCount; i++) { DEBUG_INT(vs->loopVars[i].offset); DEBUG_VAR(vs->loopVars[i].value); } DEBUG_INT(vs->samplerVarCount); for(int i = 0; i < vs->samplerVarCount; i++) { DEBUG_STR(vs->samplerVars[i].name); DEBUG_INT(vs->samplerVars[i].type); DEBUG_INT(vs->samplerVars[i].location); } for(int i = 0; i < vs->attribVarCount; i++) { DEBUG_STR(vs->attribVars[i].name); DEBUG_VAR(vs->attribVars[i].type); DEBUG_INT(vs->attribVars[i].location); DEBUG_INT(vs->attribVars[i].count); } }
int unix_cb_peer_found(bt_dev_t *dev, bt_peer_t *peer) { if (!peer) { DEBUG_STR("No Peer found"); dev->state = BT_DEV_STATE_INQUIRY; bt_dev_pack_inquiry(dev, 5, NUM_PEERS); bt_dev_flush_hci(dev); return 0; } else { DEBUG_STR("Peer found"); io_bd_addr(peer->bd_addr); return 1; /* CONNECT */ } }
static bool invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) { char *argv[20]; char query[20]; int i; char *ptr; if (identifier == identifiers->start) { DEBUG_STR("plugin->nslookup->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); /* Just the URL argument can be passed from JavaScript */ if (argc != 1 || args[0].type != NPVariantType_String) return false; /* First argument should be command path/name */ i = 0; argv[i++] = ((shell_module *)nslookup)->path; /* Set user-defined arguments */ switch (settings.query) { case 1: if (snprintf(query, 20, "-q=AAAA")) argv[i++] = query; break; case 0: default: /* nothing .. -q=A is default for nslookup command */ break; } /* Set the URL as the last argument */ argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); /* Set NULL-terminating argument */ argv[i++] = NULL; OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); if (shell->run((process *)result->value.objectValue, ((shell_module *)nslookup)->path, argv)) return true; else return false; } DEBUG_STR("plugin->nslookup->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); return false; }
void CSEIConnector::GetByNameL(const TDesC& aHost, TInt aPort) { iPort = aPort; TInt hostLength = aHost.Length(); iHost = new (ELeave) TUint16[hostLength]; for (TInt i = 0; i < hostLength; i++) { iHost[i] = static_cast<TUint16>(aHost[i]); } TPtrC hostPtr(iHost, hostLength); TInt statusint = iAddress.Input(hostPtr); if (statusint != KErrNone) { DEBUG("Opening resolver"); TInt err = iResolver.Open(iSocketServer, KAfInet, KProtocolInetTcp); if(err != KErrNone) { iDriver->Log(_L("Failed to open Resolver")); return; } DEBUG_STR("GetByName %S", hostPtr); iStatus = KRequestPending; iState = EGetByName; iResolver.GetByName(hostPtr, iEntry, iStatus); SetActive(); } else { iDriver->Log(_L("Host address error")); } }
/* * === FUNCTION ====================================================================== * Name: de_get_seed * Description: Check the exit status, if the exit status is set to true then return * false. Otherwise wait until a seed becomes available and then grab * it. * ===================================================================================== */ static bool de_get_seed( char **seed, Scheduler_t *sc ) { bool rv = true; bool found = false; DEBUG("waiting for available seed"); do { DEBUG("checking to see if exit has been called"); if ( chkExitStatus( sc ) ) { rv = false; DEBUG("exit routine called"); break; } DEBUG("checking if seed available"); scLock( sc ); if( seedAvailable(sc) ){ DEBUG("seed available"); *(seed) = schedulerGetSeed( sc ); DEBUG_STR("seed", *(seed)); found = true; } scUnlock( sc ); } while( !found && rv ); if( found) { DEBUG("got seed leaving loop"); } return found; }
static void destroy() { DEBUG_STR("whois->destroy()"); if (whois) shell->destroy_module((shell_module *)whois); }
const ExifHasher::Entry* ExifHasher::Get(size_t* count) { { std::unique_lock<decltype(mutex_)> locker(mutex_); DEBUG_OUT_LN(GET, "WAIT BEGIN(%s)", DEBUG_STR(*count)); new_entries_.wait(locker, [this, &count] { return new_entry_count_ >= *count || done_; }); *count = std::min(*count, new_entry_count_); DEBUG_OUT_LN(GET, "WAIT END(%s / %s)", DEBUG_STR(*count), DEBUG_STR(new_entry_count_)); new_entry_count_ -= *count; } auto begin = new_entry_->next; for (size_t i = 0; i < *count; ++i) new_entry_ = new_entry_->next; return begin; }
static JavaVM* PV_GetCurrentVM(void) { JavaVM* vmArray[2]; jsize count; jint result; count = 0; result = JNI_GetCreatedJavaVMs(vmArray, 2, &count); // ask for 2 if ((result == 0) && (count >= 1)) // error if not just 1 { if (count > 1) { DEBUG_STR("WARNING: JNI_GetCreatedJavaVMs() returned >1 VMs\n"); } return vmArray[0]; } DEBUG_STR("JNI_GetCreatedJavaVMs() returned error\n"); return NULL; }
/** Debug str */ TText* DEBUG_STR( HBufC* aStr ) { if ( aStr ) { return DEBUG_STR( aStr->Des() ); } else { return const_cast<TText*>( _L( "" ).Ptr() ); } }
TText* DEBUG_STR( TDes* aStr ) { if ( aStr ) { return DEBUG_STR( *aStr ); } else { return const_cast<TText*>( _L( "" ).Ptr() ); } }
void ExifHasher::Run(size_t progress_threshold, std::function<const char*(void)> path_gen, bool unique) { std::thread thr([this, path_gen, progress_threshold, unique] { unsigned char hash_buf[SHA_DIGEST_LENGTH]; std::string path; DEBUG_OUT_LN(RUN, "BEGIN"); while (!path.replace(0, std::string::npos, path_gen()).empty()) { DEBUG_OUT_LN(RUN, "path=%s | PROCESSING", path.c_str()); if (!HashExif(path, hash_buf)) continue; ExifHash h(hash_buf); if (unique && hashes_.count(h)) { std::cerr << "Exif hash conflict in: " << path << std::endl; // TODO continue; } tail_ = (tail_->next = new Entry(&*hashes_.insert(h).first, path)); if (hashes_.size() % progress_threshold == 0) { std::unique_lock<decltype(mutex_)> locker(mutex_); new_entry_count_ += progress_threshold; DEBUG_OUT_LN(RUN, "NOTIFY(%s)", DEBUG_STR(new_entry_count_)); new_entries_.notify_one(); } DEBUG_OUT_LN(RUN, "hash=%s; path=%s", DEBUG_STR(*tail_->hash), path.c_str()); } { std::unique_lock<decltype(mutex_)> locker(mutex_); new_entry_count_ += hashes_.size() % progress_threshold; done_ = true; DEBUG_OUT_LN(RUN, "DONE"); DEBUG_OUT_LN(RUN, "NOTIFY(%s)", DEBUG_STR(new_entry_count_)); new_entries_.notify_one(); } }); thr.detach(); }
/** * Shell destructor * */ static void destroy_shell() { DEBUG_STR("shell->destroy()"); if (buffer != NULL) browser->memfree(buffer); if (which_env[0] != NULL) browser->memfree(which_env[0]); if (shell != NULL) browser->memfree(shell); }
/** * Stop running process * * @param p Process to be stopped * @return True on success, false otherwise */ static bool process_stop(process *p) { /* return if the process is not running */ if (!p->running) { DEBUG_STR("process->stop(pid %d): false (not running)", p->pid); return false; } /* kill the process */ kill(p->pid, 9); waitpid(p->pid, NULL, 0); /* close read pipe */ close(p->pipe[0]); p->running = false; DEBUG_STR("process->stop(pid %d): true", p->pid); return true; }
// Stop and destroy the frame thread, wait up to 1/2 second for audio to finish int HAE_DestroyFrameThread(void* context) { if (theFrameThread) { thr_kill(theFrameThread, 0); theFrameThread = NULL; theFrameProc = NULL; return 0; } DEBUG_STR("PV_NativeFrameThreadProc() called when no thread started\n"); return -1; }
static void frontend_wiiu_exec(const char *path, bool should_load_game) { struct { u32 magic; u32 argc; char * argv[3]; char args[]; }*param = getApplicationEndAddr(); int len = 0; param->argc = 0; if(!path || !*path) { RARCH_LOG("No executable path provided, cannot Restart\n"); } DEBUG_STR(path); strcpy(param->args + len, elf_path_cst); param->argv[param->argc] = param->args + len; len += strlen(param->args + len) + 1; param->argc++; RARCH_LOG("Attempt to load core: [%s].\n", path); #ifndef IS_SALAMANDER if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT)) { strcpy(param->args + len, path_get(RARCH_PATH_CONTENT)); param->argv[param->argc] = param->args + len; len += strlen(param->args + len) + 1; param->argc++; RARCH_LOG("content path: [%s].\n", path_get(RARCH_PATH_CONTENT)); } #endif param->argv[param->argc] = NULL; { if (HBL_loadToMemory(path, (u32)param->args - (u32)param + len) < 0) RARCH_LOG("Failed to load core\n"); else { param->magic = ARGV_MAGIC; ARGV_PTR = param; DEBUG_VAR(param->argc); DEBUG_VAR(param->argv); } } }
static void* PV_NativeFrameThreadProc(void* arg) { if (theFrameProc) { (*theFrameProc)(PV_CreateAudioContext()); PV_DestroyAudioContext(); } else { DEBUG_STR("PV_NativeFrameThreadProc() called when thread supposed to be dead!"); } return NULL; }
/** * Shell constructor * * @return True on success, false otherwise */ bool init_shell() { DEBUG_STR("shell->init()"); /* allocate shell object */ if ((shell = browser->memalloc(sizeof(*shell))) == NULL) goto err_sh_alloc; shell->destroy = destroy_shell; shell->find = find_program_path; shell->run = run_command; shell->init_module = init_shell_module; shell->destroy_module = destroy_shell_module; shell->stop = process_stop; shell->read = process_read; /* allocate buffer */ if ((buffer = browser->memalloc(BUFLEN * sizeof(*buffer))) == NULL) goto err_buf_alloc; /* get user paths from variable PATH */ if ((user_paths = getenv("PATH")) == NULL) goto err_getenv; /* allocate modified PATH variable */ if ((which_env[0] = browser->memalloc((strlen(user_paths) + strlen(root_paths) + 1) * sizeof(*which_env))) == NULL) goto err_env_alloc; /* add superuser paths into PATH variable: PATH="$PATH:/usr/sbin/:/sbin/" */ memcpy(which_env[0], "PATH=", strlen("PATH=")); memcpy(which_env[0] + strlen("PATH="), user_paths, strlen(user_paths)); strncpy(which_env[0] + strlen("PATH=") + strlen(user_paths), root_paths, strlen(root_paths)); return true; err_env_alloc: err_getenv: free(buffer); buffer = NULL; err_buf_alloc: free(shell); shell = NULL; err_sh_alloc: return false; }
int avr_inquiry_dev(bt_dev_t *dev) { unsigned int finished = 0; num_peers = 0; /* start inquiry */ DEBUG_STR("starting inquiry"); bt_dev_pack_inquiry(dev, 20, NUM_PEERS); bt_dev_flush_hci(dev); while (!finished) { switch (avr_read_hci(dev)) { case dev_evt_inquiry_results: { unsigned char num = *(dev->ptr - 1); unsigned int i; for (i = 0; (i < num) && (num_peers < NUM_PEERS); i++) { memcpy(peers[num_peers].bd_addr, dev->ptr, 6); dev->ptr += 6; peers[num_peers].pscan_rep_mode = UINT8_UNPACK(dev->ptr); peers[num_peers].pscan_per_mode = UINT8_UNPACK(dev->ptr); peers[num_peers].pscan_mode = UINT8_UNPACK(dev->ptr); memcpy(peers[num_peers].cod, dev->ptr, 3); dev->ptr += 3; peers[num_peers].clock_offset = UINT16_UNPACK(dev->ptr); num_peers++; } break; } case dev_evt_inquiry_complete_succ: finished = 1; break; case dev_evt_inquiry_complete_unsucc: finished = 1; num_peers = 0; break; default: break; } } return num_peers; }
static bool invokeMethod(NPObject *obj, NPIdentifier identifier, const NPVariant *args, uint32_t argc, NPVariant *result) { char *argv[20]; int i; char *ptr; if (identifier == identifiers->start) { DEBUG_STR("plugin->whois->invokeMethod(%s): true", DEBUG_IDENTIFIER(identifier)); /* Just the URL argument can be passed from JavaScript */ if (argc != 1 || args[0].type != NPVariantType_String) return false; /* First argument should be command path/name */ i = 0; argv[i++] = ((shell_module *)whois)->path; /* Set the URL as the last argument */ argv[i++] = (char *)STRING_UTF8CHARACTERS(args[0].value.stringValue); /* Set NULL-terminating argument */ argv[i++] = NULL; OBJECT_TO_NPVARIANT(browser->createobject(((object *)obj)->instance, &processClass), *result); if (shell->run((process *)result->value.objectValue, ((shell_module *)whois)->path, argv)) return true; else return false; } DEBUG_STR("plugin->whois->invokeMethod(%s): false", DEBUG_IDENTIFIER(identifier)); return false; }
static void PV_DestroyAudioContext(void) { JavaVM* const vm = PV_GetCurrentVM(); if (vm) { jint result; result = (*vm)->DetachCurrentThread(vm); if (result < 0) { DEBUG_STR("DetachCurrentThread() failed\n"); } } }
static void* wiiu_input_init(const char *joypad_driver) { wiiu_input_t *wiiu = (wiiu_input_t*)calloc(1, sizeof(*wiiu)); if (!wiiu) return NULL; DEBUG_STR(joypad_driver); wiiu->joypad = input_joypad_init_driver(joypad_driver, wiiu); KBDSetup(&kb_connection_callback, &kb_disconnection_callback,&kb_key_callback); input_keymaps_init_keyboard_lut(rarch_key_map_wiiu); return wiiu; }
static void* PV_CreateAudioContext(void) { JavaVM* const vm = PV_GetCurrentVM(); if (vm) { JNIEnv* env; JDK1_1AttachArgs args; // whatever jint result; result = (*vm)->AttachCurrentThread(vm, &env, &args); if (result >= 0) { return (void*)env; } DEBUG_STR("AttachCurrentThread() failed\n"); } return NULL; }
static THREAD_CALL PV_NativeFrameThreadProc(LPVOID lpv) { lpv; // eliminate unreferenced-parameter warning if (theFrameProc) { (*theFrameProc)(PV_CreateAudioContext()); PV_DestroyAudioContext(); } else { DEBUG_STR("PV_NativeFrameThreadProc() called when thread supposed to be dead!"); } #if USE_WIN32_THREAD_API ExitThread(0); #else _endthreadex(0); #endif return 0; }