get rid of some #ifdef _WIN32

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5210 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-07-18 19:21:38 +00:00
parent 30d04c642b
commit 6133677dba
2 changed files with 5 additions and 27 deletions

View file

@ -253,9 +253,7 @@ CEXEBuild::CEXEBuild() :
disable_window_icon=0; disable_window_icon=0;
#ifdef _WIN32
notify_hwnd=0; notify_hwnd=0;
#endif
#ifdef NSIS_SUPPORT_BGBG #ifdef NSIS_SUPPORT_BGBG
bg_default_font.lfHeight=40; bg_default_font.lfHeight=40;
@ -451,12 +449,8 @@ int CEXEBuild::add_string(const char *string, int process/*=1*/, WORD codepage/*
int CEXEBuild::add_intstring(const int i) // returns offset in stringblock int CEXEBuild::add_intstring(const int i) // returns offset in stringblock
{ {
char i_str[128]; char i_str[1024];
#ifdef _WIN32
wsprintf(i_str, "%d", i); wsprintf(i_str, "%d", i);
#else
snprintf(i_str, 128, "%d", i);
#endif
return add_string(i_str); return add_string(i_str);
} }
@ -1151,12 +1145,8 @@ int CEXEBuild::add_section(const char *secname, const char *defname, int expand/
if (defname[0]) if (defname[0])
{ {
char buf[128]; char buf[1024];
#ifdef _WIN32
wsprintf(buf, "%d", cur_header->blocks[NB_SECTIONS].num); wsprintf(buf, "%d", cur_header->blocks[NB_SECTIONS].num);
#else
snprintf(buf, 128, "%d", cur_header->blocks[NB_SECTIONS].num);
#endif
if (definedlist.add(defname, buf)) if (definedlist.add(defname, buf))
{ {
ERROR_MSG("Error: \"%s\" already defined, can't assign section index!\n", defname); ERROR_MSG("Error: \"%s\" already defined, can't assign section index!\n", defname);
@ -2588,11 +2578,7 @@ int CEXEBuild::write_output(void)
{ {
int total_out_size_estimate= int total_out_size_estimate=
m_exehead_size+sizeof(fh)+build_datablock.getlen()+(build_crcchk?sizeof(crc32_t):0); m_exehead_size+sizeof(fh)+build_datablock.getlen()+(build_crcchk?sizeof(crc32_t):0);
#ifdef _WIN32 int pc=(int)(((INT64)db_opt_save*1000)/(db_opt_save+total_out_size_estimate));
int pc=MulDiv(db_opt_save,1000,db_opt_save+total_out_size_estimate);
#else
int pc=(int)(((long long)db_opt_save*1000)/(db_opt_save+total_out_size_estimate));
#endif
INFO_MSG("Datablock optimizer saved %d bytes (~%d.%d%%).\n",db_opt_save, INFO_MSG("Datablock optimizer saved %d bytes (~%d.%d%%).\n",db_opt_save,
pc/10,pc%10); pc/10,pc%10);
} }
@ -3118,11 +3104,7 @@ void CEXEBuild::warning_fl(const char *s, ...)
void CEXEBuild::ERROR_MSG(const char *s, ...) const void CEXEBuild::ERROR_MSG(const char *s, ...) const
{ {
#ifdef _WIN32
if (display_errors || notify_hwnd) if (display_errors || notify_hwnd)
#else
if (display_errors)
#endif
{ {
char buf[NSIS_MAX_STRLEN*10]; char buf[NSIS_MAX_STRLEN*10];
va_list val; va_list val;
@ -3181,16 +3163,16 @@ void CEXEBuild::print_warnings()
fflush(g_output); fflush(g_output);
} }
#ifdef _WIN32
void CEXEBuild::notify(notify_e code, const char *data) const void CEXEBuild::notify(notify_e code, const char *data) const
{ {
#ifdef _WIN32
if (notify_hwnd) if (notify_hwnd)
{ {
COPYDATASTRUCT cds = {(DWORD)code, strlen(data)+1, (void *) data}; COPYDATASTRUCT cds = {(DWORD)code, strlen(data)+1, (void *) data};
SendMessage(notify_hwnd, WM_COPYDATA, 0, (LPARAM)&cds); SendMessage(notify_hwnd, WM_COPYDATA, 0, (LPARAM)&cds);
} }
}
#endif #endif
}
// Added by Ximon Eighteen 5th August 2002 // Added by Ximon Eighteen 5th August 2002
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT #ifdef NSIS_CONFIG_PLUGIN_SUPPORT

View file

@ -123,12 +123,8 @@ class CEXEBuild {
char *curfilename; char *curfilename;
FILE *fp; FILE *fp;
#ifdef _WIN32
HWND notify_hwnd; HWND notify_hwnd;
void notify(notify_e code, const char *data) const; void notify(notify_e code, const char *data) const;
#else
void notify(notify_e code, const char *data) const { }
#endif
private: private:
int check_write_output_errors() const; int check_write_output_errors() const;