Minor code savings
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1237 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
735ff4c129
commit
ffa2d230a9
1 changed files with 12 additions and 14 deletions
|
@ -1343,7 +1343,6 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
int num=0;
|
int num=0;
|
||||||
int x=0;
|
|
||||||
LVCOLUMN lvc = {0, 0, -1, 0, 0, -1};
|
LVCOLUMN lvc = {0, 0, -1, 0, 0, -1};
|
||||||
int lb_bg=g_inst_cmnheader->lb_bg,lb_fg=g_inst_cmnheader->lb_fg;
|
int lb_bg=g_inst_cmnheader->lb_bg,lb_fg=g_inst_cmnheader->lb_fg;
|
||||||
|
|
||||||
|
@ -1358,8 +1357,9 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
int x;
|
||||||
log_printf3("New install of \"%s\" to \"%s\"",STR(LANG_NAME),state_install_directory);
|
log_printf3("New install of \"%s\" to \"%s\"",STR(LANG_NAME),state_install_directory);
|
||||||
for (; x < num_sections; x ++)
|
for (x=0; x < num_sections; x ++)
|
||||||
{
|
{
|
||||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||||
if (g_inst_section[x].default_state&DFS_SET)
|
if (g_inst_section[x].default_state&DFS_SET)
|
||||||
|
@ -1459,7 +1459,7 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
0,insthwnd,0))
|
0,insthwnd,0))
|
||||||
{
|
{
|
||||||
char textBuf[1024];
|
char textBuf[1024];
|
||||||
int i,total = 0;
|
int i,total = 1;
|
||||||
LVITEM item;
|
LVITEM item;
|
||||||
HGLOBAL memory;
|
HGLOBAL memory;
|
||||||
LPTSTR ptr,endPtr;
|
LPTSTR ptr,endPtr;
|
||||||
|
@ -1468,28 +1468,26 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
item.iSubItem = 0;
|
item.iSubItem = 0;
|
||||||
item.pszText = textBuf;
|
item.pszText = textBuf;
|
||||||
item.cchTextMax = 1023;
|
item.cchTextMax = 1023;
|
||||||
for (i = 0; i < count; i++)
|
i = count;
|
||||||
{
|
while (i--)
|
||||||
// Add 2 for the CR/LF combination that must follow every line.
|
// Add 2 for the CR/LF combination that must follow every line.
|
||||||
total += 2+SendMessage(insthwnd,LVM_GETITEMTEXT,i,(LPARAM)&item);
|
total += 2+SendMessage(insthwnd,LVM_GETITEMTEXT,i,(LPARAM)&item);
|
||||||
}
|
|
||||||
|
|
||||||
// 2nd pass - store detail view strings on the clipboard
|
// 2nd pass - store detail view strings on the clipboard
|
||||||
// Clipboard MSDN docs say mem must be GMEM_MOVEABLE
|
// Clipboard MSDN docs say mem must be GMEM_MOVEABLE
|
||||||
OpenClipboard(0);
|
OpenClipboard(0);
|
||||||
EmptyClipboard();
|
EmptyClipboard();
|
||||||
memory = GlobalAlloc(GMEM_MOVEABLE,total+1);
|
memory = GlobalAlloc(GMEM_MOVEABLE,total);
|
||||||
ptr = GlobalLock(memory);
|
ptr = GlobalLock(memory);
|
||||||
endPtr = ptr+total+1;
|
endPtr = ptr+total-2; // -2 to allow for CR/LF
|
||||||
for (i = 0; i < count; i++)
|
i = 0;
|
||||||
{
|
do {
|
||||||
// -2 to allow for CR/LF
|
ListView_GetItemText(insthwnd,i,0,ptr,endPtr-ptr);
|
||||||
ListView_GetItemText(insthwnd,i,0,ptr,(endPtr-2)-ptr);
|
|
||||||
while (*ptr) ptr++;
|
while (*ptr) ptr++;
|
||||||
*(WORD*)ptr = CHAR2_TO_WORD('\r','\n');
|
*(WORD*)ptr = CHAR2_TO_WORD('\r','\n');
|
||||||
ptr+=2;
|
ptr+=2;
|
||||||
}
|
} while (++i < count);
|
||||||
*ptr++ = 0;
|
*ptr = 0;
|
||||||
GlobalUnlock(memory);
|
GlobalUnlock(memory);
|
||||||
SetClipboardData(CF_TEXT,memory);
|
SetClipboardData(CF_TEXT,memory);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue