Subversion Repositories spk

Rev

Rev 41 | Rev 45 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 41 Rev 43
Line 267... Line 267...
267
	if ( filename.IsIn("-L") || filename.IsIn("-l") )
267
	if ( filename.IsIn("-L") || filename.IsIn("-l") )
268
		textid = filename.GetToken("-", 1, 1);
268
		textid = filename.GetToken("-", 1, 1);
269
	else
269
	else
270
		textid = filename.GetToken(".", -1).Right(4);
270
		textid = filename.GetToken(".", -1).Right(4);
271
 
271
 
272
	return textid.ToInt();
272
	if ( textid.IsNumber() ) return textid.ToInt();
-
 
273
	return -1;
273
}
274
}
274
bool C_File::IsAutoTextFile ()
275
bool C_File::IsAutoTextFile ()
275
{
276
{
276
	int textid = GetTextFileID();
277
	int textid = GetTextFileID();
277
	if ( textid == -1 ) return false;
278
	if ( textid == -1 ) return false;
Line 444... Line 445...
444
 
445
 
445
	return true;
446
	return true;
446
}
447
}
447
 
448
 
448
 
449
 
-
 
450
void C_File::copyData(const unsigned char *data, size_t size)
-
 
451
{
-
 
452
	m_lDataSize = (long)size;
-
 
453
	delete m_sData;
-
 
454
	m_sData = new unsigned char[size];
-
 
455
	memcpy(m_sData, data, size);
-
 
456
}
-
 
457
 
449
 
458
 
450
/*
459
/*
451
	Func:	GetFilePointer
460
	Func:	GetFilePointer
452
	Desc:	Returns the file pointer name
461
	Desc:	Returns the file pointer name
453
			Joins dir and name together
462
			Joins dir and name together
Line 600... Line 609...
600
 
609
 
601
			fseek(id, 0, SEEK_END);
610
			fseek(id, 0, SEEK_END);
602
			int endPos = ftell(id);
611
			int endPos = ftell(id);
603
 
612
 
604
			int pos = endPos;
613
			int pos = endPos;
-
 
614
			int attempts = 100;
605
			// move to end of the file
615
			// move to end of the file
606
			while ( true )
616
			while ( true )
607
			{
617
			{
608
				// read blocks of 20 backwards
618
				// read blocks of 20 backwards
609
				pos -= 20;
619
				pos -= 20;
Line 617... Line 627...
617
				// find code array
627
				// find code array
618
				if ( sRead.FindPos("codearray") != -1 )
628
				if ( sRead.FindPos("codearray") != -1 )
619
					break;
629
					break;
620
				if ( pos <= 2 )
630
				if ( pos <= 2 )
621
					break;
631
					break;
-
 
632
				--attempts;
-
 
633
				if ( attempts <= 0 ) break;
622
			}
634
			}
623
 
635
 
624
			fclose(id);
636
			fclose(id);
625
 
637
 
626
			// now check the find read
638
			// now check the find read
Line 1722... Line 1734...
1722
		return false;
1734
		return false;
1723
	}
1735
	}
1724
 
1736
 
1725
	// work backwards
1737
	// work backwards
1726
	int pos = size - 1;
1738
	int pos = size - 1;
1727
 
-
 
-
 
1739
	int max = size - 5000;
-
 
1740
	if ( max < 0 ) max = 0;
1728
	// find the first tage
1741
	// find the first tage
1729
	while ( pos > 0 )
1742
	while ( pos > max )
1730
	{
1743
	{
1731
		while ( data[pos] != '>' && pos > 0 )
1744
		while ( data[pos] != '>' && pos > 0 )
1732
			pos--;
1745
			pos--;
1733
 
1746
 
1734
		char tag[100];
1747
		char tag[10000];
1735
		bool checked = false;
1748
		bool checked = false;
1736
		if ( data[pos] == '>' )
1749
		if ( data[pos] == '>' )
1737
		{
1750
		{
1738
			int pos2 = pos - 1;
1751
			int pos2 = pos - 1;
1739
			// now find the front
1752
			// now find the front
1740
			while ( data[pos2] != '<' && pos2 > 0 )
1753
			while ( data[pos2] != '<' && pos2 > max )
1741
				pos2--;
1754
				pos2--;
1742
 
1755
 
1743
			// now get the tag
1756
			// now get the tag
1744
			if ( data[pos2] == '<' )
1757
			if ( data[pos2] == '<' )
1745
			{
1758
			{