Subversion Repositories spk

Rev

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

Rev 54 Rev 56
Line 1027... Line 1027...
1027
	if ( (!m_sData) || (!m_lDataSize) )
1027
	if ( (!m_sData) || (!m_lDataSize) )
1028
		return false;
1028
		return false;
1029
	// if theres a tmp file, open it and check it still exists
1029
	// if theres a tmp file, open it and check it still exists
1030
	if ( !m_sTmpFile.Empty() )
1030
	if ( !m_sTmpFile.Empty() )
1031
	{
1031
	{
1032
		FILE *id = fopen ( m_sTmpFile.c_str(), "rb" );
1032
		if ( CFileIO::Exists(m_sTmpFile) ) return true;
1033
		if ( id )
-
 
1034
		{
-
 
1035
			fclose ( id );
-
 
1036
			return true;
-
 
1037
		}
-
 
1038
		m_sTmpFile = "";
1033
		m_sTmpFile = "";
1039
	}
1034
	}
1040
 
1035
 
1041
	// now uncompress to the file
1036
	// now uncompress to the file
1042
	CyString file = toFile;
1037
	CyString file = toFile;
Line 1046... Line 1041...
1046
		file = CyString("uncompr") + (long)m_iTempNum + ".tmp";
1041
		file = CyString("uncompr") + (long)m_iTempNum + ".tmp";
1047
	}
1042
	}
1048
	else
1043
	else
1049
		file = GetFullFileToDir ( file, includedir, spkfile );
1044
		file = GetFullFileToDir ( file, includedir, spkfile );
1050
 
1045
 
1051
	FILE *id = fopen ( "compr.tmp", "wb" );
1046
	CFileIO File("compr.tmp");
1052
	if ( !id )
-
 
1053
		return false;
1047
	if ( !File.startWrite() ) return false;
1054
 
-
 
1055
	fwrite ( m_sData, sizeof(unsigned char), m_lDataSize, id );
1048
	if ( !File.write(m_sData, m_lDataSize) ) return false;
1056
	bool ret = false;
1049
	File.close();
1057
	int err = ferror(id);
1050
	if ( LZMADecodeFile ( "compr.tmp", file.c_str(), (CProgressInfo7Zip *)progress ) )
1058
	fclose ( id );
-
 
1059
	if ( !err )
-
 
1060
	{
1051
	{
1061
		if ( LZMADecodeFile ( "compr.tmp", file.c_str(), (CProgressInfo7Zip *)progress ) )
-
 
1062
		{
-
 
1063
			ret = true;
1052
		ret = true;
1064
			if ( toFile.Empty() )
1053
		if ( toFile.Empty() )
1065
				m_sTmpFile = file;
1054
			m_sTmpFile = file;
1066
		}
-
 
1067
	}
1055
	}
1068
 
1056
 
1069
	remove ( "compr.tmp" );
1057
	CFileIO::Remove("compr.tmp");
1070
 
1058
 
1071
	return ret;
1059
	return ret;
1072
#else
1060
#else
1073
	return false;
1061
	return false;
1074
#endif
1062
#endif