e32tools/elf2e32/source/deffile.cpp
changeset 702 341ab25bc4ef
parent 682 2c32f186fa1f
equal deleted inserted replaced
674:37ee82a83d43 702:341ab25bc4ef
   461 	{
   461 	{
   462 		// Get the length of the symbol
   462 		// Get the length of the symbol
   463 		IsWord(iLine + iOffset, aCurrentPos);
   463 		IsWord(iLine + iOffset, aCurrentPos);
   464 
   464 
   465 		char *cmt = strchr(iLine + iOffset, ';');
   465 		char *cmt = strchr(iLine + iOffset, ';');
   466 		char *aAlias = strchr(iLine + iOffset, '=');
   466 		char *aExport = strchr(iLine + iOffset, '=');
   467 
   467 
   468 		if( aAlias && (!cmt || (aAlias < cmt)) )
   468 		if( aExport && (!cmt || (aExport < cmt)) )
   469 		{
   469 		{
   470 			int aAliasPos = aAlias - (iLine+ iOffset);
   470 			int aExportPos = aExport - (iLine+ iOffset);
   471 
   471 
   472 			//Check if alias name is also supplied, they should be separated 
   472 			//Check if alias name is also supplied, they should be separated 
   473 			// by whitespace, i.e., SymbolName=AliasName is valid while, 
   473 			// by whitespace, i.e., ExportName=SymbolName is valid while,
   474 			// SymbolName =AliasName is invalid.
   474 			// ExportName =SymbolName is invalid.
   475 			if( aAliasPos > aCurrentPos)
   475 			if( aExportPos > aCurrentPos)
   476 			{
   476 			{
   477 				char *aToken = (iLine + iOffset + aCurrentPos);
   477 				char *aToken = (iLine + iOffset + aCurrentPos);
   478 				throw DEFFileError(UNRECOGNIZEDTOKEN, iFileName, iLineNum, aToken);
   478 				throw DEFFileError(UNRECOGNIZEDTOKEN, iFileName, iLineNum, aToken);
   479 			}
   479 			}
   480 
   480 
   481 			aSymbolName = new char[aAliasPos+1];
   481 			char* aExportName = new char[aExportPos+1];
   482 			strncpy(aSymbolName, iLine + iOffset, aAliasPos);
   482 			strncpy(aExportName, iLine+iOffset, aExportPos);
   483 			aSymbolName[aAliasPos] = '\0';
   483 			aExportName[aExportPos] = '\0';
   484 			char *aExportName = new char[aCurrentPos - aAliasPos + 1];
   484 			aSymbolName = new char[aCurrentPos - aExportPos + 1];
   485 			strncpy(aExportName, aAlias +1, (aCurrentPos - aAliasPos));
   485 			strncpy(aSymbolName, aExport +1, (aCurrentPos - aExportPos));
   486 			aExportName[(aCurrentPos - aAliasPos)] = '\0';
   486 			aSymbolName[(aCurrentPos - aExportPos-1)] = '\0';
   487 			iSymbol->ExportName(aExportName);
   487 			iSymbol->ExportName(aExportName);
   488 		}
   488 		}
   489 		else
   489 		else
   490 		{
   490 		{
   491 			aSymbolName = new char[aCurrentPos+1];
   491 			aSymbolName = new char[aCurrentPos+1];