Skip to content
Permalink
Browse files

1. 0002912: В диалогах DM_SETTEXT, DM_GETTEXT не позволяют работать с…

…о строками содержащими '\0'.
  • Loading branch information...
zg0 committed Jan 20, 2015
1 parent 128ebdf commit 726f855bc43f8a19de9c2b01475aeae58978cf17
@@ -1,4 +1,8 @@
svs 19.01.2015 23:46:37 +0300 - build 4247
zg 20.01.2015 03:18:09 +0200 - build 4248

1. 0002912: В диалогах DM_SETTEXT, DM_GETTEXT не позволяют работать со строками содержащими '\0'.

svs 19.01.2015 23:46:37 +0300 - build 4247

1. SQLite 3.8.8

@@ -5655,7 +5655,7 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
auto InitItemData=[did,&Ptr,&Len]
{
if (!did->PtrLength)
did->PtrLength=Len;
did->PtrLength=Len; //BUGBUG: PtrLength ðàçìåð ïåðåäàííîãî íàì áóôåðà, çà÷åì ìû åãî ìåíÿåì?
else if (Len > did->PtrLength)
Len=did->PtrLength;

@@ -5677,11 +5677,16 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
case DI_EDIT:
case DI_PSWEDIT:
case DI_FIXEDIT:

if (!CurItem->ObjPtr)
break;

Ptr = static_cast<DlgEdit*>(CurItem->ObjPtr)->GetStringAddr();
{
auto edit=static_cast<DlgEdit*>(CurItem->ObjPtr);
if (edit)
{
Ptr = edit->GetStringAddr();
Len = edit->GetLength();
InitItemData();
}
break;
}
case DI_TEXT:
case DI_VTEXT:
case DI_SINGLEBOX:
@@ -5722,7 +5727,6 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
break;
}
default: // ïîäðàçóìåâàåì, ÷òî îñòàëèñü
did->PtrLength=0;
break;
}

@@ -5812,7 +5816,7 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
case DI_PSWEDIT:
case DI_FIXEDIT:
case DI_LISTBOX: // ìåíÿåò òîëüêî òåêóùèé ýëåìåíò
CurItem->strData = did->PtrData;
CurItem->strData = string(did->PtrData, did->PtrLength);
Len = CurItem->strData.size();
break;
default:
@@ -332,7 +332,7 @@ void DlgEdit::SetString(const string& Str, bool disable_autocomplete, int pos)
if (disable_autocomplete && (acompl = lineEdit->GetAutocomplete()))
lineEdit->SetAutocomplete(false);

lineEdit->SetString(Str.data());
lineEdit->SetString(Str.data(),Str.size());
if (pos >= 0)
lineEdit->SetCurPos(pos);

@@ -1 +1 @@
m4_define(BUILD,4247)m4_dnl
m4_define(BUILD,4248)m4_dnl
@@ -1,6 +1,6 @@
function export.GetGlobalInfo()
return {
Version = { 1, 0, 0, 474 },
Version = { 1, 0, 0, 475 },
MinFarVersion = { 3, 0, 0, 4244 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
@@ -1,4 +1,8 @@
shmuel 17.01.2015 23:05:52 +0200 - build 474
zg 20.01.2015 03:10:50 +0200 - build 475

1. 0002912: В диалогах DM_SETTEXT, DM_GETTEXT не позволяют работать со строками содержащими '\0'.

shmuel 17.01.2015 23:05:52 +0200 - build 474

1. Рефакторинг.

@@ -3076,10 +3076,12 @@ static int far_SendDlgMessage(lua_State *L)
case DM_GETDIALOGTITLE:
{
struct FarDialogItemData fdid;
size_t size;
fdid.StructSize = sizeof(fdid);
fdid.PtrLength = (size_t) Info->SendDlgMessage(hDlg, Msg, Param1, NULL);
fdid.PtrData = (wchar_t*) malloc((fdid.PtrLength+1) * sizeof(wchar_t));
push_utf8_string(L, Info->SendDlgMessage(hDlg, Msg, Param1, &fdid)?fdid.PtrData:L"", -1);
size = Info->SendDlgMessage(hDlg, Msg, Param1, &fdid);
push_utf8_string(L, size?fdid.PtrData:L"", size);
free(fdid.PtrData);
return 1;
}
@@ -3093,8 +3095,8 @@ static int far_SendDlgMessage(lua_State *L)
{
struct FarDialogItemData fdid;
fdid.StructSize = sizeof(fdid);
fdid.PtrData = (wchar_t*)check_utf8_string(L, 4, NULL);
fdid.PtrLength = 0; // wcslen(fdid.PtrData);
fdid.PtrLength = 0;
fdid.PtrData = (wchar_t*)check_utf8_string(L, 4, &fdid.PtrLength);
lua_pushinteger(L, Info->SendDlgMessage(hDlg, Msg, Param1, &fdid));
return 1;
}
@@ -1,6 +1,6 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 474
#define PLUGIN_BUILD 475
#define PLUGIN_DESC "Lua Macros for Far Manager"
#define PLUGIN_NAME "LuaMacro"
#define PLUGIN_FILENAME "luamacro.dll"

0 comments on commit 726f855

Please sign in to comment.
You can’t perform that action at this time.