表名汉字时保存数据失败修改

This commit is contained in:
zhaolei 2026-05-18 14:49:58 +08:00
parent 8ee53acc58
commit bb3b9a971b
3 changed files with 19 additions and 8 deletions

View File

@ -2,6 +2,8 @@
#include "DataHelper.h"
#include "LogIO.h"
#include "dataslothelper.h"
#include "geometryutils.h"
extern DEFAULTTABLE *DefauleTable;//[DefTabNum];
extern int DefTabNum;
/*
@ -140,7 +142,7 @@ void CCreateNewTableDlg::slotSave()
{
QMessageBox::warning(NULL,"警告!",FileName+"\r\n打开井次文件失败!");return ;
}
if(logio.FindObjectIndex(TableName.toStdString().c_str())>=0)
if(logio.FindObjectIndex(UTF8ToGBK(TableName))>=0)
{
QMessageBox::warning(NULL,"警告!","您要产生的表名称已存在!");return;
}
@ -189,7 +191,7 @@ void CCreateNewTableDlg::slotSave()
*(DWORD *)&pField[i].Reserved = strDigit.toInt();
}
int table=logio.CreateTable(0,TableName.toLocal8Bit().toStdString().c_str(),TableHzName.toLocal8Bit().toStdString().c_str(),fNum,&pField[0],0);
int table=logio.CreateTable(0,UTF8ToGBK(TableName),TableHzName.toLocal8Bit().toStdString().c_str(),fNum,&pField[0],0);
delete []pField;
logio.CloseTable(table);
logio.Close();

View File

@ -113,10 +113,19 @@ bool MappingMem(HANDLE *hHandle,LPSTR *hMem,int len,const char* name)
0, // low offset: beginning
0); // default: map entire file
#else
int hMapFile = open(slf1.toStdString().c_str(), O_RDONLY);
if (hMapFile<0)
// *hHandle = open(slf1.toStdString().c_str(), O_RDWR|O_CREAT,0644);
// if (*hHandle <0)
// return FALSE;
// void* p = mmap(0, 4096*512,PROT_READ|PROT_WRITE,MAP_SHARED,*hHandle,0);
*hHandle = -1;
void* p = mmap(0, 4096*512,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0);
if (p == MAP_FAILED)
{
//qDebug()<<p <<strerror(errno) <<errno;
return FALSE;
*hMem = (LPSTR )mmap(0, 0,PROT_READ,MAP_SHARED,hMapFile,0);
}
*hMem = (LPSTR )p;
#endif
if (*hMem == NULL) return FALSE;
return TRUE;

View File

@ -480,7 +480,7 @@ void WellLogTableDialogNew::slotSave()
return;
}
int index=logio->OpenCurve(m_pWellLogs[0]->GetName().toStdString().c_str());
int index=logio->OpenCurve(UTF8ToGBK(m_pWellLogs[0]->GetName()));
if(index>-1) {
flag=1;
}
@ -511,7 +511,7 @@ void WellLogTableDialogNew::slotSave()
int count=rowCount;
for(int j=0;j<m_pWellLogs.size();j++)
{
int index=logio->OpenCurve(m_pWellLogs[j]->GetName().toStdString().c_str());
int index=logio->OpenCurve(UTF8ToGBK(m_pWellLogs[0]->GetName()));
if(index>-1)
{
float *data=new float[rowCount+1];
@ -552,7 +552,7 @@ void WellLogTableDialogNew::slotSave()
delete logio;
return;
}
int iIndex=logio->OpenTable(m_pWellLogs[0]->GetName().toStdString().c_str());
int iIndex=logio->OpenTable(UTF8ToGBK(m_pWellLogs[0]->GetName()));
if (iIndex >=0)
{
int fc=logio->GetTableFieldCount(iIndex);