void Translation::run(vector<string> pArgParam,string input, string output){ unused(pArgParam); ImagePNG* img = new ImagePNG(); img->load(input); double start = Data::get_time(); cout << &img << endl; translation(img,atoi(pArgParam[0].c_str()),atoi(pArgParam[1].c_str()), new Color(0,0,0,255)); if (Data::CHRONO) cout << description<<" effectue en " << 1000*(Data::get_time() - start)<<" ms"<<endl; img->save(output); }
int WINAPI WinMain (HINSTANCE hInstance ,HINSTANCE hPrevInstance ,LPSTR lpCmdLine ,int nCmdShow ) #endif // LMI_MSW defined. { // (Historical notes.) Using wx-2.5.1 and mpatrol-1.4.8, both // dynamically linked to this application built with gcc-3.2.3, // three memory leaks are reported with: // MPATROL_OPTIONS='SHOWUNFREED' // It's easier to trace them with: // MPATROL_OPTIONS='LOGALL SHOWUNFREED USEDEBUG' // Two are apparently mpatrol artifacts traceable to symbols: // [space follows leading underscores in reserved names] // "_ _ _ mp_findsource" // "_ _ _ mp_init" // The third is traceable in 'mpatrol.log' with 'USEDEBUG' to // Skeleton::GetEventHashTable() const // (although stepping through the code in gdb suggests it's really // WinMain(), and mpatrol or libbfd just got the symbol wrong) // and seems to be triggered the first time the program allocates // memory. The next line forces that to occur here; otherwise, // tracing this 'leak' becomes cumbersome and mysterious. std::string unused("Seems to trigger initialization of something."); int result = EXIT_FAILURE; try { initialize_application(); initialize_filesystem(); #ifndef LMI_MSW result = wxEntry(argc, argv); #else // LMI_MSW defined. result = wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); #endif // LMI_MSW defined. } catch(...) { try { report_exception(); } catch(...) { safely_show_message("Logic error: untrapped exception."); } } fenv_validate(); return result; }
static void terraform_default(struct rawmaterial *res, const region * r) { #define SHIFT 70 double modifier = 1.0 + ((rng_int() % (SHIFT * 2 + 1)) - SHIFT) * ((rng_int() % (SHIFT * 2 + 1)) - SHIFT) / 10000.0; res->amount = (int)(res->amount * modifier); /* random adjustment, +/- 91% */ if (res->amount < 1) res->amount = 1; unused(r); }
/* This function drops those values in the history which are older than the specified age of the history instance. */ void history::drop (void) { nr_double_t f = first (); nr_double_t l = last (); if (age > 0.0 && l - f > age) { int r, i = leftidx (); for (r = 0; i < t->getSize (); r++, i++) if (l - t->get (i) < age) break; r += unused () - 2; // keep 2 values being older than specified age if (r > 127) values->drop (r); } }
static void drawPixel(int mode,int x,int y,unsigned short color){ unused(mode); unsigned int pos = y * 640 + x; unsigned short _page = pos >> 16; /*! FIXME : 暂时将就下吧, !*/ if(_page != page){ page = _page; selectPlane(page << 2); } ((unsigned char *)0xa0000)[pos & 0xffff] = color; }
static void ollrb_itr_set_ref(iterator citr, const void* n_ref) { /* llrb does not permit to set ref, which would destroy the inner data structure. */ /* struct ollrb_itr* itr = (struct ollrb_itr*)citr; struct ollrb_node* node = NULL; dbg_assert(itr->__cast == ollrb_itr_cast); dbg_assert(itr->__current != NULL); node = container_of(itr->__current, struct ollrb_node, link); node->reference = n_ref; */ unused(citr); unused(n_ref); dbg_assert(false); return; }
Color TimeWarpSynchronousGVTManager::sendEventUpdate(std::shared_ptr<Event>& event) { unused(event); Color color = color_.load(); if (color == Color::WHITE) { white_msg_count_++; } return color; }
void Difference::run(vector<string> pArgParam,string input, string output){ unused(pArgParam); ImagePNG* img = new ImagePNG(); img->load(input); ImagePNG* img2 = new ImagePNG(); img2->load(pArgParam[0]); double start = Data::get_time(); difference(img, img2); if (Data::CHRONO) cout << description<<" effectue en " << 1000*(Data::get_time() - start)<<" ms"<<endl; img->save(output); }
vector<int> findSubstring(string s, vector<string> &dict) { /* You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters. For example, given: S: "barfoothefoobarman" L: ["foo", "bar"] You should return the indices: [0,9]. (order does not matter). */ size_t wordLength = dict.front().length(); size_t catLength = wordLength * dict.size(); vector<int> result; if (s.length() < catLength) { return result; } unordered_map<string, int> wordCount; for (auto const& word : dict) { ++wordCount[word]; } for (auto i = begin(s); i <= prev(end(s), catLength); ++i) { unordered_map<string, int> unused(wordCount); for (auto j = i; j != next(i, catLength); j += wordLength) { auto pos = unused.find(string(j, next(j, wordLength))); if (pos == unused.end() || pos->second == 0) { break; } if (--pos->second == 0) { unused.erase(pos); } } if (unused.size() == 0) { result.push_back(distance(begin(s), i)); } } return result; }
inline void virtual_free(void *ptr, u32 size) { #if PLATFORM_WINDOWS unused(size); VirtualFree((void *)ptr, 0, MEM_RELEASE); #else msync(ptr, size, MS_SYNC); munmap(ptr, size); #endif }
static void pidfile_close(void) { if (pidfile) { if (daemon_process) { rewind(pidfile); unused(ftruncate(fileno(pidfile), (off_t)0)); } fclose(pidfile); pidfile = NULL; } }
void Controller::update(unsigned long long timestamp, int midi_value) { unused(timestamp); switch (type) { case TYPE_LINEAR: if (midi_value > midi_midpoint) { midi_value -= midi_midpoint; value = value_midpoint + (value_max - value_midpoint) * midi_value / range_divisor_upper; } else { value = value_min + (value_midpoint - value_min) * midi_value / range_divisor_lower; } } }
MMError dylan_mm_register_thread(void *stackBot) { gc_teb_t gc_teb = current_gc_teb(); update_runtime_thread_count(1); zero_allocation_counter(gc_teb); unused(stackBot); return 0; }
nsresult nsJSUtils::EvaluateString(JSContext* aCx, JS::SourceBufferHolder& aSrcBuf, JS::Handle<JSObject*> aScopeObject, JS::CompileOptions& aCompileOptions, void **aOffThreadToken) { EvaluateOptions options; options.setNeedResult(false); JS::RootedValue unused(aCx); return EvaluateString(aCx, aSrcBuf, aScopeObject, aCompileOptions, options, &unused, aOffThreadToken); }
Timer::Timer() { if (m_freq == 0.0) // m_freq not initialized yet ? { LARGE_INTEGER li; auto res = QueryPerformanceFrequency(&li); bwem_assert(res); unused(res); m_freq = li.QuadPart / 1000.0; } Reset(); }
/** * @brief Write message to file * @copydetails ll_open_cb_t */ static int file_open(const char *name, enum ll_level level, struct url *u, void **priv) { unused(name); unused(level); assert(u); if (u->username || u->password || u->hostname || u->port || !u->path || u->query || u->fragment) { return (-1); } if (!(*priv = fopen(u->path, "w"))) { return (-1); } return (0); }
void * cookt(void * data) { unused(data); while(1) { sem_wait(&cookpillow); printf("COOK %d [+%d]\n",portions,M); usleep(rand()%90+10); portions = M; //printf("READY\n"); sem_post(&shout); } }
void fractional_progress::init(stream_size_type range) { unused(range); #ifndef TPIE_NDEBUG if (m_init_called) { std::stringstream s; s << "init() was called on a fractional_progress for which init had already been called. Subindicators were:" << std::endl; s << sub_indicators_ss(); TP_LOG_FATAL(s.str()); s.str(""); tpie::backtrace(s, 5); TP_LOG_DEBUG(s.str()); TP_LOG_FLUSH_LOG; } m_init_called=true; #endif if (m_pi) m_pi->init(23000); }
//------------------------------------------------------------------------------ //! void Socket::blocking( bool v ) { #if BASE_SOCKET_USE_BSD int f = fcntl( _impl->_sock, F_GETFL, 0 ); if( v ) { fcntl( _impl->_sock, F_SETFL, f | O_NONBLOCK ); } else { fcntl( _impl->_sock, F_SETFL, f & ~O_NONBLOCK ); } #elif BASE_SOCKET_USE_WINSOCK unused(v); #else #endif }
bool worldUpdatorAsync(uint64_t dt_nanos) { unused(dt_nanos); try { update(); } catch(const std::exception& ex) { //Utils::DebugBreak(); Utils::log(Utils::stringf("Exception occurred while updating world: %s", ex.what()), Utils::kLogLevelError); } catch(...) { //Utils::DebugBreak(); Utils::log("Exception occurred while updating world", Utils::kLogLevelError); } return true; }
static UINT __Format ( OUT LPTSTR* ppOutput, OUT UINT* pLen, IN LPCTSTR format, IN va_list& args ) { UINT len(0); if (format) { va_list newargs; va_copy(newargs, args); // Figure out the length. If we were given // a valid pointer that's long enough, use it // otherwise we need to reallocate it. len = VSCPRINTF(format, newargs)+1; if (len > *pLen) { // Delete the buffer ARRAY_DELETE(*ppOutput); // Resize the buffer. size_t unused(0); __Alloc(len, ppOutput, &unused); *pLen = len; } // Fill the buffer. if (*ppOutput) { SPRINTFNS(*ppOutput, *pLen, format, newargs); } } //else //{ // YOU'RE GETTING A NULL POINTER BACK! //} return len; }
template <size_t N, typename F> Vc_ALWAYS_INLINE void benchmark(F &&f) { TimeStampCounter tsc; auto cycles = tsc.cycles(); cycles = 0x7fffffff; for (int i = 0; i < 100; ++i) { tsc.start(); for (int j = 0; j < 10; ++j) { auto C = f(); unused(C); } tsc.stop(); cycles = std::min(cycles, tsc.cycles()); } //std::cout << cycles << " Cycles for " << N *N *(N + N - 1) << " FLOP => "; std::cout << std::setw(19) << std::setprecision(3) << double(N * N * (N + N - 1) * 10) / cycles; //<< " FLOP/cycle (" << variant << ")\n"; }
// To tylko test. Dzieki write mozna sprawdzic, ze rzeczywiscie // nasza skrzynka zachowuje sie tak jak powinna void * t2(void *data) { unused(data); char buffer[STRING_LENGTH]; sprintf(buffer,"\tSTART\n"); write(1,buffer,strlen(buffer)); sprintf(buffer,"\tPOST\n"); write(1,buffer,strlen(buffer)); cs_post("/sem"); write(1,buffer,strlen(buffer)); cs_post("/sem"); write(1,buffer,strlen(buffer)); cs_post("/sem"); write(1,buffer,strlen(buffer)); cs_post("/sem"); sprintf(buffer,"\tSTOP\n"); write(1,buffer,strlen(buffer)); return NULL; }
} static int list_close(URLContext *h) { struct list_mgt *mgt = h->priv_data; struct list_item *item,*item1; if(!mgt)return 0; item=mgt->item_list; if(mgt->cur_uio!=NULL) url_fclose(mgt->cur_uio); while(item!=NULL) { item1=item; item=item->next; av_free(item1); } av_free(mgt); unused(h); return 0;
static int list_close(URLContext *h) { struct list_mgt *mgt = h->priv_data; struct list_item *item,*item1; if(!mgt)return 0; item=mgt->item_list; if(mgt->cur_uio!=NULL) url_fclose(mgt->cur_uio); while(item!=NULL) { item1=item; item=item->next; if(item->ktype == KEY_AES_128){ if(item->key_ctx){ av_free(item->key_ctx); } if(item->crypto){ if(item->crypto->aes) av_free(item->crypto->aes); av_free(item->crypto->aes); } } av_free(item1); } int i; for (i = 0; i < mgt->n_variants; i++) { struct variant *var = mgt->variants[i]; av_free(var); } av_freep(&mgt->variants); mgt->n_variants = 0; if(NULL!=mgt->prefix){ av_free(mgt->prefix); mgt->prefix = NULL; } av_free(mgt); unused(h); return 0; }
void * t1(void * data) { unused(data); char buffer[STRING_LENGTH]; sprintf(buffer,"START\n"); write(1,buffer,strlen(buffer)); sprintf(buffer,"WAIT\n"); write(1,buffer,strlen(buffer)); cs_wait("/sem"); write(1,buffer,strlen(buffer)); cs_wait("/sem"); write(1,buffer,strlen(buffer)); cs_wait("/sem"); write(1,buffer,strlen(buffer)); cs_wait("/sem"); cs_wait("/sem"); sprintf(buffer,"STOP\n"); write(1,buffer,strlen(buffer)); return NULL; }
/* * Read STDIN and send to the bufferevent. */ static void v4c_send_stdin(evutil_socket_t fd, short what, void *ctx) { struct bufferevent *bev = ctx; char data[1024]; int rc; unused(what); if (!bev) { ERR("No client connected yet."); return; } rc = read(fd, data, sizeof (data)); if (rc < 0) { ERR("read() failed (%s).", strerror(errno)); return; } data[rc] = '\0'; evbuffer_add(bufferevent_get_output(bev), data, rc); }
int readAbs(void *buf, int sectors, int drive, int track, int head, int sect) { int rc; int ret = -1; int tries; unused(sectors); tries = 0; while (tries < 5) { rc = BosDiskSectorRead(buf, 1, drive, track, head, sect); if (rc == 0) { ret = 0; break; } BosDiskReset(drive); tries++; } return (ret); }
void ViBuffer::execute(ViFunctorParameter *data) { QMutexLocker locker(&mMutex); ViBufferStream *object = dynamic_cast<ViBufferStream*>(data); if(object != NULL) { if(object->mode() == QIODevice::ReadOnly) { --mReadStreamCount; } else if(object->mode() == QIODevice::WriteOnly) { --mWriteStreamCount; if(mWriteStreamCount == 0) { locker.unlock(); emit unused(); } } } }
void EngineView::update_selection() { if(!ImGui::IsWindowHovered() || !ImGui::IsMouseClicked(0)) { return; } Transformable* selected = nullptr; float score = std::numeric_limits<float>::max(); for(const auto& tr : context()->scene().scene().static_meshes()) { auto [pos, rot, scale] = tr->transform().decompose(); unused(rot); float radius = tr->radius() * std::max({scale.x(), scale.y(), scale.z()}); float sc = (pos - _picked_pos).length() / radius; if(sc < score) { selected = tr.get(); score = sc; } } context()->selection().set_selected(selected); }