bool CaseInsensitiveParamCheck( char *src, char *param, int maxlen = 255 ) { int i; for( i=0;i<maxlen && src[i] != 0 && param[i] != 0;i++) if( LowerCase(src[i]) != LowerCase(param[i]) ) return false; //we checked the whole param without finding a mismatch if( param[i] == 0 ) return true; return false; }
/** Decode a Bech32 string. */ std::pair<std::string, data> Decode(const std::string& str) { bool lower = false, upper = false; for (size_t i = 0; i < str.size(); ++i) { unsigned char c = str[i]; if (c < 33 || c > 126) return {}; if (c >= 'a' && c <= 'z') lower = true; if (c >= 'A' && c <= 'Z') upper = true; } if (lower && upper) return {}; size_t pos = str.rfind('1'); if (str.size() > 1023 || pos == str.npos || pos == 0 || pos + 7 > str.size()) { return {}; } data values(str.size() - 1 - pos); for (size_t i = 0; i < str.size() - 1 - pos; ++i) { unsigned char c = str[i + pos + 1]; int8_t rev = (c < 33 || c > 126) ? -1 : CHARSET_REV[c]; if (rev == -1) { return {}; } values[i] = rev; } std::string hrp; for (size_t i = 0; i < pos; ++i) { hrp += LowerCase(str[i]); } if (!VerifyChecksum(hrp, values)) { return {}; } return {hrp, data(values.begin(), values.end() - 6)}; }
//////////////////////////////////////////////////////////////////////////////// // vmVariables int vmVariables::GetVar (std::string name) { name = LowerCase (name); for (unsigned int i = 0; i < m_variables.size (); i++) if (m_variables [i].m_name == name) return i; return -1; }
//--------------------------------------------------------------------------- __fastcall THttpTestForm::THttpTestForm(TComponent* Owner) : TForm(Owner) { FIniFileName = LowerCase(ExtractFileName(Application->ExeName)); FIniFileName.SetLength(FIniFileName.Length() - 3); FIniFileName = FIniFileName + "ini"; }
char *LogoManager_ChannelNameToLogoName(char *ChannelName, char *LogoName, int LogoNameSize) { TRACEENTER(); char *pLogoName; char AllowedChars[] = "abcdefghijklmnoprqstuvwxyz0123456789הצ�+"; if(LogoName && LogoNameSize) { memset(LogoName, 0, LogoNameSize); strncpy(LogoName, SkipCharTableBytes(ChannelName), LogoNameSize - 1); StrMkISO(LogoName); MakeValidFileName(LogoName, ControlChars | LFChars); LowerCase(LogoName); pLogoName = LogoName; while(*pLogoName) { if(index(AllowedChars, *pLogoName) == NULL) DeleteAt(pLogoName, 0, 1); else pLogoName++; } StrReplace(LogoName, "ה", "ae"); StrReplace(LogoName, "צ", "oe"); StrReplace(LogoName, "�", "ue"); } TRACEEXIT(); return LogoName; }
//--------------------------------------------------------------------------- __fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner) { // Build Ini file name FIniFileName = LowerCase(ExtractFileName(Application->ExeName)); FIniFileName = FIniFileName.SubString(1, FIniFileName.Length() - 3) + "ini"; }
JSBool ADM_JSAvidemuxAudio::secondAudioTrack(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { ADM_JSAvidemuxAudio *p = (ADM_JSAvidemuxAudio *)JS_GetPrivate(cx, obj); if(argc != 2) return JS_FALSE; if(JSVAL_IS_STRING(argv[0]) == false || JSVAL_IS_STRING(argv[1]) == false) return JS_FALSE; // First arg is MP3 etc... char *name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0])); LowerCase(name); // First search the codec by its name AudioSource source; if(AudioInvalid==(source=audioCodecGetFromName(name))) return JS_FALSE; // Now get the name name = JS_GetStringBytes(JSVAL_TO_STRING(argv[1])); enterLock(); if(A_setSecondAudioTrack(source,name)) { leaveLock() return JS_TRUE; } leaveLock() return JS_FALSE; }
//--------------------------------------------------------------------------- __fastcall THttpTestForm::THttpTestForm(TComponent* Owner) : TForm(Owner) { // Build Ini file name FIniFileName = LowerCase(ChangeFileExt(Forms::Application->ExeName, ".ini")); FIniFileName = FIniFileName.SubString(1, FIniFileName.Length() - 3) + "ini"; }
int vmTypeLibrary::GetStruc (std::string name) { name = LowerCase (name); for (unsigned int i = 0; i < m_structures.size (); i++) { if (m_structures [i].m_name == name) return i; } return -1; }
//--------------------------------------------------------------------------- USEFORM("forms\unit_Main.cpp", form_Main); //--------------------------------------------------------------------------- void FindAndSendMesageToParent() { // ------ ’раню данные о процессах которые совпадают с именем софта ------ PROCESSENTRY32 *pr_entr_array = NULL; int pr_entr_ItemsCount = 0; // ----- PROCESSENTRY32 pr_entr; pr_entr.dwSize = sizeof( PROCESSENTRY32 ); THREADENTRY32 thr_entr; thr_entr.dwSize = sizeof( THREADENTRY32 ); HANDLE handle; // ---- ѕооиск процессов сопадающих с именем моего софта ----- handle = CreateToolhelp32Snapshot( TH32CS_SNAPALL, 0 ); if ( Process32First( handle, &pr_entr ) ) while ( Process32Next( handle, &pr_entr ) ) { if ( LowerCase( StrPas( pr_entr.szExeFile ) ) == LowerCase( ExtractFileName(Application->ExeName) )) { pr_entr_ItemsCount++; pr_entr_array = (PROCESSENTRY32 *) realloc (pr_entr_array, pr_entr_ItemsCount*sizeof(PROCESSENTRY32) ); memcpy(&pr_entr_array[pr_entr_ItemsCount-1], &pr_entr, sizeof(PROCESSENTRY32)); } } CloseHandle( handle ); // ---- »щу “рэды дл¤ которых совпадают ѕарент“ридјйди ----- handle = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); if ( Thread32First(handle, &thr_entr) ) while ( Thread32Next(handle, &thr_entr) ) for ( int i = 0; i < pr_entr_ItemsCount; i++) if ( pr_entr_array[i].th32ProcessID == thr_entr.th32OwnerProcessID ) { PostThreadMessage(thr_entr.th32ThreadID, WM_WAKEUP, 0, 0); //bs = GetLastError(); //if ( bs == ERROR_INVALID_THREAD_ID ) {} } CloseHandle( handle ); if ( pr_entr_array != NULL ) free(pr_entr_array); pr_entr_array = NULL; }
CString CBuildTarget::Name(const CString& Prefix, const int Case) const { switch (Case) { default: case 0: return Prefix+m_MFName; case 1: return LowerCase(Prefix)+m_LCName; case 2: return UpperCase(Prefix)+m_UCName; } }
bool CompareExt(char *filename, char *ext, bool cs=false) { if (cs) { char *file_ext = Ext(filename); LowerCase(ext); if (strcmp(file_ext, ext) == 0) return true; UpperCase(ext); if (strcmp(file_ext, ext) == 0) return true; return false; } else { return ( strcmp( Ext(filename), ext ) == 0 ); } }
CString CVirtualTarget::Name(const CString& Prefix) const { switch (m_NameCase) { default: case 0: return Prefix+m_MFName; case 1: return LowerCase(Prefix)+m_LCName; case 2: return UpperCase(Prefix)+m_UCName; } }
void ViewShader( const char *pFile, const char *pName ){ char* pBuff = 0; //int nSize = vfsLoadFile( pFile, reinterpret_cast<void**>( &pBuff ) ); if ( pBuff == 0 ) { globalErrorStream() << "Failed to load shader file " << pFile << "\n"; return; } // look for the shader declaration StringOutputStream strFind( string_length( pName ) ); strFind << LowerCase( pName ); StringOutputStream strLook( string_length( pBuff ) ); strFind << LowerCase( pBuff ); // offset used when jumping over commented out definitions std::size_t nOffset = 0; while ( true ) { const char* substr = strstr( strFind.c_str() + nOffset, strFind.c_str() ); if ( substr == 0 ) { break; } std::size_t nStart = substr - strLook.c_str(); // we have found something, maybe it's a commented out shader name? char *strCheck = new char[string_length( strLook.c_str() ) + 1]; strcpy( strCheck, strLook.c_str() ); strCheck[nStart] = 0; char *pCheck = strrchr( strCheck, '\n' ); // if there's a commentary sign in-between we'll continue if ( pCheck && strstr( pCheck, "//" ) ) { delete[] strCheck; nOffset = nStart + 1; continue; } delete[] strCheck; nOffset = nStart; break; } // now close the file vfsFreeFile( pBuff ); DoTextEditor( pFile, static_cast<int>( nOffset ) ); }
CString CVirtualTarget::Name(const CString& Prefix, const int TargetIndex) const { CString name = MakefileFriendly(m_Targets.GetString(TargetIndex)); switch (m_NameCase) { default: case 0: return name; case 1: return LowerCase(name); case 2: return UpperCase(name); } }
//--------------------------------------------------------------------------- // Возвращает значение атрибута, // если атрибут отсутствует, то возвращает значение DefaultValue bool __fastcall MSXMLWorks::GetAttributeValue(Variant Node, AnsiString AttributeName, bool DefaultValue) { AnsiString attribute = LowerCase(Trim(GetAttributeValue(Node, AttributeName))); // Ширина столбца if (attribute == "true") return true; else if (attribute == "false") return false; else return DefaultValue; }
int vmTypeLibrary::GetField (vmStructure& struc, std::string fieldName) { fieldName = LowerCase (fieldName); for ( int i = struc.m_firstField; i < struc.m_firstField + struc.m_fieldCount; i++) { assert (i >= 0); assert ((unsigned)i < m_fields.size ()); if (m_fields [i].m_name == fieldName) return i; } return -1; }
PWSTR WINAPI ToLowerCaseInPlace (PWSTR pBuffer) { if (!pBuffer) return NULL; WCHAR* pCh = pBuffer; while (*pCh != L'\0') { *pCh = LowerCase(*pCh); pCh++; } return pBuffer; }
int WINAPI CompareNoCase (PCWSTR szA, PCWSTR szB) { if (!szA) szA = szEmpty; if (!szB) szB = szEmpty; if (szA == szB) return 0; // same string WCHAR a, b; int dx = 0; do { a = *szA++; b = *szB++; dx = (a - b); if (dx && a) { a = LowerCase(a); b = LowerCase(b); dx = (a - b); if (dx) break; } } while (a); return ((dx < 0) ? -1 : (dx > 0)); }
PWSTR WINAPI ToLowerCase (PCWSTR pSrc, PWSTR pDst, size_t cch) { if (!pSrc) { *pDst = 0; return pDst; } WCHAR ch; if ((size_t)-1 == cch) { while ((ch = *pSrc++)) *pDst++ = LowerCase(ch); *pDst = 0; return pDst; } if (cch) { for (; cch && (ch = *pSrc++); cch--) *pDst++ = LowerCase(ch); if (cch) // if room, terminate *pDst = 0; } return pDst; }
JSBool ADM_JSAvidemuxAudio::Codec(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {// begin Codec ADM_JSAvidemuxAudio *p = (ADM_JSAvidemuxAudio *)JS_GetPrivate(cx, obj); // default return value *rval = BOOLEAN_TO_JSVAL(false); if(argc != 4) return JS_FALSE; if(JSVAL_IS_STRING(argv[0]) == false || JSVAL_IS_INT(argv[1]) == false || JSVAL_IS_INT(argv[2]) == false || JSVAL_IS_STRING(argv[3]) == false ) return JS_FALSE; char *name = JS_GetStringBytes(JSVAL_TO_STRING(argv[0])); LowerCase(name); enterLock(); // First search the codec by its name if(!audioCodecSetByName(name)) *rval = BOOLEAN_TO_JSVAL(false); else {// begin set bitrate //audioFilter_SetBitrate(JSVAL_TO_INT(argv[1])); uint32_t bitrate,size; char *extra; uint8_t *data=NULL; bitrate=JSVAL_TO_INT(argv[1]); size=JSVAL_TO_INT(argv[2]); extra=JS_GetStringBytes(JSVAL_TO_STRING(argv[3])); if(size) { data=new uint8_t[size]; for (uint32_t k = 0; k < size; k++) { data[k] = mk_hex (*extra, *(extra + 1)); extra += 3; } setAudioExtraConf(bitrate,size,data); delete [] data; }else{ audioFilter_SetBitrate(JSVAL_TO_INT(argv[1])); } *rval = BOOLEAN_TO_JSVAL(true); }// end set bitrate leaveLock() return JS_TRUE; }// end Codec
void CVirtualTarget::Read(const TiXmlElement *TargetRoot) { char *value = 0; if ((value = (char *)TargetRoot->Attribute("alias"))) { m_Alias = value; } if ((value = (char *)TargetRoot->Attribute("targets"))) { ParseStr(value,';',m_Targets); m_Targets.RemoveEmpty(); } // decorate target name { m_MFName = MakefileFriendly(m_Alias); m_UCName = UpperCase(m_MFName); m_LCName = LowerCase(m_MFName); } }
void LogoManager_ProcessLILAdd(char *AddFileName) { TRACEENTER(); TYPE_File *f; int fs; char *Text, Line[80]; HDD_TAP_PushDir(); HDD_ChangeDir(LOGOROOT); INIOpenFile(LILNAME, NULL); f = TAP_Hdd_Fopen(AddFileName); if(f) { fs = TAP_Hdd_Flen(f); Text = TAP_MemAlloc(fs+1); if(Text) { TAP_Hdd_Fread(Text, 1, fs, f); Text[fs] = '\0'; while(*Text) { ExtractLine(Text, Line); if(Line[0] == '0' && Line[1] == 'x' && Line[18] == '=') { LowerCase(Line); Line[18] = '\0'; INISetString(&Line[2], &Line[19]); } } TAP_MemFree(Text); } TAP_Hdd_Fclose(f); } INISaveFile(LILNAME, INILOCATION_AtCurrentDir, NULL); INICloseFile(); HDD_TAP_PopDir(); TRACEEXIT(); }
// ===================================================================== WINAPI WinMain(HINSTANCE, HINSTANCE, LPTSTR, int) { CreateMutex(NULL, FALSE, "ChildMom"); if( GetLastError() == ERROR_ALREADY_EXISTS ) { for (int i = 0; i <= ParamCount(); i++) if (LowerCase(ParamStr(i)) == "-show" ) { FindAndSendMesageToParent(); break; } return 0; } // ------------------ try { Application->Initialize(); Application->MainFormOnTaskBar = true; Application->CreateForm(__classid(Tform_Main), &form_Main); Application->Run(); } catch (Exception &exception) { Application->ShowException(&exception); } catch (...) { try { throw Exception(""); } catch (Exception &exception) { Application->ShowException(&exception); } } return 0; }
long CStr::FindInsensitive(const CStr& Str) const { return LowerCase().Find(Str.LowerCase()); }
long CStr::FindInsensitive(const tchar chr) const { return LowerCase().Find(_totlower(chr)); }
//--------------------------------------------------------------------------- __fastcall TSocksTestForm::TSocksTestForm(TComponent* Owner) : TForm(Owner) { FIniFileName = LowerCase(ExtractFileName(Application->ExeName)); FIniFileName = FIniFileName.SubString(1, FIniFileName.Length() - 3) + "ini"; }
bool StrToBoolDef(String bool_str, const bool def) { return (LowerCase(bool_str) == "true") ? true : def; }
bool StrToBool(String bool_str) { return (LowerCase(bool_str) == "true") ? true : false; }
void WrapLCase (TomVM& vm) { vm.RegString () = LowerCase (vm.GetStringParam (1)); }