bool mf::PlayAVInterface::mountUrl(QString& url, QString& err, int cacheSize) { QString cmd; cmd = currentPath + "/" + m_httpfs + " \"" + url + "\" " + m_mountPoint + m_httpfs; if (mount(cmd, err) == false) { err += " [1]"; return false; } url = findName(m_mountPoint + m_httpfs); if (url.isEmpty()) { err += QObject::tr("Program error!") + " [3]"; return false; } qDebug() << __PRETTY_FUNCTION__ << url; cmd = currentPath + "/" + m_preloadfs + " \"" + url + "\" " + m_mountPoint + m_preloadfs + " " + currentPath + " " + QString::number(cacheSize); if (mount(cmd, err) == false) { umountUrl(); err += " [2]"; return false; } url = findName(m_mountPoint + m_preloadfs); if (url.isEmpty()) { err += QObject::tr("Program error!") + " [4]"; return false; } qDebug() << __PRETTY_FUNCTION__ << url; return true; }
constrainFunc findFunc(char *path, char *funcName, size_t length) { constrainFunc func = noconstraints; #if 0 long int *version; libhandle = dlopen(path, RTLD_LAZY); if (libhandle == NULL) { fprintf(stderr, "Cannot find constrain module: %s\n", path); } else if ( (version = (long int *)findName(libhandle, idstring, sizeof(idstring) - 1) ) == NULL ) { fprintf(stderr, "Cannot establish version of constrain module\n"); closeLib(); } else if (MAJORVER(*version) != MAJOR) { fprintf(stderr, "Constrain module is not designed for this program\n"); closeLib(); } else if (MINORVER(*version) < MINOR) { fprintf(stderr, "Constrain module is designed for an older version of this program\n"); closeLib(); } else if ( (func = (constrainFunc) findName(libhandle, funcName, length) ) == NULL ) { fprintf(stderr, "Constrain module does not define constraints\n"); func = noconstraints; closeLib(); } if (func == noconstraints) fprintf(stderr, "Defaulting to no constraints\n"); #endif return func; }
void secondTestCase03(void) { int i; i = findName(unsortedList, -1, "Xd"); utest_assertEqualsInt(-1,i); i = findName(unsortedList, 0, "Xd"); utest_assertEqualsInt(-1,i); }
//---------------------------------------------------------------------------// long CAddInRawPrinter::FindMethod(const WCHAR_T* wsMethodName) { long plMethodNum = -1; wchar_t* name = 0; ::convFromShortWchar(&name, wsMethodName); plMethodNum = findName(g_MethodNames, name, eMeth_Last); if (plMethodNum == -1) plMethodNum = findName(g_MethodNamesRu, name, eMeth_Last); return plMethodNum; }
//---------------------------------------------------------------------------// long CAddInNative::FindProp(const WCHAR_T* wsPropName) { long plPropNum = -1; wchar_t* propName = 0; ::convFromShortWchar(&propName, wsPropName); plPropNum = findName(g_PropNames, propName, ePropLast); if (plPropNum == -1) plPropNum = findName(g_PropNamesRu, propName, ePropLast); delete[] propName; return plPropNum; }
void listener() { int s; int c; int l; struct sockaddr_in client_address; l = sizeof(client_address); memset(&client_address, 0, sizeof(client_address)); s = listen_socket(10002); char inbuffer [512]; char * name; while(1) { memset(inbuffer, 0, 512); c = accept(s, (struct sockaddr *) &client_address, &l); recv(c,inbuffer,512,0); name = findName(inet_ntoa(client_address.sin_addr)); if(name != NULL) printf(">>>%s: %s>",name, inbuffer); else printf(">>>unknown user: %s>", inbuffer); fflush(stdout); close(c); } close(s); }
/// Функция добавляет связь между детьми /// child - ребенок которому нравиться likeChild /// likeChild - нравящийся ребенок void childmap::addLike(string child, string likeChild) { int idChild, idLikeChild; idChild = findName(child); idLikeChild = findName(likeChild); if(idChild < 0) { throw invalid_argument("invalid first argument " + child ); } if(idLikeChild < 0) { throw invalid_argument("invalid second argument " + likeChild ); } if( idChild != idLikeChild ) (likesMap.operator [](idLikeChild)).insert(idChild); }
void listener(){ int s, c, l, r; struct sockaddr_in client_address; l = sizeof(client_address); memset(&client_address, 0, sizeof(client_address)); s = listen_socket(10002); char *message; char * name; while(1){ //memset(inbuffer, 0, 512); c = accept(s, (struct sockaddr *) &client_address, &l); receive_message(c, message); name = findName(inet_ntoa(client_address.sin_addr)); if (r != -1){ perror("receive"); close(c); return; } if(name != NULL) printf(">%s: %s>",name, message); else printf(">unknown user: %s>", message); fflush(stdout); close(c); } close(s); }
//---------------------------------------------------------------------------// long CAddInNative::FindMethod(const WCHAR_T* wsMethodName) { long plMethodNum = -1; wchar_t* name = 0; ::convFromShortWchar(&name, wsMethodName); plMethodNum = findName(g_MethodNames, name, eMethLast); if (plMethodNum == -1) plMethodNum = findName(g_MethodNamesRu, name, eMethLast); delete[] name; return plMethodNum; }
void saveMacro(char *n, node *p, int i) { symbol *q; symbol **b; DPRINT1(3,"saveMacro: named \"%s\"...\n",n); DSHOWTREE(3,0,"saveMacro: ",p); if (i == PERMANENT) b = ¯oCache; else b = &tempCache; if ( (q=findName(*b,n)) ) if (q->val) { TPRINT1("magic: macro \"%s\" already defined\n",n); } else { q->val = (char *)p; if (i == PERMANENT) renameAllocation("newMacro",q->name); } else { q = BaddName(b,n); q->val = (char *)p; if (i == PERMANENT) renameAllocation("newMacro",q->name); } }
AnimGroupEdit::AnimGroupEdit(WorldEdit* myWorld, int myId) : AnimGroup(myWorld, myId) { start_func assert(myWorld); // Find an unused "Untitled" name if (myId) { string findName("animations"); int pos = 1; while (myWorld->findAnimGroup(findName)) { findName = "animations "; findName += intToStr(++pos); } findName[0] = toupper(findName[0]); name = findName; headerModified = contentModified = 1; } else headerModified = contentModified = 0; nameL = name; toLower(nameL); browserNode = NULL; disassociated = 0; desktop->broadcastObjChange(OBJ_ANIMGROUP | OBJMOD_CREATE, this, 0, 0); }
int search(int devId, char names[64][128], int dirsRemaining, int pIno) { char buf[BLKSIZE]; INODE *parent; INODE *file; parent = get_inode(devId, pIno); int i = 0, tIno = 0; for(i = 0; i < 12 && !tIno && parent->i_block[i]; i++) { //getchar(); get_block(devId, parent->i_block[i], buf); tIno = findName(buf, names[0]); } if(!dirsRemaining) { //if we at the end of the search printf("Found %s at %d\n", names[0], tIno); return tIno; } else { file = get_inode(devId, tIno); if(S_ISDIR(file->i_mode)) { //getchar(); return search(devId, names + 1, dirsRemaining -1, tIno); } else { return 0; } } }
RowType *RowSetType::getRowType(const string &name) const { int idx = findName(name); if (idx < 0) return NULL; else return types_[idx]; }
void rmMacro(char *n) { symbol *p; if ( (p=findName(macroCache,n)) ) { dispose(p->val); p->val = NULL; } }
void TaskPacker::findTaskDetails(int index) { findDateAndTime(index); findDoneStatus(index); findLocation(index); findName(index); return; }
String lookUp (const String& placeholder) { if (placeholder == Font::getDefaultSansSerifFontName()) return sans; if (placeholder == Font::getDefaultSerifFontName()) return serif; if (placeholder == Font::getDefaultMonospacedFontName()) return mono; return findName (placeholder); }
varInfo *rfindVar(const char *n, symbol **pp) { symbol *p; if ( (p=findName((*pp),n)) ) return((varInfo *)(p->val)); else return(NULL); }
node *findMacro(char *n) { symbol *p; DPRINT1(3,"findMacro: named \"%s\"...",n); p=findName(macroCache,n); if (p == NULL) p = findName(tempCache,n); if (p != NULL) { DPRINT0(3," found!\n"); return((node *)(p->val)); } else { DPRINT0(3," NOT found!\n"); return(NULL); } }
void purgeOneMacro(char *n) { symbol *p; if ( (p=findName(macroCache,n)) ) { dispose(p->val); p->val = NULL; releaseAllWithId(n); delNameWithBalance(¯oCache,n); } }
void ActorManager::getInfoList( XeCore::XeString& out ) { for( XeCore::XeElementPointer< Pair > e = access().FirstPointer(); !e.IsEmpty(); e.Next() ) { XeCore::XeString n, t, a; t = (char*)e->value->getName(); findName( e->value, n ); a.Format( "0x%p", e() ); out << a << " <" << t << ">: " << n << "\n"; } }
//---------------------------------------------------------------------------// long CAddInNCR5976::FindMethod(const WCHAR_T* wsMethodName) { Debug::log("CAddInNCR5976::FindMethod"); long plMethodNum = -1; wchar_t* name = 0; ::convFromShortWchar(&name, wsMethodName); plMethodNum = findName(g_MethodNames, name); return plMethodNum;
void Option3() { askName(Name); int position = findName(Name); if (position == -1) { printf("Search Failed\n"); } else { printf("The position of Student in list : %d \n", position); } }
// This will return 1 if the variable exists, and 0 otherwise int is_variable_declared(const Table* table, const char* variable_name) { int return_value; Symbol* variable = findName(table, variable_name); if (variable != NULL) { return_value = 1; } else { printf("Error: Variavel %s nao declarada\n", variable_name); return_value = 0; } return return_value; }
//#define NUMERIC_PartialDeriv_CALC void BuildMatrix(BkgFitMatrixPacker *fit,bool accum, bool debug) { #if 1 (void) debug; fit->BuildMatrix(accum); #else mat_assembly_instruction *pinst = fit->instList; int lineInc=0; // build JTJ and RHS matricies for (int i=0; i < fit->nInstr; i++) { double sum=0.0; for (int j=0; j < pinst->cnt; j++) sum += cblas_sdot(pinst->si[j].len,pinst->si[j].src1,1,pinst->si[j].src2,1); if (accum) * (pinst->dst) += sum; else * (pinst->dst) = sum; if (debug) { char *src1Name = findName(pinst->si[0].src1); char *src2Name = findName(pinst->si[0].src2); printf("%d(%s--%s)(%lf) ",i,src1Name,src2Name,* (pinst->dst)); if (lineInc++ > 6) { printf("\n "); lineInc = 0; } } pinst++; } #endif }
int function_is_declared(const Table* functions_table, const char* function_name){ int return_value; Symbol* function = findName(functions_table, function_name); if (function != NULL) { return_value = 1; } else { printf("Error: Funcao %s nao declarada\n", function_name); return_value = 0; } return return_value; }
const CHelpSystemCore::CChm * CHelpSystemCore::FindChmByName(const CString & name) const { CString findName(name); findName.MakeLower(); CHMMAP::const_iterator i = m_chmNames.find(findName); if (i == m_chmNames.end()) { return NULL; } else { return &(*i->second); } }
varInfo *RcreateUVar(char *n, symbol **pp, int type) { symbol *p; varInfo *v; if (findName((*pp),n)) return(NULL); else { p = addName(pp,n); /* add name to tree */ v = newVar(); /* get new variable packet */ p->val = (char *)v; presetVal(v,type); /* preset values based on type */ } return(v); }
//---------------------------------------------------------------------------// long CAddInNCR5976::FindProp(const WCHAR_T* wsPropName) { Debug::log("CAddInNCR5976::FindProp"); long plPropNum = -1; wchar_t* propName = 0; ::convFromShortWchar(&propName, wsPropName); plPropNum = findName(g_PropNames, propName); delete[] propName; return plPropNum;
int purgeCache(int argc, char *argv[], int retc, char *retv[]) { if (argc == 1) { purgeAllMacros(); ABORT; } else if (argc == 2) { if (findName(macroCache,argv[1])) { purgeOneMacro(argv[1]); RETURN; } } RETURN; }
// This will return 1 if the variable is a number, and 0 otherwise int number(const Table* table, const char* variable_name) { int return_value; Symbol* variable = findName(table, variable_name); int is_declared = is_variable_declared(table, variable_name); if(is_declared){ if (strcmp(variable->type,"number") == 0) { return_value = 1; } else { printf("Error: A variavel %s nao possui valor numerico\n", variable_name); return_value = 0; } } else { return_value = is_declared; } return return_value; }