您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FindSection函数代码示例

51自学网 2021-06-01 20:47:00
  C++
这篇教程C++ FindSection函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FindSection函数的典型用法代码示例。如果您正苦于以下问题:C++ FindSection函数的具体用法?C++ FindSection怎么用?C++ FindSection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FindSection函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: strcpy

/** * this will work only on a CxImageJPG object, if the image originally has valid EXIF data /verbatim	CxImageJPG jpg;	CxIOFile in,out;	in.Open("D://exif_in.jpg","rb");	out.Open("D://exif_out.jpg","w+b");	jpg.Decode(&in);	if (jpg.IsValid()){		jpg.RotateLeft();		jpg.Encode(&out);	} /endverbatim*/bool CxImageJPG::CxExifInfo::EncodeExif(CxFile * hFile){    int a;    if (FindSection(M_SOS)==NULL) {        strcpy(m_szLastError,"Can't write exif : didn't read all");        return false;    }    // Initial static jpeg marker.    hFile->PutC(0xff);    hFile->PutC(0xd8);    if (Sections[0].Type != M_EXIF && Sections[0].Type != M_JFIF) {        // The image must start with an exif or jfif marker.  If we threw those away, create one.        static BYTE JfifHead[18] = {            0xff, M_JFIF,            0x00, 0x10, 'J' , 'F' , 'I' , 'F' , 0x00, 0x01,            0x01, 0x01, 0x01, 0x2C, 0x01, 0x2C, 0x00, 0x00        };        hFile->Write(JfifHead, 18, 1);    }    // Write all the misc sections    for (a=0; a<SectionsRead-1; a++) {        hFile->PutC(0xff);        hFile->PutC((unsigned char)(Sections[a].Type));        hFile->Write(Sections[a].Data, Sections[a].Size, 1);    }    // Write the remaining image data.    hFile->Write(Sections[a].Data, Sections[a].Size, 1);    return true;}
开发者ID:JBetser,项目名称:Imagenius_SDK,代码行数:49,


示例2: copyThumbnailData

	void copyThumbnailData(uchar* thumbnailData, int thumbnailLen)	{		LOGI("******************************** copyThumbnailData");		Section_t* ExifSection = FindSection(M_EXIF);		if (ExifSection == NULL) {			return;		}		int NewExifSize = ImageInfo.ThumbnailOffset+8+thumbnailLen;		ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize);		if (ExifSection->Data == NULL) {			LOGW("ExifSection->Data = NULL");			return;		}		uchar* ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;		memcpy(ThumbnailPointer, thumbnailData, thumbnailLen);		ImageInfo.ThumbnailSize = thumbnailLen;		Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, thumbnailLen);		ExifSection->Data[0] = (uchar)(NewExifSize >> 8);		ExifSection->Data[1] = (uchar)NewExifSize;		ExifSection->Size = NewExifSize;	}
开发者ID:jagrutibhadani,项目名称:Android-Exif-Extended,代码行数:29,


示例3: SaveThumbnail

//--------------------------------------------------------------------------// Replace or remove exif thumbnail//--------------------------------------------------------------------------int SaveThumbnail(char * ThumbFileName){    FILE * ThumbnailFile;    if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailSize == 0){        fprintf(stderr,"Image contains no thumbnail/n");        return FALSE;    }    if (strcmp(ThumbFileName, "-") == 0){        // A filename of '-' indicates thumbnail goes to stdout.        // This doesn't make much sense under Windows, so this feature is unix only.        ThumbnailFile = stdout;    }else{        ThumbnailFile = fopen(ThumbFileName,"wb");    }    if (ThumbnailFile){        uchar * ThumbnailPointer;        Section_t * ExifSection;        ExifSection = FindSection(M_EXIF);        ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;        fwrite(ThumbnailPointer, ImageInfo.ThumbnailSize ,1, ThumbnailFile);        fclose(ThumbnailFile);        return TRUE;    }else{        ErrFatal("Could not write thumbnail file");        return FALSE;    }}
开发者ID:Jerdak,项目名称:meshlab,代码行数:34,


示例4: FindSection

