tabs to spaces
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2713 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
3f697a1217
commit
e6dd2ada8a
17 changed files with 196 additions and 197 deletions
|
@ -1944,7 +1944,7 @@ int CEXEBuild::write_output(void)
|
||||||
icon_offset = generate_unicons_offsets(header_data_new, m_unicon_data);
|
icon_offset = generate_unicons_offsets(header_data_new, m_unicon_data);
|
||||||
if (icon_offset == 0)
|
if (icon_offset == 0)
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
SCRIPT_MSG("Done!\n");
|
SCRIPT_MSG("Done!\n");
|
||||||
}
|
}
|
||||||
#endif //NSIS_CONFIG_UNINSTALL_SUPPORT
|
#endif //NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||||
|
|
||||||
|
@ -2678,7 +2678,7 @@ void CEXEBuild::init_res_editor()
|
||||||
{
|
{
|
||||||
build_compressor_set=true;
|
build_compressor_set=true;
|
||||||
if (!res_editor)
|
if (!res_editor)
|
||||||
res_editor=new CResourceEditor(header_data_new, exeheader_size_new);
|
res_editor=new CResourceEditor(header_data_new, exeheader_size_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXEBuild::close_res_editor()
|
void CEXEBuild::close_res_editor()
|
||||||
|
@ -2694,48 +2694,48 @@ void CEXEBuild::close_res_editor()
|
||||||
#ifdef NSIS_SUPPORT_NAMED_USERVARS
|
#ifdef NSIS_SUPPORT_NAMED_USERVARS
|
||||||
int CEXEBuild::DeclaredUserVar(const char *szVarName)
|
int CEXEBuild::DeclaredUserVar(const char *szVarName)
|
||||||
{
|
{
|
||||||
int idxUserVar = m_UserVarNames.get((char*)szVarName);
|
int idxUserVar = m_UserVarNames.get((char*)szVarName);
|
||||||
if ( idxUserVar > 0 )
|
if ( idxUserVar > 0 )
|
||||||
{
|
{
|
||||||
ERROR_MSG("Error: variable \"%s\" already declared\n", szVarName);
|
ERROR_MSG("Error: variable \"%s\" already declared\n", szVarName);
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
const char *pVarName = szVarName;
|
const char *pVarName = szVarName;
|
||||||
int iVarLen = strlen(szVarName);
|
int iVarLen = strlen(szVarName);
|
||||||
|
|
||||||
if ( iVarLen > 60 )
|
if ( iVarLen > 60 )
|
||||||
{
|
{
|
||||||
ERROR_MSG("Error: variable name too long!\n");
|
ERROR_MSG("Error: variable name too long!\n");
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
else if ( !iVarLen )
|
else if ( !iVarLen )
|
||||||
{
|
{
|
||||||
ERROR_MSG("Error: variable with empty name!\n");
|
ERROR_MSG("Error: variable with empty name!\n");
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while ( *pVarName )
|
while ( *pVarName )
|
||||||
{
|
{
|
||||||
if ( !isSimpleChar(*pVarName) )
|
if ( !isSimpleChar(*pVarName) )
|
||||||
{
|
{
|
||||||
ERROR_MSG("Error: invalid charaters in variable name \"%s\", use only charaters [a-z][A-Z][0-9] and '_'\n", szVarName);
|
ERROR_MSG("Error: invalid charaters in variable name \"%s\", use only charaters [a-z][A-Z][0-9] and '_'\n", szVarName);
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
pVarName++;
|
pVarName++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !strnicmp(szVarName,"un.",3) )
|
if ( !strnicmp(szVarName,"un.",3) )
|
||||||
m_UnUserVarNames.add(szVarName);
|
m_UnUserVarNames.add(szVarName);
|
||||||
else
|
else
|
||||||
m_UserVarNames.add(szVarName);
|
m_UserVarNames.add(szVarName);
|
||||||
if ( m_UserVarNames.getnum() > MAX_NAMED_USER_VARS || m_UnUserVarNames.getnum() > MAX_NAMED_USER_VARS )
|
if ( m_UserVarNames.getnum() > MAX_NAMED_USER_VARS || m_UnUserVarNames.getnum() > MAX_NAMED_USER_VARS )
|
||||||
{
|
{
|
||||||
ERROR_MSG("Error: too many user variables declared!\n");
|
ERROR_MSG("Error: too many user variables declared!\n");
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ class CEXEBuild {
|
||||||
char build_packname[1024], build_packcmd[1024];
|
char build_packname[1024], build_packcmd[1024];
|
||||||
int build_overwrite, build_compress, build_crcchk,
|
int build_overwrite, build_compress, build_crcchk,
|
||||||
build_datesave, build_optimize_datablock,
|
build_datesave, build_optimize_datablock,
|
||||||
build_allowskipfiles; // Added by ramon 23 May 2003
|
build_allowskipfiles; // Added by ramon 23 May 2003
|
||||||
|
|
||||||
header build_header;
|
header build_header;
|
||||||
int uninstall_mode;
|
int uninstall_mode;
|
||||||
|
|
|
@ -312,7 +312,7 @@ void fallbackSort ( UInt32* fmap,
|
||||||
r = -1;
|
r = -1;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
/*-- find the next non-singleton bucket --*/
|
/*-- find the next non-singleton bucket --*/
|
||||||
k = r + 1;
|
k = r + 1;
|
||||||
while (ISSET_BH(k) && UNALIGNED_BH(k)) k++;
|
while (ISSET_BH(k) && UNALIGNED_BH(k)) k++;
|
||||||
if (ISSET_BH(k)) {
|
if (ISSET_BH(k)) {
|
||||||
|
|
|
@ -377,7 +377,7 @@ int BZ2_bzCompress( bz_stream *strm, int action )
|
||||||
return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
|
return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (action == BZ_FLUSH) {
|
if (action == BZ_FLUSH) {
|
||||||
s->avail_in_expect = strm->avail_in;
|
s->avail_in_expect = strm->avail_in;
|
||||||
s->mode = BZ_M_FLUSHING;
|
s->mode = BZ_M_FLUSHING;
|
||||||
goto preswitch;
|
goto preswitch;
|
||||||
|
|
|
@ -360,14 +360,14 @@ void sendMTFValues ( EState* s )
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
Set up an auxiliary length table which is used to fast-track
|
Set up an auxiliary length table which is used to fast-track
|
||||||
the common case (nGroups == 6).
|
the common case (nGroups == 6).
|
||||||
---*/
|
---*/
|
||||||
if (nGroups == 6) {
|
if (nGroups == 6) {
|
||||||
for (v = 0; v < alphaSize; v++) {
|
for (v = 0; v < alphaSize; v++) {
|
||||||
s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v];
|
s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v];
|
||||||
s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v];
|
s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v];
|
||||||
s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v];
|
s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nSelectors = 0;
|
nSelectors = 0;
|
||||||
|
@ -416,7 +416,7 @@ void sendMTFValues ( EState* s )
|
||||||
cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
|
cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*--- slow version which correctly handles all situations ---*/
|
/*--- slow version which correctly handles all situations ---*/
|
||||||
for (i = gs; i <= ge; i++) {
|
for (i = gs; i <= ge; i++) {
|
||||||
UInt16 icv = mtfv[i];
|
UInt16 icv = mtfv[i];
|
||||||
for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
|
for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
|
||||||
|
@ -457,7 +457,7 @@ void sendMTFValues ( EState* s )
|
||||||
# undef BZ_ITUR
|
# undef BZ_ITUR
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*--- slow version which correctly handles all situations ---*/
|
/*--- slow version which correctly handles all situations ---*/
|
||||||
for (i = gs; i <= ge; i++)
|
for (i = gs; i <= ge; i++)
|
||||||
s->rfreq[bt][ mtfv[i] ]++;
|
s->rfreq[bt][ mtfv[i] ]++;
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ void sendMTFValues ( EState* s )
|
||||||
# undef BZ_ITAH
|
# undef BZ_ITAH
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*--- slow version which correctly handles all situations ---*/
|
/*--- slow version which correctly handles all situations ---*/
|
||||||
for (i = gs; i <= ge; i++) {
|
for (i = gs; i <= ge; i++) {
|
||||||
bsW ( s,
|
bsW ( s,
|
||||||
s->len [s->selector[selCtr]] [mtfv[i]],
|
s->len [s->selector[selCtr]] [mtfv[i]],
|
||||||
|
|
|
@ -36,15 +36,15 @@ LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
while (r.top < ry)
|
while (r.top < ry)
|
||||||
{
|
{
|
||||||
int rv,gv,bv;
|
int rv,gv,bv;
|
||||||
HBRUSH brush;
|
HBRUSH brush;
|
||||||
rv = (GetRValue(c2) * r.top + GetRValue(c1) * (ry-r.top)) / ry;
|
rv = (GetRValue(c2) * r.top + GetRValue(c1) * (ry-r.top)) / ry;
|
||||||
gv = (GetGValue(c2) * r.top + GetGValue(c1) * (ry-r.top)) / ry;
|
gv = (GetGValue(c2) * r.top + GetGValue(c1) * (ry-r.top)) / ry;
|
||||||
bv = (GetBValue(c2) * r.top + GetBValue(c1) * (ry-r.top)) / ry;
|
bv = (GetBValue(c2) * r.top + GetBValue(c1) * (ry-r.top)) / ry;
|
||||||
brush = CreateSolidBrush(RGB(rv,gv,bv));
|
brush = CreateSolidBrush(RGB(rv,gv,bv));
|
||||||
// note that we don't need to do "SelectObject(hdc, brush)"
|
// note that we don't need to do "SelectObject(hdc, brush)"
|
||||||
// because FillRect lets us specify the brush as a parameter.
|
// because FillRect lets us specify the brush as a parameter.
|
||||||
FillRect(hdc, &r, brush);
|
FillRect(hdc, &r, brush);
|
||||||
DeleteObject(brush);
|
DeleteObject(brush);
|
||||||
r.top+=4;
|
r.top+=4;
|
||||||
r.bottom+=4;
|
r.bottom+=4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,25 +32,25 @@ union installer_flags g_flags;
|
||||||
// but in win2k you need to do this manually.
|
// but in win2k you need to do this manually.
|
||||||
static LONG NSISCALL myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey, int onlyifempty)
|
static LONG NSISCALL myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey, int onlyifempty)
|
||||||
{
|
{
|
||||||
HKEY key;
|
HKEY key;
|
||||||
int retval=RegOpenKeyEx(thiskey,lpSubKey,0,KEY_ENUMERATE_SUB_KEYS,&key);
|
int retval=RegOpenKeyEx(thiskey,lpSubKey,0,KEY_ENUMERATE_SUB_KEYS,&key);
|
||||||
if (retval==ERROR_SUCCESS)
|
if (retval==ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// NB - don't change this to static (recursive function)
|
// NB - don't change this to static (recursive function)
|
||||||
char buffer[MAX_PATH+1];
|
char buffer[MAX_PATH+1];
|
||||||
while (RegEnumKey(key,0,buffer,MAX_PATH+1)==ERROR_SUCCESS)
|
while (RegEnumKey(key,0,buffer,MAX_PATH+1)==ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (onlyifempty)
|
if (onlyifempty)
|
||||||
{
|
{
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
return !ERROR_SUCCESS;
|
return !ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
if ((retval=myRegDeleteKeyEx(key,buffer,0)) != ERROR_SUCCESS) break;
|
if ((retval=myRegDeleteKeyEx(key,buffer,0)) != ERROR_SUCCESS) break;
|
||||||
}
|
}
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
retval=RegDeleteKey(thiskey,lpSubKey);
|
retval=RegDeleteKey(thiskey,lpSubKey);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif//NSIS_SUPPORT_REGISTRYFUNCTIONS
|
#endif//NSIS_SUPPORT_REGISTRYFUNCTIONS
|
||||||
|
|
||||||
|
@ -454,26 +454,26 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef overwriteflag
|
#undef overwriteflag
|
||||||
// Added by ramon 23 May 2003
|
// Added by ramon 23 May 2003
|
||||||
#undef allowskipfilesflag
|
#undef allowskipfilesflag
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif//NSIS_SUPPORT_FILE
|
#endif//NSIS_SUPPORT_FILE
|
||||||
#ifdef NSIS_SUPPORT_DELETE
|
#ifdef NSIS_SUPPORT_DELETE
|
||||||
case EW_DELETEFILE:
|
case EW_DELETEFILE:
|
||||||
{
|
{
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
WIN32_FIND_DATA fd;
|
WIN32_FIND_DATA fd;
|
||||||
char *buf1=process_string_fromparm_tobuf(0x10);
|
char *buf1=process_string_fromparm_tobuf(0x10);
|
||||||
mystrcpy(buf0,buf1);
|
mystrcpy(buf0,buf1);
|
||||||
log_printf2("Delete: \"%s\"",buf0);
|
log_printf2("Delete: \"%s\"",buf0);
|
||||||
trimslashtoend(buf0);
|
trimslashtoend(buf0);
|
||||||
h=FindFirstFile(buf1,&fd);
|
h=FindFirstFile(buf1,&fd);
|
||||||
if (h != INVALID_HANDLE_VALUE)
|
if (h != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
{
|
{
|
||||||
wsprintf(buf1,"%s\\%s",buf0,fd.cFileName);
|
wsprintf(buf1,"%s\\%s",buf0,fd.cFileName);
|
||||||
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
|
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
|
||||||
|
@ -503,8 +503,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (FindNextFile(h,&fd));
|
} while (FindNextFile(h,&fd));
|
||||||
FindClose(h);
|
FindClose(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif//NSIS_SUPPORT_DELETE
|
#endif//NSIS_SUPPORT_DELETE
|
||||||
|
@ -1038,12 +1038,12 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
case EW_COPYFILES: // CopyFile (added by NOP)
|
case EW_COPYFILES: // CopyFile (added by NOP)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
SHFILEOPSTRUCT op;
|
SHFILEOPSTRUCT op;
|
||||||
char *buf0=process_string_fromparm_tobuf(0x00);
|
char *buf0=process_string_fromparm_tobuf(0x00);
|
||||||
char *buf1=process_string_fromparm_tobuf(0x11);
|
char *buf1=process_string_fromparm_tobuf(0x11);
|
||||||
log_printf3("CopyFiles \"%s\"->\"%s\"",buf0,buf1);
|
log_printf3("CopyFiles \"%s\"->\"%s\"",buf0,buf1);
|
||||||
op.hwnd=g_hwnd;
|
op.hwnd=g_hwnd;
|
||||||
op.wFunc=FO_COPY;
|
op.wFunc=FO_COPY;
|
||||||
buf0[mystrlen(buf0)+1]=0;
|
buf0[mystrlen(buf0)+1]=0;
|
||||||
buf1[mystrlen(buf1)+1]=0;
|
buf1[mystrlen(buf1)+1]=0;
|
||||||
|
|
||||||
|
@ -1052,16 +1052,16 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
op.pFrom=buf0;
|
op.pFrom=buf0;
|
||||||
op.pTo=buf1;
|
op.pTo=buf1;
|
||||||
op.lpszProgressTitle=buf2;
|
op.lpszProgressTitle=buf2;
|
||||||
op.fFlags=parm2;
|
op.fFlags=parm2;
|
||||||
update_status_text("",buf2);
|
update_status_text("",buf2);
|
||||||
res=SHFileOperation(&op);
|
res=SHFileOperation(&op);
|
||||||
if (res)
|
if (res)
|
||||||
{ // some of these changes were from Edgewise (wiked_edge@yahoo.com)
|
{ // some of these changes were from Edgewise (wiked_edge@yahoo.com)
|
||||||
update_status_text_from_lang(LANG_COPYFAILED,"");
|
update_status_text_from_lang(LANG_COPYFAILED,"");
|
||||||
g_flags.exec_error++;
|
g_flags.exec_error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif//NSIS_SUPPORT_COPYFILES
|
#endif//NSIS_SUPPORT_COPYFILES
|
||||||
#ifdef NSIS_SUPPORT_REBOOT
|
#ifdef NSIS_SUPPORT_REBOOT
|
||||||
case EW_REBOOT:
|
case EW_REBOOT:
|
||||||
|
@ -1219,8 +1219,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
p[0]=0;
|
p[0]=0;
|
||||||
if (RegOpenKeyEx((HKEY)rootkey,buf0,0,KEY_READ,&hKey) == ERROR_SUCCESS)
|
if (RegOpenKeyEx((HKEY)rootkey,buf0,0,KEY_READ,&hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DWORD l = NSIS_MAX_STRLEN;
|
DWORD l = NSIS_MAX_STRLEN;
|
||||||
DWORD t;
|
DWORD t;
|
||||||
|
|
||||||
if (RegQueryValueEx(hKey,buf1,NULL,&t,p,&l ) != ERROR_SUCCESS ||
|
if (RegQueryValueEx(hKey,buf1,NULL,&t,p,&l ) != ERROR_SUCCESS ||
|
||||||
(t != REG_DWORD && t != REG_SZ && t != REG_EXPAND_SZ))
|
(t != REG_DWORD && t != REG_SZ && t != REG_EXPAND_SZ))
|
||||||
|
|
|
@ -457,7 +457,7 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int which;
|
int which;
|
||||||
int offsets[MAX_ENTRY_OFFSETS]; // count and meaning of offsets depend on 'which'
|
int offsets[MAX_ENTRY_OFFSETS]; // count and meaning of offsets depend on 'which'
|
||||||
} entry;
|
} entry;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -144,15 +144,15 @@ void NSISCALL trimslashtoend(char *buf)
|
||||||
char * NSISCALL scanendslash(const char *str)
|
char * NSISCALL scanendslash(const char *str)
|
||||||
{
|
{
|
||||||
char *s=CharPrev(str,str+mystrlen(str));
|
char *s=CharPrev(str,str+mystrlen(str));
|
||||||
if (!*str) return (char*)str-1;
|
if (!*str) return (char*)str-1;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
if ('\\' == *s) return s;
|
if ('\\' == *s) return s;
|
||||||
t=CharPrev(str,s);
|
t=CharPrev(str,s);
|
||||||
if (t==s) return (char*)str-1;
|
if (t==s) return (char*)str-1;
|
||||||
s=t;
|
s=t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int NSISCALL validpathspec(char *ubuf)
|
int NSISCALL validpathspec(char *ubuf)
|
||||||
|
@ -326,12 +326,12 @@ BOOL NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
||||||
|
|
||||||
void NSISCALL myRegGetStr(HKEY root, const char *sub, const char *name, char *out)
|
void NSISCALL myRegGetStr(HKEY root, const char *sub, const char *name, char *out)
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
*out=0;
|
*out=0;
|
||||||
if (RegOpenKeyEx(root,sub,0,KEY_READ,&hKey) == ERROR_SUCCESS)
|
if (RegOpenKeyEx(root,sub,0,KEY_READ,&hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DWORD l = NSIS_MAX_STRLEN;
|
DWORD l = NSIS_MAX_STRLEN;
|
||||||
DWORD t;
|
DWORD t;
|
||||||
if (RegQueryValueEx(hKey,name,NULL,&t,out,&l ) != ERROR_SUCCESS || (t != REG_SZ && t != REG_EXPAND_SZ)) *out=0;
|
if (RegQueryValueEx(hKey,name,NULL,&t,out,&l ) != ERROR_SUCCESS || (t != REG_SZ && t != REG_EXPAND_SZ)) *out=0;
|
||||||
out[NSIS_MAX_STRLEN-1]=0;
|
out[NSIS_MAX_STRLEN-1]=0;
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
@ -424,11 +424,11 @@ char * NSISCALL process_string(const char *in)
|
||||||
#ifndef NSIS_SUPPORT_NAMED_USERVARS
|
#ifndef NSIS_SUPPORT_NAMED_USERVARS
|
||||||
if (nVarIdx < VAR_CODES_START)
|
if (nVarIdx < VAR_CODES_START)
|
||||||
{
|
{
|
||||||
*out++ = nVarIdx;
|
*out++ = nVarIdx;
|
||||||
}
|
}
|
||||||
else if (nVarIdx == 255)
|
else if (nVarIdx == 255)
|
||||||
{
|
{
|
||||||
*out++ = *in++;
|
*out++ = *in++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -544,7 +544,7 @@ char * NSISCALL process_string(const char *in)
|
||||||
|
|
||||||
if (nVarIdx == 255)
|
if (nVarIdx == 255)
|
||||||
{
|
{
|
||||||
*out++ = *in++;
|
*out++ = *in++;
|
||||||
}
|
}
|
||||||
else if (nVarIdx == VAR_CODES_START)
|
else if (nVarIdx == VAR_CODES_START)
|
||||||
{
|
{
|
||||||
|
@ -634,7 +634,7 @@ char * NSISCALL process_string(const char *in)
|
||||||
#endif
|
#endif
|
||||||
else // Normal char
|
else // Normal char
|
||||||
{
|
{
|
||||||
*out++ = nVarIdx;
|
*out++ = nVarIdx;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // while
|
} // while
|
||||||
|
|
|
@ -67,8 +67,8 @@ void * NSISCALL mini_memcpy(void *out, const void *in, int len);
|
||||||
// Turn four chars into a dword
|
// Turn four chars into a dword
|
||||||
#ifdef __BIG_ENDIAN__ // Not very likely, but, still...
|
#ifdef __BIG_ENDIAN__ // Not very likely, but, still...
|
||||||
#define CHAR2_TO_WORD(a,b) (((WORD)(b))|((a)<<8))
|
#define CHAR2_TO_WORD(a,b) (((WORD)(b))|((a)<<8))
|
||||||
#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(c,d))|(CHAR2_TO_WORD(a,b)<<16))
|
#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(c,d))|(CHAR2_TO_WORD(a,b)<<16))
|
||||||
#else
|
#else
|
||||||
#define CHAR2_TO_WORD(a,b) (((WORD)(a))|((b)<<8))
|
#define CHAR2_TO_WORD(a,b) (((WORD)(a))|((b)<<8))
|
||||||
#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(a,b))|(CHAR2_TO_WORD(c,d)<<16))
|
#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(a,b))|(CHAR2_TO_WORD(c,d)<<16))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -793,7 +793,7 @@ NLF::NLF(char *filename) {
|
||||||
|
|
||||||
if (nlf_version < 4) {
|
if (nlf_version < 4) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case NLF_LOG_INSTALL_PROCESS:
|
case NLF_LOG_INSTALL_PROCESS:
|
||||||
case NLF_BYTE:
|
case NLF_BYTE:
|
||||||
case NLF_KILO:
|
case NLF_KILO:
|
||||||
case NLF_MEGA:
|
case NLF_MEGA:
|
||||||
|
@ -832,7 +832,7 @@ NLF::NLF(char *filename) {
|
||||||
if (*in == '\\') {
|
if (*in == '\\') {
|
||||||
in++;
|
in++;
|
||||||
switch (*in) {
|
switch (*in) {
|
||||||
case 'n':
|
case 'n':
|
||||||
*out = '\n';
|
*out = '\n';
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
|
|
|
@ -149,7 +149,7 @@ class LineParser {
|
||||||
{
|
{
|
||||||
if (line[0] == '$' && line[1] == '\\') {
|
if (line[0] == '$' && line[1] == '\\') {
|
||||||
switch (line[2]) {
|
switch (line[2]) {
|
||||||
case '"':
|
case '"':
|
||||||
case '\'':
|
case '\'':
|
||||||
case '`':
|
case '`':
|
||||||
nc += ignore_escaping ? 3 : 1;
|
nc += ignore_escaping ? 3 : 1;
|
||||||
|
@ -171,7 +171,7 @@ class LineParser {
|
||||||
for (i = 0; p < line; i++, p++) {
|
for (i = 0; p < line; i++, p++) {
|
||||||
if (!ignore_escaping && p[0] == '$' && p[1] == '\\') {
|
if (!ignore_escaping && p[0] == '$' && p[1] == '\\') {
|
||||||
switch (p[2]) {
|
switch (p[2]) {
|
||||||
case '"':
|
case '"':
|
||||||
case '\'':
|
case '\'':
|
||||||
case '`':
|
case '`':
|
||||||
p += 2;
|
p += 2;
|
||||||
|
|
|
@ -828,7 +828,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
if (k != 4) {
|
if (k != 4) {
|
||||||
lstrcpy(build_last_page_define, line.gettoken_str(5));
|
lstrcpy(build_last_page_define, line.gettoken_str(5));
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
if (*line.gettoken_str(4))
|
if (*line.gettoken_str(4))
|
||||||
p.leavefunc = ns_func.add(line.gettoken_str(4),0);
|
p.leavefunc = ns_func.add(line.gettoken_str(4),0);
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -868,7 +868,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case 0:
|
case 0:
|
||||||
p.id = NSIS_PAGE_CUSTOM;
|
p.id = NSIS_PAGE_CUSTOM;
|
||||||
build_custom_used++;
|
build_custom_used++;
|
||||||
break;
|
break;
|
||||||
|
@ -972,7 +972,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
if (k != 2) {
|
if (k != 2) {
|
||||||
lstrcpy(ubuild_last_page_define, line.gettoken_str(5));
|
lstrcpy(ubuild_last_page_define, line.gettoken_str(5));
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
if (*line.gettoken_str(4)) {
|
if (*line.gettoken_str(4)) {
|
||||||
if (strnicmp(line.gettoken_str(4),"un.",3)) {
|
if (strnicmp(line.gettoken_str(4),"un.",3)) {
|
||||||
ERROR_MSG("\nError: uninstall function must have a un. prefix!\n");
|
ERROR_MSG("\nError: uninstall function must have a un. prefix!\n");
|
||||||
|
@ -1037,7 +1037,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case 0:
|
case 0:
|
||||||
p.id = NSIS_PAGE_CUSTOM;
|
p.id = NSIS_PAGE_CUSTOM;
|
||||||
ubuild_custom_used++;
|
ubuild_custom_used++;
|
||||||
break;
|
break;
|
||||||
|
@ -1143,7 +1143,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
int err = update_bitmap(res_editor, IDB_BITMAP1, line.gettoken_str(1), 96, 16, 8);
|
int err = update_bitmap(res_editor, IDB_BITMAP1, line.gettoken_str(1), 96, 16, 8);
|
||||||
if (err) {
|
if (err) {
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case -1:
|
case -1:
|
||||||
ERROR_MSG("Error: can't find bitmap\n");
|
ERROR_MSG("Error: can't find bitmap\n");
|
||||||
break;
|
break;
|
||||||
case -2:
|
case -2:
|
||||||
|
@ -1325,7 +1325,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
if (k < line.getnumtokens() - 2 - a) PRINTHELP()
|
if (k < line.getnumtokens() - 2 - a) PRINTHELP()
|
||||||
|
|
||||||
switch (line.getnumtokens()-a) {
|
switch (line.getnumtokens()-a) {
|
||||||
case 4:
|
case 4:
|
||||||
SetString(line.gettoken_str(3+a), NLF_BTN_LICENSE_DISAGREE, 0, lang);
|
SetString(line.gettoken_str(3+a), NLF_BTN_LICENSE_DISAGREE, 0, lang);
|
||||||
case 3:
|
case 3:
|
||||||
SetString(line.gettoken_str(2+a), NLF_BTN_LICENSE_AGREE, 0, lang);
|
SetString(line.gettoken_str(2+a), NLF_BTN_LICENSE_AGREE, 0, lang);
|
||||||
|
@ -1341,7 +1341,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
free(dlg);
|
free(dlg);
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case 0:
|
case 0:
|
||||||
build_header.common.flags&=~CH_FLAGS_LICENSE_FORCE_SELECTION;
|
build_header.common.flags&=~CH_FLAGS_LICENSE_FORCE_SELECTION;
|
||||||
dt.RemoveItem(IDC_LICENSEAGREE);
|
dt.RemoveItem(IDC_LICENSEAGREE);
|
||||||
dt.RemoveItem(IDC_LICENSEDISAGREE);
|
dt.RemoveItem(IDC_LICENSEDISAGREE);
|
||||||
|
@ -4599,7 +4599,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
#endif//!NSIS_SUPPORT_CREATEFONT
|
#endif//!NSIS_SUPPORT_CREATEFONT
|
||||||
|
|
||||||
// Added by ramon 3 jun 2003
|
// Added by ramon 3 jun 2003
|
||||||
#ifdef NSIS_SUPPORT_NAMED_USERVARS
|
#ifdef NSIS_SUPPORT_NAMED_USERVARS
|
||||||
case TOK_DEFVAR:
|
case TOK_DEFVAR:
|
||||||
{
|
{
|
||||||
|
@ -4609,7 +4609,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
||||||
|
|
||||||
#else //NSIS_SUPPORT_NAMED_USERVARS
|
#else //NSIS_SUPPORT_NAMED_USERVARS
|
||||||
case TOK_DEFVAR:
|
case TOK_DEFVAR:
|
||||||
ERROR_MSG("Error: %s specified, case NSIS_SUPPORT_NAMED_USERVARS not defined.\n",line.gettoken_str(0));
|
ERROR_MSG("Error: %s specified, case NSIS_SUPPORT_NAMED_USERVARS not defined.\n",line.gettoken_str(0));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
#endif //NSIS_SUPPORT_NAMED_USERVARS
|
#endif //NSIS_SUPPORT_NAMED_USERVARS
|
||||||
|
|
|
@ -273,8 +273,8 @@ int generate_unicons_offsets(unsigned char* exeHeader, unsigned char* uninstIcon
|
||||||
PIMAGE_SECTION_HEADER sectionHeadersArray = IMAGE_FIRST_SECTION(ntHeaders);
|
PIMAGE_SECTION_HEADER sectionHeadersArray = IMAGE_FIRST_SECTION(ntHeaders);
|
||||||
|
|
||||||
for (i = 0; i < ntHeaders->FileHeader.NumberOfSections; i++)
|
for (i = 0; i < ntHeaders->FileHeader.NumberOfSections; i++)
|
||||||
if (dwResourceSectionVA == sectionHeadersArray[i].VirtualAddress)
|
if (dwResourceSectionVA == sectionHeadersArray[i].VirtualAddress)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
MY_ASSERT(i == ntHeaders->FileHeader.NumberOfSections, "can't find resource section");
|
MY_ASSERT(i == ntHeaders->FileHeader.NumberOfSections, "can't find resource section");
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ typedef struct internal_state {
|
||||||
void _tr_init OF((deflate_state *s));
|
void _tr_init OF((deflate_state *s));
|
||||||
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
||||||
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||||
int eof));
|
int eof));
|
||||||
void _tr_align OF((deflate_state *s));
|
void _tr_align OF((deflate_state *s));
|
||||||
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||||
int eof));
|
int eof));
|
||||||
|
|
|
@ -104,13 +104,13 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size)
|
||||||
int stream_size;
|
int stream_size;
|
||||||
{
|
{
|
||||||
return deflateInit2_(strm, level, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL,
|
return deflateInit2_(strm, level, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL,
|
||||||
Z_DEFAULT_STRATEGY, version, stream_size);
|
Z_DEFAULT_STRATEGY, version, stream_size);
|
||||||
/* To do: ignore strm->next_in if we use it as window */
|
/* To do: ignore strm->next_in if we use it as window */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||||
version, stream_size)
|
version, stream_size)
|
||||||
z_streamp strm;
|
z_streamp strm;
|
||||||
int level;
|
int level;
|
||||||
int method;
|
int method;
|
||||||
|
@ -129,7 +129,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (stream_size != sizeof(z_stream)) {
|
if (stream_size != sizeof(z_stream)) {
|
||||||
return Z_VERSION_ERROR;
|
return Z_VERSION_ERROR;
|
||||||
}
|
}
|
||||||
if (strm == Z_NULL) return Z_STREAM_ERROR;
|
if (strm == Z_NULL) return Z_STREAM_ERROR;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||||
}
|
}
|
||||||
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
|
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
|
||||||
windowBits < 8 || windowBits > MAX_WBITS || level < 0 || level > 9 ||
|
windowBits < 8 || windowBits > MAX_WBITS || level < 0 || level > 9 ||
|
||||||
strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
|
strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
|
||||||
|
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -204,9 +204,9 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
|
||||||
|
|
||||||
if (length < MIN_MATCH) return Z_OK;
|
if (length < MIN_MATCH) return Z_OK;
|
||||||
if (length > MAX_DIST(s)) {
|
if (length > MAX_DIST(s)) {
|
||||||
length = MAX_DIST(s);
|
length = MAX_DIST(s);
|
||||||
#ifndef USE_DICT_HEAD
|
#ifndef USE_DICT_HEAD
|
||||||
dictionary += dictLength - length; /* use the tail of the dictionary */
|
dictionary += dictLength - length; /* use the tail of the dictionary */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
zmemcpy(s->window, dictionary, length);
|
zmemcpy(s->window, dictionary, length);
|
||||||
|
@ -216,7 +216,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
|
||||||
s->ins_h = s->window[0];
|
s->ins_h = s->window[0];
|
||||||
UPDATE_HASH(s, s->ins_h, s->window[1]);
|
UPDATE_HASH(s, s->ins_h, s->window[1]);
|
||||||
for (n = 0; n <= length - MIN_MATCH; n++) {
|
for (n = 0; n <= length - MIN_MATCH; n++) {
|
||||||
INSERT_STRING(s, n, hash_head);
|
INSERT_STRING(s, n, hash_head);
|
||||||
}
|
}
|
||||||
if (hash_head) hash_head = 0; /* to make compiler happy */
|
if (hash_head) hash_head = 0; /* to make compiler happy */
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
|
@ -263,19 +263,19 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
||||||
s = strm->state;
|
s = strm->state;
|
||||||
|
|
||||||
if (level == Z_DEFAULT_COMPRESSION) {
|
if (level == Z_DEFAULT_COMPRESSION) {
|
||||||
level = 6;
|
level = 6;
|
||||||
}
|
}
|
||||||
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
|
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
func = configuration_table.func;
|
func = configuration_table.func;
|
||||||
|
|
||||||
s->level = level;
|
s->level = level;
|
||||||
s->max_lazy_match = configuration_table.max_lazy;
|
s->max_lazy_match = configuration_table.max_lazy;
|
||||||
s->good_match = configuration_table.good_length;
|
s->good_match = configuration_table.good_length;
|
||||||
s->nice_match = configuration_table.nice_length;
|
s->nice_match = configuration_table.nice_length;
|
||||||
s->max_chain_length = configuration_table.max_chain;
|
s->max_chain_length = configuration_table.max_chain;
|
||||||
s->strategy = strategy;
|
s->strategy = strategy;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,14 +315,14 @@ int ZEXPORT deflate (strm, flush)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
|
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL ||
|
if (strm == Z_NULL || strm->state == Z_NULL ||
|
||||||
flush > Z_FINISH || flush < 0) {
|
flush > Z_FINISH || flush < 0) {
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
s = strm->state;
|
s = strm->state;
|
||||||
|
|
||||||
if (strm->next_out == Z_NULL ||
|
if (strm->next_out == Z_NULL ||
|
||||||
(strm->next_in == Z_NULL && strm->avail_in != 0) ||
|
(strm->next_in == Z_NULL && strm->avail_in != 0) ||
|
||||||
(s->status == FINISH_STATE && flush != Z_FINISH)) {
|
(s->status == FINISH_STATE && flush != Z_FINISH)) {
|
||||||
ERR_RETURN(strm, Z_STREAM_ERROR);
|
ERR_RETURN(strm, Z_STREAM_ERROR);
|
||||||
}
|
}
|
||||||
if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
|
if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
|
||||||
|
@ -339,30 +339,30 @@ int ZEXPORT deflate (strm, flush)
|
||||||
|
|
||||||
if (level_flags > 3) level_flags = 3;
|
if (level_flags > 3) level_flags = 3;
|
||||||
header |= (level_flags << 6);
|
header |= (level_flags << 6);
|
||||||
if (s->strstart != 0) header |= PRESET_DICT;
|
if (s->strstart != 0) header |= PRESET_DICT;
|
||||||
header += 31 - (header % 31);
|
header += 31 - (header % 31);
|
||||||
|
|
||||||
s->status = BUSY_STATE;
|
s->status = BUSY_STATE;
|
||||||
putShortMSB(s, header);
|
putShortMSB(s, header);
|
||||||
|
|
||||||
/* Save the adler32 of the preset dictionary: */
|
/* Save the adler32 of the preset dictionary: */
|
||||||
if (s->strstart != 0) {
|
if (s->strstart != 0) {
|
||||||
// putShortMSB(s, (uInt)(strm->adler >> 16));
|
//putShortMSB(s, (uInt)(strm->adler >> 16));
|
||||||
// putShortMSB(s, (uInt)(strm->adler & 0xffff));
|
//putShortMSB(s, (uInt)(strm->adler & 0xffff));
|
||||||
}
|
}
|
||||||
// strm->adler = 1L;
|
//strm->adler = 1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush as much pending output as possible */
|
/* Flush as much pending output as possible */
|
||||||
if (s->pending != 0) {
|
if (s->pending != 0) {
|
||||||
flush_pending(strm);
|
flush_pending(strm);
|
||||||
if (strm->avail_out == 0) {
|
if (strm->avail_out == 0) {
|
||||||
s->last_flush = -1;
|
s->last_flush = -1;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (strm->avail_in == 0 && flush <= old_flush &&
|
} else if (strm->avail_in == 0 && flush <= old_flush &&
|
||||||
flush != Z_FINISH) {
|
flush != Z_FINISH) {
|
||||||
ERR_RETURN(strm, Z_BUF_ERROR);
|
ERR_RETURN(strm, Z_BUF_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,17 +377,17 @@ int ZEXPORT deflate (strm, flush)
|
||||||
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
|
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
|
||||||
block_state bstate;
|
block_state bstate;
|
||||||
|
|
||||||
bstate = (*(configuration_table.func))(s, flush);
|
bstate = (*(configuration_table.func))(s, flush);
|
||||||
|
|
||||||
if (bstate == finish_started || bstate == finish_done) {
|
if (bstate == finish_started || bstate == finish_done) {
|
||||||
s->status = FINISH_STATE;
|
s->status = FINISH_STATE;
|
||||||
}
|
}
|
||||||
if (bstate == need_more || bstate == finish_started) {
|
if (bstate == need_more || bstate == finish_started) {
|
||||||
if (strm->avail_out == 0) {
|
if (strm->avail_out == 0) {
|
||||||
s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
|
s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
|
||||||
}
|
}
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
if (bstate == block_done) {
|
if (bstate == block_done) {
|
||||||
if (flush == Z_PARTIAL_FLUSH) {
|
if (flush == Z_PARTIAL_FLUSH) {
|
||||||
_tr_align(s);
|
_tr_align(s);
|
||||||
|
@ -401,10 +401,10 @@ int ZEXPORT deflate (strm, flush)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flush_pending(strm);
|
flush_pending(strm);
|
||||||
if (strm->avail_out == 0) {
|
if (strm->avail_out == 0) {
|
||||||
s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
|
s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assert(strm->avail_out > 0, "bug2");
|
Assert(strm->avail_out > 0, "bug2");
|
||||||
|
@ -427,7 +427,7 @@ int ZEXPORT deflateEnd (strm)
|
||||||
|
|
||||||
status = strm->state->status;
|
status = strm->state->status;
|
||||||
if (status != INIT_STATE && status != BUSY_STATE &&
|
if (status != INIT_STATE && status != BUSY_STATE &&
|
||||||
status != FINISH_STATE) {
|
status != FINISH_STATE) {
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,10 +647,10 @@ local uInt longest_match(s, cur_match)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
} while (*++scan == *++match && *++scan == *++match &&
|
} while (*++scan == *++match && *++scan == *++match &&
|
||||||
*++scan == *++match && *++scan == *++match &&
|
*++scan == *++match && *++scan == *++match &&
|
||||||
*++scan == *++match && *++scan == *++match &&
|
*++scan == *++match && *++scan == *++match &&
|
||||||
*++scan == *++match && *++scan == *++match &&
|
*++scan == *++match && *++scan == *++match &&
|
||||||
scan < strend);
|
scan < strend);
|
||||||
|
|
||||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
||||||
|
|
||||||
|
@ -697,23 +697,23 @@ local void fill_window(s)
|
||||||
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
||||||
s->block_start -= (long) wsize;
|
s->block_start -= (long) wsize;
|
||||||
|
|
||||||
n = s->hash_size;
|
n = s->hash_size;
|
||||||
p = &s->head[n];
|
p = &s->head[n];
|
||||||
do {
|
do {
|
||||||
m = *--p;
|
m = *--p;
|
||||||
*p = (Pos)(m >= wsize ? m-wsize : NIL);
|
*p = (Pos)(m >= wsize ? m-wsize : NIL);
|
||||||
} while (--n);
|
} while (--n);
|
||||||
|
|
||||||
n = wsize;
|
n = wsize;
|
||||||
#ifndef FASTEST
|
#ifndef FASTEST
|
||||||
p = &s->prev[n];
|
p = &s->prev[n];
|
||||||
do {
|
do {
|
||||||
m = *--p;
|
m = *--p;
|
||||||
*p = (Pos)(m >= wsize ? m-wsize : NIL);
|
*p = (Pos)(m >= wsize ? m-wsize : NIL);
|
||||||
/* If n is not on any hash chain, prev[n] is garbage but
|
/* If n is not on any hash chain, prev[n] is garbage but
|
||||||
* its value will never be used.
|
* its value will never be used.
|
||||||
*/
|
*/
|
||||||
} while (--n);
|
} while (--n);
|
||||||
#endif
|
#endif
|
||||||
more += wsize;
|
more += wsize;
|
||||||
}
|
}
|
||||||
|
@ -739,8 +739,8 @@ local void fill_window(s)
|
||||||
_tr_flush_block(s, (s->block_start >= 0L ? \
|
_tr_flush_block(s, (s->block_start >= 0L ? \
|
||||||
(charf *)&s->window[(unsigned)s->block_start] : \
|
(charf *)&s->window[(unsigned)s->block_start] : \
|
||||||
(charf *)Z_NULL), \
|
(charf *)Z_NULL), \
|
||||||
(ulg)((long)s->strstart - s->block_start), \
|
(ulg)((long)s->strstart - s->block_start), \
|
||||||
(eof)); \
|
(eof)); \
|
||||||
s->block_start = s->strstart; \
|
s->block_start = s->strstart; \
|
||||||
flush_pending(s->strm); \
|
flush_pending(s->strm); \
|
||||||
Tracev((stderr,"[FLUSH]")); \
|
Tracev((stderr,"[FLUSH]")); \
|
||||||
|
@ -766,8 +766,8 @@ local block_state deflate_slow(s, flush)
|
||||||
if (s->lookahead < MIN_LOOKAHEAD) {
|
if (s->lookahead < MIN_LOOKAHEAD) {
|
||||||
fill_window(s);
|
fill_window(s);
|
||||||
if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
|
if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
|
||||||
return need_more;
|
return need_more;
|
||||||
}
|
}
|
||||||
if (s->lookahead == 0) break; /* flush the current block */
|
if (s->lookahead == 0) break; /* flush the current block */
|
||||||
}
|
}
|
||||||
if (s->lookahead >= MIN_MATCH) {
|
if (s->lookahead >= MIN_MATCH) {
|
||||||
|
@ -800,7 +800,7 @@ local block_state deflate_slow(s, flush)
|
||||||
check_match(s, s->strstart-1, s->prev_match, s->prev_length);
|
check_match(s, s->strstart-1, s->prev_match, s->prev_length);
|
||||||
|
|
||||||
_tr_tally_dist(s, s->strstart -1 - s->prev_match,
|
_tr_tally_dist(s, s->strstart -1 - s->prev_match,
|
||||||
s->prev_length - MIN_MATCH, bflush);
|
s->prev_length - MIN_MATCH, bflush);
|
||||||
|
|
||||||
s->lookahead -= s->prev_length-1;
|
s->lookahead -= s->prev_length-1;
|
||||||
s->prev_length -= 2;
|
s->prev_length -= 2;
|
||||||
|
@ -817,8 +817,8 @@ local block_state deflate_slow(s, flush)
|
||||||
|
|
||||||
} else if (s->match_available) {
|
} else if (s->match_available) {
|
||||||
Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
||||||
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
||||||
if (bflush) {
|
if (bflush) {
|
||||||
FLUSH_BLOCK_ONLY(s, 0);
|
FLUSH_BLOCK_ONLY(s, 0);
|
||||||
}
|
}
|
||||||
s->strstart++;
|
s->strstart++;
|
||||||
|
|
|
@ -660,30 +660,29 @@ void _tr_flush_block(s, buf, stored_len, eof)
|
||||||
/* Build the Huffman trees unless a stored block is forced */
|
/* Build the Huffman trees unless a stored block is forced */
|
||||||
if (s->level > 0) {
|
if (s->level > 0) {
|
||||||
|
|
||||||
|
/* Construct the literal and distance trees */
|
||||||
|
build_tree(s, (tree_desc *)(&(s->l_desc)));
|
||||||
|
Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
|
||||||
|
s->static_len));
|
||||||
|
|
||||||
/* Construct the literal and distance trees */
|
build_tree(s, (tree_desc *)(&(s->d_desc)));
|
||||||
build_tree(s, (tree_desc *)(&(s->l_desc)));
|
Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
|
||||||
Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
|
s->static_len));
|
||||||
s->static_len));
|
max_blindex = build_bl_tree(s);
|
||||||
|
|
||||||
build_tree(s, (tree_desc *)(&(s->d_desc)));
|
/* Determine the best encoding. Compute first the block length in bytes*/
|
||||||
Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
|
opt_lenb = (s->opt_len+3+7)>>3;
|
||||||
s->static_len));
|
static_lenb = (s->static_len+3+7)>>3;
|
||||||
max_blindex = build_bl_tree(s);
|
|
||||||
|
|
||||||
/* Determine the best encoding. Compute first the block length in bytes*/
|
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
||||||
opt_lenb = (s->opt_len+3+7)>>3;
|
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||||
static_lenb = (s->static_len+3+7)>>3;
|
s->last_lit));
|
||||||
|
|
||||||
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
||||||
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
|
||||||
s->last_lit));
|
|
||||||
|
|
||||||
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Assert(buf != (char*)0, "lost buf");
|
Assert(buf != (char*)0, "lost buf");
|
||||||
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
|
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FORCE_STORED
|
#ifdef FORCE_STORED
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue