String NybbleizeString(const String & s) { String retStr; ByteBuffer inBuf; inBuf.AdoptBuffer(s.Length(), (uint8 *) s()); status_t ret = NybbleizeData(inBuf, retStr); (void) inBuf.ReleaseBuffer(); if (ret != B_NO_ERROR) retStr.Clear(); return retStr; }
void GCContent::LoadRegions(String & regionsFile, GenomeSequence &genome, bool invertRegion) { if(regionsFile.Length()==0) return; if(genome.sequenceLength()==0) error("No reference genome loaded!\n"); IFILE fhRegions; fhRegions = ifopen(regionsFile.c_str(),"r"); if(fhRegions==NULL) error("Open regions file %s failed!\n", regionsFile.c_str()); regionIndicator.resize(genome.sequenceLength()); StringArray tokens; String buffer; int len; fprintf(stderr, "Loading region list..."); while (!ifeof(fhRegions)){ buffer.ReadLine(fhRegions); if (buffer.IsEmpty() || buffer[0] == '#') continue; tokens.AddTokens(buffer, WHITESPACE); if(tokens.Length() < 3) continue; genomeIndex_t startGenomeIndex = 0; int chromosomeIndex = tokens[1].AsInteger(); // use chromosome name (token[0]) and position (token[1]) to query genome index. startGenomeIndex = genome.getGenomePosition(tokens[0].c_str(), chromosomeIndex); if(startGenomeIndex >= regionIndicator.size() ) { //fprintf(stderr, "WARNING: region list section %s position %u is not found in the reference and skipped...\n", tokens[0].c_str(), chromosomeIndex); continue; } len = tokens[2].AsInteger() - tokens[1].AsInteger() + 1; for(uint32_t i=startGenomeIndex; i<startGenomeIndex+len; i++) regionIndicator[i] = true; tokens.Clear(); buffer.Clear(); } if (invertRegion) { fprintf(stderr, " invert region..."); for (uint32_t i = 0; i < regionIndicator.size(); i++) { regionIndicator[i] = !regionIndicator[i]; } } ifclose(fhRegions); fprintf(stderr, "DONE!\n"); }
bool StringHash::GetSignificantString(StringHash hash, String& strOut) { if (!gSignificantLookup.TryGetValue(hash, strOut)) { strOut.Clear(); return false; } return true; }
bool AnnotationInterface::ValidateProcess( const ProcessImplementation& p, String& whyNot ) const { const AnnotationInstance* r = dynamic_cast<const AnnotationInstance*>( &p ); if ( r == 0 ) { whyNot = "Not a Annotation instance."; return false; } whyNot.Clear(); return true; }
String Parser::TemplateParams(String& param) { const char *pos = lex.Pos(); CheckKey('<'); int level = 1; String id; bool gp = true; for(;;) { if(lex.IsId() && gp) id = lex.GetId(); else if(Key(',')) { ScAdd(param, id); id.Clear(); gp = true; } else if(Key('=')) { if(!id.IsEmpty()) { ScAdd(param, id); id.Clear(); } gp = false; } else if(Key('>')) { level--; if(level <= 0) { ScAdd(param, id); break; } } else if(Key('<')) level++; else ++lex; } return String(pos, lex.Pos()); }
void CIVPad::FromControlState(CControlState controlState, bool bCurrent) { #ifdef EXT_LOG CLogFile::Printf(__FUNCSIG__); #endif // Do we not have a valid pad? if(!m_pPad) return; strTemp.Clear(); strTemp.AppendF("%i",controlState.ucInVehicleMove[1]); if(atoi(strTemp.Get()) > 128) { controlState.ucInVehicleMove[0] = (unsigned char)'128'; controlState.ucInVehicleMove[1] = (unsigned char)'255'; GET_ANALOG_KEY(INPUT_VEH_MOVE_LEFT, controlState.ucInVehicleMove[0]); GET_ANALOG_KEY(INPUT_VEH_MOVE_RIGHT, controlState.ucInVehicleMove[1]); GET_ANALOG_KEY(INPUT_VEH_MOVE_UP, controlState.ucInVehicleMove[2]); GET_ANALOG_KEY(INPUT_VEH_MOVE_DOWN, controlState.ucInVehicleMove[3]); } else { GET_ANALOG_KEY(INPUT_VEH_MOVE_LEFT, controlState.ucInVehicleMove[0]); GET_ANALOG_KEY(INPUT_VEH_MOVE_RIGHT, controlState.ucInVehicleMove[1]); GET_ANALOG_KEY(INPUT_VEH_MOVE_UP, controlState.ucInVehicleMove[2]); GET_ANALOG_KEY(INPUT_VEH_MOVE_DOWN, controlState.ucInVehicleMove[3]); } GET_ANALOG_KEY(INPUT_MOVE_UP, controlState.ucOnFootMove[2]); GET_ANALOG_KEY(INPUT_MOVE_DOWN, controlState.ucOnFootMove[3]); GET_ANALOG_KEY(INPUT_VEH_BRAKE, controlState.ucInVehicleTriggers[0]); GET_ANALOG_KEY(INPUT_VEH_ACCELERATE, controlState.ucInVehicleTriggers[1]); GET_ANALOG_KEY(INPUT_VEH_MOVE_LEFT_2, controlState.ucInVehicleMove2[0]); GET_ANALOG_KEY(INPUT_VEH_MOVE_RIGHT_2, controlState.ucInVehicleMove2[1]); // Binary keys GET_BINARY_KEY(INPUT_ENTER, controlState.keys.bEnterExitVehicle); GET_BINARY_KEY(INPUT_SPRINT, controlState.keys.bSprint); GET_BINARY_KEY(INPUT_JUMP, controlState.keys.bJump); GET_BINARY_KEY(INPUT_ATTACK, controlState.keys.bAttack); GET_BINARY_KEY(INPUT_ATTACK2, controlState.keys.bAttack2); GET_BINARY_KEY(INPUT_AIM, controlState.keys.bAim); GET_BINARY_KEY(INPUT_FREE_AIM, controlState.keys.bFreeAim); GET_BINARY_KEY(INPUT_MELEE_ATTACK1, controlState.keys.bMeleeAttack1); GET_BINARY_KEY(INPUT_MELEE_ATTACK2, controlState.keys.bMeleeAttack2); GET_BINARY_KEY(INPUT_MELEE_KICK, controlState.keys.bMeleeKick); GET_BINARY_KEY(INPUT_MELEE_BLOCK, controlState.keys.bMeleeBlock); GET_BINARY_KEY(INPUT_VEH_HANDBRAKE, controlState.keys.bHandbrake); GET_BINARY_KEY(INPUT_VEH_HANDBRAKE_ALT, controlState.keys.bHandbrake2); GET_BINARY_KEY(INPUT_VEH_HORN, controlState.keys.bHorn); GET_BINARY_KEY(INPUT_VEH_ATTACK, controlState.keys.bDriveBy); GET_BINARY_KEY(INPUT_VEH_ATTACK2, controlState.keys.bHeliPrimaryFire); }
status_t NybbleizeData(const uint8 * b, uint32 numBytes, String & retString) { if (retString.Prealloc(numBytes*2) != B_NO_ERROR) return B_ERROR; retString.Clear(); for (uint32 i=0; i<numBytes; i++) { const uint8 c = b[i]; retString += ((c>>0)&0x0F)+'A'; retString += ((c>>4)&0x0F)+'A'; } return B_NO_ERROR; }
bool DebayerInstance::CanExecuteOn( const View& view, String& whyNot ) const { if ( view.Image().IsComplexSample() ) whyNot = "Debayer cannot be executed on complex images."; else if ( view.Image().Width() < 6 || view.Image().Height() < 6 ) whyNot = "Debayer needs an image of at least 6 by 6 pixels"; else { whyNot.Clear(); return true; } return false; }
result MyCardManager::ReadNameCardFromFile(Tizen::Base::String& name, Tizen::Base::String& number, Tizen::Base::String& address) { File file; String buffer; int length; result r = E_SUCCESS; r = file.Construct(App::GetInstance()->GetAppRootPath() + NFC_BUMP_MY_CARD_INFO_PATH, "r", false); TryReturn(r == E_SUCCESS, r, "Failed to open the file."); r = file.Seek(FILESEEKPOSITION_BEGIN, 0); TryReturn(r == E_SUCCESS, r, "Failed to repositions the file pointer."); //read user's name from data file r = file.Read(buffer); TryReturn(r == E_SUCCESS, r, "Failed to read my name from file."); length = buffer.GetLength(); buffer.SubString(0, length - 1, name); buffer.Clear(); //read user's phone number from data file r = file.Read(buffer); TryReturn(r == E_SUCCESS, r, "Failed to read my phone number from file."); length = buffer.GetLength(); buffer.SubString(0, length - 1, number); buffer.Clear(); //read user's e-mail address from data file r = file.Read(buffer); TryReturn(r == E_SUCCESS, r, "Failed to read my e-mail address from file."); length = buffer.GetLength(); buffer.SubString(0, length - 1, address); return r; }
void Ide::IdePaste(String& data) { data.Clear(); if(AcceptFiles(Clipboard())) { Vector<String> s = GetFiles(Clipboard()); for(int i = 0; i < s.GetCount(); i++) if(FileExists(s[i]) && IsTextFile(s[i], 10000)) { int64 len = GetFileLength(s[i]); if(len > 5000000 || data.GetLength() + len < 5000000) data.Cat(LoadFile(s[i])); } } }
void ColorCalibrationInterface::__EditCompleted( Edit& sender ) { try { String id = sender.Text(); id.Trim(); if ( id == TARGET_IMAGE ) id.Clear(); if ( !id.IsEmpty() ) { bool valid; size_type p = id.Find( "->" ); if ( p == String::notFound ) valid = id.IsValidIdentifier(); else valid = id.Left( p ).IsValidIdentifier() && id.Substring( p+2 ).IsValidIdentifier(); if ( !valid ) throw Error( "Invalid view identifier: " + id ); } if ( sender == GUI->WhiteReferenceView_Edit ) { instance.whiteReferenceViewId = id; sender.SetText( WHITE_REFERENCE_ID ); } else if ( sender == GUI->BackgroundReferenceView_Edit ) { instance.backgroundReferenceViewId = id; sender.SetText( BACKGROUND_REFERENCE_ID ); } return; } catch ( ... ) { if ( sender == GUI->WhiteReferenceView_Edit ) sender.SetText( WHITE_REFERENCE_ID ); else if ( sender == GUI->BackgroundReferenceView_Edit ) sender.SetText( BACKGROUND_REFERENCE_ID ); try { throw; } ERROR_HANDLER sender.SelectAll(); sender.Focus(); } }
bool PatternMatchMulti(const char *p, const char *s) { String pt; while(*p) { if(*p == ';' || *p == ',' || *p == ' ') { if(PatternMatch(pt, s)) return true; p++; while(*p == ';' || *p == ',' || *p == ' ') p++; pt.Clear(); } else pt.Cat(*p++); } return pt.IsEmpty() ? false : PatternMatch(pt, s); }
void Sqlite3Connection::Cancel() { if (current_stmt) { // if (sqlite3_reset(current_stmt) != SQLITE_OK) // session.SetError(sqlite3_errmsg(db), "Resetting statement: " + current_stmt_string); // if (sqlite3_finalize(current_stmt) != SQLITE_OK) // session.SetError(sqlite3_errmsg(db), "Finalizing statement: "+ current_stmt_string); //this seems to be the correct way how to do error recovery... sqlite3_finalize(current_stmt); current_stmt = NULL; current_stmt_string.Clear(); parse = true; } }
bool Speller::SetOld(const String& _data) { data = _data; const char *s = data; if(s >= data.End()) { data.Clear(); return false; } charset = *s++; s++;// reserved for prefixes dict = *s++; for(int i = 0; i < 256 - dict; i++) { if(s >= data.End()) { data.Clear(); return false; } voc[i] = s; while(*s) s++; s++; } line.Clear(); while(s < data.End()) { if(s + 8 >= data.End()) { data.Clear(); return false; } int code = Peek32le(s); s += 4; int len = Peek32le(s); s += 4; Line& l = line.Add(code); l.begin = (const byte *)s; s += len; l.end = (const byte *)s; }; return true; }
/** * Retrieves the full path of the executable. * * @param argv0 The first command-line argument. * @returns The path. */ String Application::GetExePath(const String& argv0) { String executablePath; #ifndef _WIN32 char buffer[MAXPATHLEN]; if (getcwd(buffer, sizeof(buffer)) == NULL) { BOOST_THROW_EXCEPTION(posix_error() << boost::errinfo_api_function("getcwd") << boost::errinfo_errno(errno)); } String workingDirectory = buffer; if (argv0[0] != '/') executablePath = workingDirectory + "/" + argv0; else executablePath = argv0; bool foundSlash = false; for (size_t i = 0; i < argv0.GetLength(); i++) { if (argv0[i] == '/') { foundSlash = true; break; } } if (!foundSlash) { const char *pathEnv = getenv("PATH"); if (pathEnv != NULL) { std::vector<String> paths; boost::algorithm::split(paths, pathEnv, boost::is_any_of(":")); bool foundPath = false; BOOST_FOREACH(String& path, paths) { String pathTest = path + "/" + argv0; if (access(pathTest.CStr(), X_OK) == 0) { executablePath = pathTest; foundPath = true; break; } } if (!foundPath) { executablePath.Clear(); BOOST_THROW_EXCEPTION(std::runtime_error("Could not determine executable path.")); } }
void Kamera::OnAppControlCompleted (const String &appControlId, const String &operationId, const IList *pResultList) { //This method is invoked when an application control callback event occurs. String* pCaptureResult = null; if (appControlId.Equals(APPCONTROL_CAMERA) && operationId.Equals(OPERATION_CAPTURE)) { pCaptureResult = (Osp::Base::String*)pResultList->GetAt(0); if (pCaptureResult->Equals(String(APPCONTROL_RESULT_SUCCEEDED))) { String eval; AppLog("Camera capture success."); String* pCapturePath = (String*)pResultList->GetAt(1); // copying to app Home Folder String homeFilename; homeFilename.Format(128, L"/Home/%S", File::GetFileName(*pCapturePath).GetPointer()); result r = File::Copy(*pCapturePath, homeFilename, true); if(IsFailed(r)) { AppLogException("Could not copy picture"); eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Could not copy picture')", callbackId.GetPointer()); AppLogDebug("%S", eval.GetPointer()); pWeb->EvaluateJavascriptN(eval); } // Uri imageUri; // imageUri.setUri(homeFilename); eval.Clear(); eval.Format(512, L"PhoneGap.callbacks['%S'].success('file://%S')", callbackId.GetPointer(), homeFilename.GetPointer()); AppLogDebug("%S", eval.GetPointer()); pWeb->EvaluateJavascriptN(eval); } else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_CANCELED))) { AppLog("Camera capture canceled."); String eval; eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Camera capture canceled')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); } else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_FAILED))) { AppLog("Camera capture failed."); String eval; eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Camera capture failed')", callbackId.GetPointer()); pWeb->EvaluateJavascriptN(eval); } } }
String FormattedStringva(CTSTR lpFormat, va_list arglist) { int iSize = vtscprintf(lpFormat, arglist); if(!iSize) return String(); String newString; newString.SetLength(iSize); int retVal = vtsprintf_s(newString, iSize+1, lpFormat, arglist); if(retVal == -1) return newString.Clear(); else return newString.SetLength(retVal); }
/* ================ idLexer::ExpectTokenType ================ */ int idLexer::ExpectTokenType( int type, int subtype, idToken *token ) { String str; if ( !idLexer::ReadToken( token ) ) { idLexer::Error( "couldn't read expected token" ); return 0; } if ( token->type != type ) { switch( type ) { case TT_STRING: str = "string"; break; case TT_LITERAL: str = "literal"; break; case TT_NUMBER: str = "number"; break; case TT_NAME: str = "name"; break; case TT_PUNCTUATION: str = "punctuation"; break; default: str = "unknown type"; break; } idLexer::Error( "expected a %s but found '%s'", str.c_str(), token->c_str() ); return 0; } if ( token->type == TT_NUMBER ) { if ( (token->subtype & subtype) != subtype ) { str.Clear(); if ( subtype & TT_DECIMAL ) str = "decimal "; if ( subtype & TT_HEX ) str = "hex "; if ( subtype & TT_OCTAL ) str = "octal "; if ( subtype & TT_BINARY ) str = "binary "; if ( subtype & TT_UNSIGNED ) str += "unsigned "; if ( subtype & TT_LONG ) str += "long "; if ( subtype & TT_FLOAT ) str += "float "; if ( subtype & TT_INTEGER ) str += "integer "; str.StripTrailing( ' ' ); idLexer::Error( "expected %s but found '%s'", str.c_str(), token->c_str() ); return 0; } } else if ( token->type == TT_PUNCTUATION ) { if ( subtype < 0 ) { idLexer::Error( "BUG: wrong punctuation subtype" ); return 0; } if ( token->subtype != subtype ) { idLexer::Error( "expected '%s' but found '%s'", GetPunctuationFromId( subtype ), token->c_str() ); return 0; } } return 1; }
TEST(String, Clear) { String s = "abc"; EXPECT_FALSE(s.IsEmpty()); EXPECT_EQ(3, s.Length()); EXPECT_EQ(3, s.Size()); EXPECT_EQ("abc", s); s.Clear(); EXPECT_TRUE(s.IsEmpty()); EXPECT_EQ(0, s.Length()); EXPECT_EQ(0, s.Size()); EXPECT_EQ("", s); }
bool GetOVRRuntimePath(String& runtimePath) { runtimePath.Clear(); #ifdef OVR_OS_MS wchar_t path[MAX_PATH]; if (GetOVRRuntimePathW(path)) { runtimePath = String(path); return true; } #else //mac/linux uses environment variables #endif return false; }
bool ChannelCombinationInstance::CanExecuteOn( const View& v, String& whyNot ) const { if ( v.Image().IsComplexSample() ) { whyNot = "ChannelCombination cannot be executed on complex images."; return false; } if ( v.Image()->ColorSpace() != ColorSpace::RGB ) { whyNot = "ChannelCombination can only be executed on RGB color images."; return false; } whyNot.Clear(); return true; }
void Accelerometer::OnDataReceived(SensorType sensorType, SensorData& sensorData, result r) { sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_TIMESTAMP, timestamp); sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_X, x); sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_Y, y); sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_Z, z); AppLogDebug("x: %f, y: %f, z: %f timestamp: %d", x, y, z, timestamp); String res; res.Format(256, L"PhoneGap.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(), x, y, z, timestamp); pWeb->EvaluateJavascriptN(res); res.Clear(); res.Format(256, L"navigator.accelerometer.lastAcceleration = new Acceleration(%f,%f,%f,%d});", x, y, z, timestamp); pWeb->EvaluateJavascriptN(res); }
bool RGBWorkingSpaceInstance::Validate( String& info ) { try { RGBWorkingSpaceInstance t( *this ); t.NormalizeLuminanceCoefficients(); RGBColorSystem rgbws( t.gamma, t.sRGB != 0, t.x, t.y, t.Y ); info.Clear(); return true; } catch ( Exception& e ) { info = e.Message(); return false; } }
/* ================ CmdSystemEx::ExecuteCmd ================ */ void CmdSystemEx::ExecuteCmd( const char *buf, bool force ) { if( !buf[0] ) return; char ch[2] = {'\0', '\0'}; StringList list; String temp; bool inquote = false; int i; for ( i=0; buf[i] != '\0'; i++ ) { if ( buf[i] == '\n' || (!inquote && buf[i] == ';') ) { if ( temp.IsEmpty() ) continue; else if ( inquote ) { temp += "\""; inquote = false; } list.Append(temp); temp.Clear(); continue; } if ( buf[i] == '\"' ) inquote = !inquote; ch[0] = buf[i]; temp += ch; } if ( !temp.IsEmpty() ) { if ( inquote ) { temp += "\""; inquote = false; } list.Append(temp); } if ( force ) { int num = list.Num(); for ( i=0; i<num; i++ ) ExecuteSingleCmd( list[i].c_str() ); } else { int num = list.Num(); for ( i=0; i<num; i++ ) cmdQueue.Push( list[i] ); } }
void InputThread(CThread * pCreator) { char szInputBuffer[512]; // Buffer MUST be 3 or more (input char, \n, \0) String strInputString; // Loop until server shutdown while(pCreator->GetUserData<bool>()) { // Wait for input from the console // TODO: Make non-blocking fgets(szInputBuffer, sizeof(szInputBuffer), stdin); // Do we have anything in the input? if(szInputBuffer[0] != '\n') { // Append the input to the input string strInputString += szInputBuffer; // Get the input string length size_t sLength = strInputString.GetLength(); // Is this the last of the input? if(strInputString[sLength - 1] == '\n') { #ifdef WIN32 // Replace '\n' with '\0' strInputString.Truncate(sLength - 1); #else // Replace '\r\n' with '\0' strInputString.Truncate(sLength - 2); #endif // Add the input string to the server core console input queue g_pServer->AddToInputQueue(strInputString); // Clear the input string strInputString.Clear(); } } // Wait Sleep(TIMING_VALUE); } }
void MapPrint (EMapPrintType printType, IBaseEntity *Entity, vec3f &origin, const char *fmt, ...) { if (Entity && !Entity->ClassName.IsNullOrEmpty() && Level.ClassName != Entity->ClassName) Level.ClassName = Entity->ClassName; Map_Print (printType, origin); va_list argptr; CTempMemoryBlock text = CTempHunkSystem::Allocator.GetBlock(MAX_COMPRINT); va_start (argptr, fmt); vsnprintf (text.GetBuffer<char>(), text.GetSize() - 1, fmt, argptr); va_end (argptr); PrintBuffer += String::Format(" %s", text.GetBuffer<char>()); ServerPrintf ("%s", PrintBuffer.CString()); PrintBuffer.Clear(); }
int Make(String& s) const { static ScreenDraw w; w.SetFont(fc.fnt); GLYPHMETRICS gm; MAT2 m_matrix; memset(&m_matrix, 0, sizeof(m_matrix)); m_matrix.eM11.value = 1; m_matrix.eM22.value = 1; s.Clear(); int gsz = GetGlyphOutlineW(w.GetHandle(), fc.chr, GGO_NATIVE, &gm, 0, NULL, &m_matrix); if(gsz < 0) return 0; StringBuffer gb(gsz); gsz = GetGlyphOutlineW(w.GetHandle(), fc.chr, GGO_NATIVE, &gm, gsz, ~gb, &m_matrix); if(gsz < 0) return 0; s = gb; return gsz; }
/*============================================================================= -- Updates the text entered and the command buffer. =============================================================================*/ void Console::Update() { if (mVisible) { //append any new text input to @mInputLine mInputLine.PushBack(mEmbeddedRoot.GetWindow()->GetInput()->GetTextEntered()); mInputLine.ApplyOperations(); //add the input to text lines when enter is pressed if (mEmbeddedRoot.GetWindow()->GetInput()->GetKeyState(GK_Enter, KEY_RELEASED)) { Print(mInputLine, gWhite); if (mInputLine.Size() > 0 && mInputLine[0] != GUI_CONSOLE_NO_COMMAND_PREFIX) { //parse @mInputLine as a command ConsoleCommand command; String buffer; for (int n=0; n<mInputLine.Size(); n++) { if (mInputLine[n] != " ") buffer.PushBack(mInputLine[n]); else { if (command.command == "") command.command = buffer; else command.parameters.push_back(buffer); buffer.Clear(); } } command.parameters.push_back(buffer); mQueuedCommands.push_back(command); Print(ToString(" ")+GUI_CONSOLE_NO_COMMAND_PREFIX+"Command \""+command.command+"\" was parsed",gYellow); } mInputLine = ""; } } }
int MemoryStream::ReadString(String & data) { data.Clear(); int count = 0; if (!mEndof) { char str[1024]; int size; int pos; int sk; while (!mEndof) { size = Read(str, sizeof(char), (1024 - 1)); str[size] = '\0'; pos = 0; while (pos < size && str[pos] != '\0') { ++pos; } data += str; if (pos < size) { count += pos + 1; sk = pos + 1 - size; Skip(sk); break; } else { count += pos; } } } return count; }
String CMultimediaRender::ChooseShader(DeviceColorType colorType) { String strShader; strShader << SHADER_PATH; if (colorType == DeviceOutputType_I420) strShader << TEXT("YUVToRGB.pShader"); else if (colorType == DeviceOutputType_YV12) strShader << TEXT("YVUToRGB.pShader"); else if (colorType == DeviceOutputType_YVYU) strShader << TEXT("YVXUToRGB.pShader"); else if (colorType == DeviceOutputType_YUY2) strShader << TEXT("YUXVToRGB.pShader"); else if (colorType == DeviceOutputType_UYVY) strShader << TEXT("UYVToRGB.pShader"); else if (colorType == DeviceOutputType_HDYC) strShader << TEXT("HDYCToRGB.pShader"); else strShader.Clear(); return strShader; }