refactor: 水池截面中转文件改用 CoreTools::getTempFilePath #33
No files matched your search
@@ -129,11 +129,15 @@ bool FormatScriptFromSection(CString& sScr,STSection* pSection)
|
||||
if (file.Open(sFullPath,CFile::modeRead))
|
||||
{
|
||||
ULONGLONG dwFileLength = file.GetLength();
|
||||
char* pszTxt = new char[dwFileLength];
|
||||
int nLen = (int)dwFileLength;
|
||||
|
||||
file.Read(pszTxt,(UINT)dwFileLength);
|
||||
// 补终止符并按实际读到的长度赋值,避免把未初始化内存当字符串读
|
||||
char* pszTxt = new char[nLen + 1];
|
||||
::memset(pszTxt, 0, nLen + 1);
|
||||
|
||||
sRegionScrp = pszTxt;
|
||||
UINT nRead = file.Read(pszTxt, nLen);
|
||||
|
||||
sRegionScrp = CString(pszTxt, (int)nRead);
|
||||
delete [] pszTxt;
|
||||
|
||||
file.Close();
|
||||
@@ -2900,7 +2904,11 @@ bool AcDbX3dSolid::CreateFromSat(LPCTSTR pszSatFile,double dUnitScale)
|
||||
//上一级目录
|
||||
int nPos = sFullPath.ReverseFind(_T('\\'));
|
||||
CString sPath = sFullPath.Mid(0,nPos + 1);
|
||||
sFullPath = sPath + _T("temp\\temp.sat");
|
||||
|
||||
// 每次用唯一文件名:多个 CAD 实例同时从 SAT 重建时不会互相覆盖
|
||||
static LONG s_nSatSeq = 0;
|
||||
sFullPath.Format(_T("%stemp\\temp_%lu_%ld.sat"),(LPCTSTR)sPath
|
||||
,(unsigned long)::GetCurrentProcessId(),(long)::InterlockedIncrement(&s_nSatSeq));
|
||||
|
||||
CFile file;
|
||||
if (file.Open(sFullPath,CFile::modeCreate|CFile::modeWrite))
|
||||
@@ -2912,6 +2920,8 @@ bool AcDbX3dSolid::CreateFromSat(LPCTSTR pszSatFile,double dUnitScale)
|
||||
AcDbVoidPtrArray arPtr;
|
||||
AcDbBody::acisIn(sFullPath,arPtr);
|
||||
|
||||
::DeleteFile(sFullPath);
|
||||
|
||||
//按照体积从大到小排序
|
||||
Sort3dSolidByVol(arPtr);
|
||||
|
||||
|
||||
@@ -580,11 +580,15 @@ CString GetSectionScr(AcDbRegion* pReg)
|
||||
if (file.Open(sFullPath,CFile::modeRead))
|
||||
{
|
||||
ULONGLONG dwFileLength = file.GetLength();
|
||||
char* pszTxt = new char[dwFileLength];
|
||||
int nLen = (int)dwFileLength;
|
||||
|
||||
file.Read(pszTxt,(UINT)dwFileLength);
|
||||
// 补终止符并按实际读到的长度赋值,避免把未初始化内存当字符串读
|
||||
char* pszTxt = new char[nLen + 1];
|
||||
::memset(pszTxt, 0, nLen + 1);
|
||||
|
||||
sRegionScrp = pszTxt;
|
||||
UINT nRead = file.Read(pszTxt, nLen);
|
||||
|
||||
sRegionScrp = CString(pszTxt, (int)nRead);
|
||||
delete [] pszTxt;
|
||||
|
||||
file.Close();
|
||||
|
||||
@@ -951,11 +951,15 @@ void CDGJMDlg::OnBnClickedBtaddtodb()
|
||||
if (file.Open(sFullPath,CFile::modeRead))
|
||||
{
|
||||
ULONGLONG dwFileLength = file.GetLength();
|
||||
char* pszTxt = new char[dwFileLength];
|
||||
int nLen = (int)dwFileLength;
|
||||
|
||||
file.Read(pszTxt,dwFileLength);
|
||||
// 补终止符并按实际读到的长度赋值,避免把未初始化内存当字符串读
|
||||
char* pszTxt = new char[nLen + 1];
|
||||
::memset(pszTxt, 0, nLen + 1);
|
||||
|
||||
sRegionScrp = pszTxt;
|
||||
UINT nRead = file.Read(pszTxt, nLen);
|
||||
|
||||
sRegionScrp = CString(pszTxt, (int)nRead);
|
||||
delete [] pszTxt;
|
||||
|
||||
file.Close();
|
||||
|
||||
@@ -9418,11 +9418,15 @@ bool FormatScriptFromSection(CString& sScr,STSection* pSection)
|
||||
if (file.Open(sFullPath,CFile::modeRead))
|
||||
{
|
||||
ULONGLONG dwFileLength = file.GetLength();
|
||||
char* pszTxt = new char[dwFileLength];
|
||||
int nLen = (int)dwFileLength;
|
||||
|
||||
file.Read(pszTxt,dwFileLength);
|
||||
// 补终止符并按实际读到的长度赋值,避免把未初始化内存当字符串读
|
||||
char* pszTxt = new char[nLen + 1];
|
||||
::memset(pszTxt, 0, nLen + 1);
|
||||
|
||||
sRegionScrp = pszTxt;
|
||||
UINT nRead = file.Read(pszTxt, nLen);
|
||||
|
||||
sRegionScrp = CString(pszTxt, (int)nRead);
|
||||
delete [] pszTxt;
|
||||
|
||||
file.Close();
|
||||
|
||||
@@ -186,11 +186,15 @@ void CJMDBDlg::OnBnClickedButton2()
|
||||
if (file.Open(sFullPath, CFile::modeRead))
|
||||
{
|
||||
ULONGLONG dwFileLength = file.GetLength();
|
||||
char* pszTxt = new char[dwFileLength];
|
||||
int nLen = (int)dwFileLength;
|
||||
|
||||
file.Read(pszTxt, dwFileLength);
|
||||
// 补终止符并按实际读到的长度赋值,避免把未初始化内存当字符串读
|
||||
char* pszTxt = new char[nLen + 1];
|
||||
::memset(pszTxt, 0, nLen + 1);
|
||||
|
||||
m_sRegScr = pszTxt;
|
||||
UINT nRead = file.Read(pszTxt, nLen);
|
||||
|
||||
m_sRegScr = CString(pszTxt, (int)nRead);
|
||||
DELETE_ARR_(pszTxt);
|
||||
|
||||
file.Close();
|
||||
|
||||
@@ -152,11 +152,15 @@ void CJMSJDlg::OnBnClickedBtaddtodb()
|
||||
if (file.Open(sFullPath, CFile::modeRead))
|
||||
{
|
||||
ULONGLONG dwFileLength = file.GetLength();
|
||||
char* pszTxt = new char[dwFileLength];
|
||||
int nLen = (int)dwFileLength;
|
||||
|
||||
file.Read(pszTxt, dwFileLength);
|
||||
// 补终止符并按实际读到的长度赋值,避免把未初始化内存当字符串读
|
||||
char* pszTxt = new char[nLen + 1];
|
||||
::memset(pszTxt, 0, nLen + 1);
|
||||
|
||||
sRegionScrp = pszTxt;
|
||||
UINT nRead = file.Read(pszTxt, nLen);
|
||||
|
||||
sRegionScrp = CString(pszTxt, (int)nRead);
|
||||
DELETE_ARR_(pszTxt);
|
||||
|
||||
file.Close();
|
||||
|
||||
Reference in new issue
Block a user