const char *GProfile::GetPath(const char *szSectionName, const char *szKey, short bThrowNotFound){	Section *pSection = FindSection(szSectionName);	if (pSection)	{		NameValuePair *pNVP = FindKey(szKey, pSection);		if (pNVP)		{			if ( !( pNVP->m_strValue.Right(1) == "/" || pNVP->m_strValue.Right(1) == "//") )			{		#ifdef _WIN32				pNVP->m_strValue += "//";		#else				pNVP->m_strValue += "/";		#endif			}			return pNVP->m_strValue;		}		else if (bThrowNotFound)		{			// throw key not found		}	}	else if (bThrowNotFound)	{		// throw key not found	}	return 0;}
开发者ID:gbaumgart,项目名称:vt,代码行数:32,


示例5: getThumbnail

	static jbyteArray getThumbnail(JNIEnv *env, jobject jobj, jstring jfilename)	{		LOGI("getThumbnail");		const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL);		if (filename)		{			loadExifInfo(filename, FALSE);			Section_t* ExifSection = FindSection(M_EXIF);			if (ExifSection == NULL || ImageInfo.ThumbnailSize == 0)			{				LOGE("no exif section or size == 0, so no thumbnail/n");				goto noThumbnail;			}			uchar* thumbnailPointer = ExifSection->Data + ImageInfo.ThumbnailOffset + 8;			jbyteArray byteArray = (*env)->NewByteArray(env, ImageInfo.ThumbnailSize);			if (byteArray == NULL)			{				LOGE("couldn't allocate thumbnail memory, so no thumbnail/n");				goto noThumbnail;			}			(*env)->SetByteArrayRegion(env, byteArray, 0, ImageInfo.ThumbnailSize, thumbnailPointer);			LOGD("thumbnail size %d/n", ImageInfo.ThumbnailSize);			(*env)->ReleaseStringUTFChars(env, jfilename, filename);			DiscardData();			return byteArray;		}		noThumbnail: if (filename)		{			(*env)->ReleaseStringUTFChars(env, jfilename, filename);		}		DiscardData();		return NULL;	}
开发者ID:jagrutibhadani,项目名称:Android-Exif-Extended,代码行数:35,


示例6: getThumbnailRange

static jlongArray getThumbnailRange(JNIEnv *env, jobject jobj, jstring jfilename) {    jlongArray resultArray = NULL;    const char* filename = (*env)->GetStringUTFChars(env, jfilename, NULL);    if (filename) {        loadExifInfo(filename, FALSE);        Section_t* ExifSection = FindSection(M_EXIF);        if (ExifSection == NULL || ImageInfo.ThumbnailSize == 0) {            goto done;        }        jlong result[2];        result[0] = ExifSection->Offset + ImageInfo.ThumbnailOffset + 8;        result[1] = ImageInfo.ThumbnailSize;        resultArray = (*env)->NewLongArray(env, 2);        if (resultArray == NULL) {            goto done;        }        (*env)->SetLongArrayRegion(env, resultArray, 0, 2, result);    }done:    if (filename) {        (*env)->ReleaseStringUTFChars(env, jfilename, filename);    }    DiscardData();    return resultArray;}
开发者ID:MonkeyZZZZ,项目名称:platform_external_jhead,代码行数:28,


示例7: ReplaceThumbnailFromBuffer

//--------------------------------------------------------------------------// Replace or remove exif thumbnail//--------------------------------------------------------------------------int ReplaceThumbnailFromBuffer(const char * Thumb, int ThumbLen){    int NewExifSize;    Section_t * ExifSection;    uchar * ThumbnailPointer;    if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailAtEnd == FALSE){        if (Thumb == NULL){            // Delete of nonexistent thumbnail (not even pointers present)            // No action, no error.            return FALSE;        }        // Adding or removing of thumbnail is not possible - that would require rearranging        // of the exif header, which is risky, and jhad doesn't know how to do.        fprintf(stderr,"Image contains no thumbnail to replace - add is not possible/n");#ifdef SUPERDEBUG        ALOGE("Image contains no thumbnail to replace - add is not possible/n");#endif        return FALSE;    }    if (Thumb) {        if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){	        //ErrFatal("Thumbnail is too large to insert into exif header");	        ALOGE("Thumbnail is too large to insert into exif header");	        return FALSE;        }    } else {        if (ImageInfo.ThumbnailSize == 0){             return FALSE;        }        ThumbLen = 0;    }    ExifSection = FindSection(M_EXIF);    NewExifSize = ImageInfo.ThumbnailOffset+8+ThumbLen;    ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize);    ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;    if (Thumb){        memcpy(ThumbnailPointer, Thumb, ThumbLen);    }    ImageInfo.ThumbnailSize = ThumbLen;    Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, ThumbLen);    ExifSection->Data[0] = (uchar)(NewExifSize >> 8);    ExifSection->Data[1] = (uchar)NewExifSize;    ExifSection->Size = NewExifSize;#ifdef SUPERDEBUG        ALOGE("ReplaceThumbnail successful thumblen %d", ThumbLen);#endif    return TRUE;}
开发者ID:CriGio,项目名称:platform_external_jhead,代码行数:63,


示例8: LoadDSN

static int LoadDSN (   const gchar* iniFileName, const gchar* dsnName, GHashTable* table){   FILE* stream;   gchar* name;   gchar* value;   if ((stream = fopen (iniFileName, "r" )) != NULL )      {      if (!FindSection (stream, dsnName))      {	 g_printerr ("Couldn't find DSN %s in %s/n", dsnName, iniFileName);	 fclose (stream);         return 0;      }      else      {         while (GetNextItem (stream, &name, &value))         {            g_hash_table_insert (table, g_strdup (name), g_strdup (value));         }      }      fclose( stream );      }   return 1;}
开发者ID:abougouffa,项目名称:mdbtools,代码行数:29,


示例9: FindSection

// function retrieves a boolean from the specified sectionbool GProfile::GetBool(const char *szSectionName, const char *szKey, bool bThrowNotFound /* = true */){	GProfileSection *pSection = FindSection(szSectionName);	if (pSection)	{		GProfileEntry *pNVP = FindKey(szKey, pSection);		if (pNVP)		{			if (!pNVP->m_strValue.IsEmpty())			{				if (pNVP->m_strValue.GetAt(0) == '1')					return 1;				if (pNVP->m_strValue.CompareNoCase("Yes") == 0)					return 1;				if (pNVP->m_strValue.CompareNoCase("On") == 0)					return 1;			}			return 0;		}		else if (bThrowNotFound)		{			// throw key not found			throw GException("Profile", 0, szSectionName, szKey);		}	}	else if (bThrowNotFound)	{		// throw key not found		throw GException("Profile", 1, szSectionName);	}	return 0;}
开发者ID:BrianAberle,项目名称:XMLFoundation,代码行数:34,


示例10: ReplaceThumbnail

//--------------------------------------------------------------------------// Replace or remove exif thumbnail//--------------------------------------------------------------------------int ReplaceThumbnail(const char * ThumbFileName){    FILE * ThumbnailFile;    int ThumbLen, NewExifSize;    Section_t * ExifSection;    uchar * ThumbnailPointer;    if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailAtEnd == FALSE){        // Adding or removing of thumbnail is not possible - that would require rearranging        // of the exif header, which is risky, and jhad doesn't know how to do.        printf("Image contains no thumbnail to replace - add is not possible/n");        return FALSE;    }    if (ThumbFileName){        ThumbnailFile = fopen(ThumbFileName,"rb");        if (ThumbnailFile == NULL){            ErrFatal("Could not read thumbnail file");            return FALSE;        }        // get length        fseek(ThumbnailFile, 0, SEEK_END);        ThumbLen = ftell(ThumbnailFile);        fseek(ThumbnailFile, 0, SEEK_SET);        if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){            ErrFatal("Thumbnail is too large to insert into exif header");        }    }else{        ThumbLen = 0;        ThumbnailFile = NULL;    }    ExifSection = FindSection(M_EXIF);    NewExifSize = ImageInfo.ThumbnailOffset+8+ThumbLen;    ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize);    ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;    if (ThumbnailFile){        fread(ThumbnailPointer, ThumbLen, 1, ThumbnailFile);        fclose(ThumbnailFile);    }    ImageInfo.ThumbnailSize = ThumbLen;    Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, ThumbLen);    ExifSection->Data[0] = (uchar)(NewExifSize >> 8);    ExifSection->Data[1] = (uchar)NewExifSize;    ExifSection->Size = NewExifSize;    return TRUE;}
开发者ID:milankni,项目名称:cinepaint-oyranos,代码行数:62,


示例11: FindSection

bool CIniFile::FindKey  (CCHR *pSection, CCHR *pKey, EFIND *pList){	char Search [130];	char Found  [130];	char Text   [255];	char *pText;	struct ENTRY *pEntry;	pList->pSec        = NULL;	pList->pKey        = NULL;	pEntry = FindSection (pSection);	if (pEntry == NULL) { return FALSE; }	pList->pSec        = pEntry;	pList->KeyText[0] = 0;	pList->ValText[0] = 0;	pList->Comment[0] = 0;	pEntry = pEntry->pNext;	if (pEntry == NULL) { return FALSE; }	sprintf (Search, "%s",pKey);	strupr  (Search);	while (pEntry != NULL)	{		if ((pEntry->Type == tpSECTION) || // Stop after next section or EOF 			(pEntry->Type == tpNULL   ))		{			return FALSE;		}		if (pEntry->Type == tpKEYVALUE)		{			strcpy (Text, pEntry->pText);			pText = strchr (Text, ';');			if (pText != NULL)			{				strcpy (pList->Comment, pText);				*pText = 0;			}			pText = strchr (Text, '=');			if (pText != NULL)			{				*pText = 0;				strcpy (pList->KeyText, Text);				strcpy (Found, Text);				*pText = '=';				strupr (Found);				//            printf ("%s,%s/n", Search, Found); 				if (strcmp (Found,Search) == 0)				{				   strcpy (pList->ValText, pText+1);				   pList->pKey = pEntry;				   return TRUE;				}			}		}		pEntry = pEntry->pNext;	}	return NULL;}
开发者ID:zhlgh603,项目名称:contron-psm70,代码行数:56,


示例12: seekg

//--------------------------------------------------------------------// @mfunc Tokenize the Provider info//// @rdesc BOOL//      @flag TRUE | Parsing yielded no Error//BOOL CParseInitFile::ParseProviderInfo(){	//move to beginning of file    seekg(0L);	CHAR* pszStart = NULL;	CHAR* pszEnd = NULL;	CHAR szVersion[100];	TRACE_CALL(L"PRIVLIB: CParseInitFile::ParseProviderInfo./n");	//Skip over any lines, until the [INFO] section is reached...	//Make sure the INI contains the required version (at least)	if( FindSection("[INFO]")==S_OK &&		GetNextLine(m_pvInput, MAX_INPUT_BUFFER)==S_OK  &&		(pszStart = strstr(m_pvInput, START_OF_TYPE)) &&		(pszStart = strstr(pszStart, "VERSION=")) &&		(pszStart = strstr(pszStart, ",")) &&		(pszStart = strstr(pszStart+1, ",")) &&		(pszEnd = strstr(pszStart+1, ",")) )	{		//Build Version is between 2nd and 3rd comma.  (1,50,3518,00)		pszStart++;		strncpy(szVersion, pszStart, (size_t)(pszEnd - pszStart));		szVersion[pszEnd - pszStart] = '/0';		ULONG ulVersion = strtoul(szVersion, NULL, 10);		if(ulVersion == ULONG_MAX || ulVersion < 3518)		{			odtLog << "ERROR:  This version of the Privlib requires a INI File generated from " << ENDL;			odtLog << "ERROR:  from TableDump.exe 1.50.3518.00 or later." << ENDL;			return FALSE;		}	}	else	{		odtLog << "ERROR:  Unable to find Versioning Information in INI <File:" << m_pszFileName << ">" << ENDL;		odtLog << "ERROR:  This version of the Privlib requires a INI with a version section" << ENDL;		odtLog << "ERROR:  and generated using a version of TableDump.exe 1.50.3518.00 or later." << ENDL;		return FALSE;	}	//Get the NextLine {(TABLE=; DEFAULTQUERY=; DATASOURCE=; USERID=; PASSWORD=; etc... )}	if(GetNextLine(m_pvInput, MAX_INPUT_BUFFER)!=S_OK ||		(pszStart = strstr(m_pvInput, START_OF_TYPE))==NULL ||		(pszStart = strstr(pszStart, "TABLE="))==NULL)	{		odtLog << "ERROR:  Unable to find InitString containing Initialization Information in INI <File:" << m_pszFileName << ">" << ENDL;		odtLog << "ERROR:  Make sure your using a correctly generated INI File from TableDump.exe" << ENDL;		return FALSE;	}    	//We just need to append the InitString from the FILE to the InitString 	//Already stored in the CModInfo from LTM.  And we will parse both together...	GetModInfo()->AddToInitString(pszStart);	return  TRUE;}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:61,


示例13: CVDefSegs

extern  void    CVDefSegs( void ){/**************************/    if( _IsModel( DBG_LOCALS ) ) {        CVSyms = DbgSegDef( ".debug$S"  );        CVSymMain = FindSection( CVSyms );        owlCVSym = CVSymMain->owl_handle;    }    if( _IsModel( DBG_TYPES ) ) {        CVTypes = DbgSegDef( ".debug$T" );    }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:11,


示例14: GetEntry

ConfigSection* ConfigFile::GetEntry(string name){	ConfigSection* c=FindSection(name);	if (!c)	{		entrys=c= new ConfigSection(entrys);		c->name=name;	}	return c;}
开发者ID:rasterico,项目名称:reicast-emulator,代码行数:11,


示例15: TRACE_CALL

//--------------------------------------------------------------------// @mfunc Retrieve the data associated with a particular column. ////// @rdesc BOOL//      @flag TRUE | Succeeded//      @flag FALSE | Failed//BOOL CParseInitFile::ParseColumnInfo(){    HRESULT hr = S_OK;	CHAR* pszStart = NULL;		TRACE_CALL(L"PRIVLIB: CParseInitFile::ParseColumnInfo./n");	// If Column data has not been retrieved,    if(m_ColData.IsEmpty())	{		//Skip over any lines, until the [COLUMN] section is reached...		if(FAILED(hr = FindSection("[COLUMN]")))			return FALSE;		//Get the NextLine {ColName(iOrdinal, TYPE, ulColumnSize, bPrecision, bScale, dwFlags)} 		if((hr = GetNextLine(m_pvInput, MAX_INPUT_BUFFER))!=S_OK)		{			odtLog << "ERROR:  Unable to find Columns in INI <File:" << m_pszFileName << ">" << ENDL;			odtLog << "ERROR:  Make sure your using a correctly generated INI File from TableDump.exe" << ENDL;			return FALSE;		}		//Now parse the Columns		m_ColData.RemoveAll();			    		// Parse the records		while(hr==S_OK)		{				pszStart = strstr(m_pvInput, START_OF_TYPE);			if(pszStart)			{				// if we have reached [DATA] part bail out				pszStart++;				if(strncmp(pszStart, szDATA, 6) ==0)					return TRUE;							// parse the column metadata info				if(!GetColumns(pszStart))					break;			}						//Retrieve the next row			if((hr = GetNextLine(m_pvInput, MAX_INPUT_BUFFER))!=S_OK)			{				odtLog << "ERROR:  Unable to finding ColumnInfo for Column " << m_ColData.GetCount() << " in INI <File:" << m_pszFileName << ">" << ENDL;				odtLog << "ERROR:  Make sure your using a correctly generated INI File from TableDump.exe" << ENDL;				return FALSE;			}		}    }	return FALSE;}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:61,


示例16: OpenDynamicLibrary

void dynLibImplLinux::GetImportAndExportData( 	const char* dllName ){	if( std::string(dllName).empty())	{		return;	}	Elf* mainElf;	struct link_map* mainLm;	std::string csPath_o;	OpenDynamicLibrary( dllName, mainElf, mainLm, csPath_o );	if ( mainLm == NULL )	{		return;	}	Elf_Scn* section = 0;	ElfW(Shdr) *shdr;	FindSection( mainElf, SHT_DYNAMIC, section, shdr );	std::list<std::string> dependencies;	ExtractDynSymbols( mainElf, section, shdr, STT_NOTYPE, dependencies );	std::list<std::string>::iterator it;	for(it = dependencies.begin( ); it != dependencies.end( ) ; it++) {		AddString( it->c_str() );		if ( GetDllEntry( it->c_str()  ) == NULL )		{			DLL_ENTRY stImpExport;			std::string csPath_o;			if ( GetExportData( it->c_str(), stImpExport.ArrayExport, csPath_o ) )			{				stImpExport.m_bIsStable = true;				stImpExport.m_csFullPath = csPath_o;				// Add data to static internal map				MakeUpper( *it );				m_DataEntry[ *it ] = stImpExport;			}		}		DeleteString( it->c_str() );	}	dlclose( mainLm );}
开发者ID:jakubsadura,项目名称:Swiezy,代码行数:52,


示例17: FindSection

IniSection* MIniFile::GetNextSection(const char* currentSectionName){	int nIndex = FindSection(currentSectionName);	if(-1 == nIndex)		return 0;	++nIndex;	if(nIndex >= m_SectionList.size())		return 0;	return m_SectionList[nIndex];}
开发者ID:mobinsheng,项目名称:MBSLib,代码行数:13,



注:本文中的FindSection函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ FindSocketObj函数代码示例
C++ FindResourceW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。