removed private atoi implementations
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5837 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f3350670fb
commit
5b490c9e49
4 changed files with 4 additions and 131 deletions
|
@ -169,8 +169,6 @@ void CALLBACK TimeProc(UINT uID,
|
|||
timeleft--;
|
||||
}
|
||||
|
||||
int myatoi(char *s);
|
||||
|
||||
void __declspec(dllexport) show(HWND hwndParent, int string_size,
|
||||
char *variables, stack_t ** stacktop)
|
||||
{
|
||||
|
@ -288,51 +286,3 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size,
|
|||
wsprintf(temp, "%d", g_rv);
|
||||
pushstring(temp);
|
||||
}
|
||||
|
||||
int myatoi(char *s)
|
||||
{
|
||||
unsigned int v = 0;
|
||||
if (*s == '0' && (s[1] == 'x' || s[1] == 'X')) {
|
||||
s += 2;
|
||||
for (;;) {
|
||||
int c = *s++;
|
||||
if (c >= '0' && c <= '9')
|
||||
c -= '0';
|
||||
else if (c >= 'a' && c <= 'f')
|
||||
c -= 'a' - 10;
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
c -= 'A' - 10;
|
||||
else
|
||||
break;
|
||||
v <<= 4;
|
||||
v += c;
|
||||
}
|
||||
} else if (*s == '0' && s[1] <= '7' && s[1] >= '0') {
|
||||
s++;
|
||||
for (;;) {
|
||||
int c = *s++;
|
||||
if (c >= '0' && c <= '7')
|
||||
c -= '0';
|
||||
else
|
||||
break;
|
||||
v <<= 3;
|
||||
v += c;
|
||||
}
|
||||
} else {
|
||||
int sign = 0;
|
||||
if (*s == '-') {
|
||||
s++;
|
||||
sign++;
|
||||
}
|
||||
for (;;) {
|
||||
int c = *s++ - '0';
|
||||
if (c < 0 || c > 9)
|
||||
break;
|
||||
v *= 10;
|
||||
v += c;
|
||||
}
|
||||
if (sign)
|
||||
return -(int) v;
|
||||
}
|
||||
return (int) v;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ BOOL bFailed;
|
|||
|
||||
char buf[1024];
|
||||
|
||||
unsigned int myatoi(char *s);
|
||||
|
||||
BOOL CALLBACK BannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uMsg == WM_INITDIALOG)
|
||||
|
@ -32,7 +30,7 @@ BOOL CALLBACK BannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
unsigned int id;
|
||||
popstring(buf);
|
||||
id = myatoi(buf);
|
||||
id = myatou(buf);
|
||||
popstring(buf);
|
||||
SetDlgItemText(hwndDlg, id, buf);
|
||||
popstring(buf);
|
||||
|
@ -167,18 +165,3 @@ BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
unsigned int myatoi(char *s)
|
||||
{
|
||||
unsigned int v=0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
unsigned int c=*s++;
|
||||
if (c >= '0' && c <= '9') c-='0';
|
||||
else break;
|
||||
v*=10;
|
||||
v+=c;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ unsigned int uWndWidth, uWndHeight;
|
|||
void *oldProc;
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
HBITMAP __stdcall LoadBitmapFile(long right, long bottom, BITMAP *bBitmap);
|
||||
int __stdcall myatoi(char *s);
|
||||
COLORREF GetColor();
|
||||
void __stdcall GetXY(LPPOINT lpPoint);
|
||||
|
||||
|
@ -594,51 +593,6 @@ void __stdcall GetXY(LPPOINT lpPoint) {
|
|||
lpPoint->y = (unsigned int)iPosTemp;
|
||||
}
|
||||
|
||||
int __stdcall myatoi(char *s)
|
||||
{
|
||||
unsigned int v=0;
|
||||
if (*s == '0' && (s[1] == 'x' || s[1] == 'X'))
|
||||
{
|
||||
s+=2;
|
||||
for (;;)
|
||||
{
|
||||
int c=*s++;
|
||||
if (c >= '0' && c <= '9') c-='0';
|
||||
else if (c >= 'a' && c <= 'f') c-='a'-10;
|
||||
else if (c >= 'A' && c <= 'F') c-='A'-10;
|
||||
else break;
|
||||
v<<=4;
|
||||
v+=c;
|
||||
}
|
||||
}
|
||||
else if (*s == '0' && s[1] <= '7' && s[1] >= '0')
|
||||
{
|
||||
s++;
|
||||
for (;;)
|
||||
{
|
||||
int c=*s++;
|
||||
if (c >= '0' && c <= '7') c-='0';
|
||||
else break;
|
||||
v<<=3;
|
||||
v+=c;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int sign=0;
|
||||
if (*s == '-') { s++; sign++; }
|
||||
for (;;)
|
||||
{
|
||||
int c=*s++ - '0';
|
||||
if (c < 0 || c > 9) break;
|
||||
v*=10;
|
||||
v+=c;
|
||||
}
|
||||
if (sign) return -(int) v;
|
||||
}
|
||||
return (int)v;
|
||||
}
|
||||
|
||||
extern "C" BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
||||
g_hInstance=hInst;
|
||||
switch (ul_reason_for_call) {
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
#include <plugin.h> // nsis plugin.h
|
||||
|
||||
int myatoi(char *s);
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
HWND g_hwndParent;
|
||||
|
||||
|
@ -61,7 +59,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
SendDlgItemMessage(hwndDlg, IDC_APPICON, STM_SETICON, (LPARAM)LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(103)), 0);
|
||||
// set font
|
||||
if (dofont && !popstring(temp)) {
|
||||
size = myatoi(temp);
|
||||
size = myatou(temp);
|
||||
if (!popstring(temp)) {
|
||||
LOGFONT f = {0,};
|
||||
if (lstrcmp(temp, "MS Shell Dlg")) {
|
||||
|
@ -159,7 +157,7 @@ void __declspec(dllexport) LangDialog(HWND hwndParent, int string_size,
|
|||
pop_empty_string = TRUE;
|
||||
} else {
|
||||
// use counts languages
|
||||
langs_num = myatoi(temp);
|
||||
langs_num = myatou(temp);
|
||||
}
|
||||
|
||||
// zero languages?
|
||||
|
@ -187,7 +185,7 @@ void __declspec(dllexport) LangDialog(HWND hwndParent, int string_size,
|
|||
if (docp)
|
||||
{
|
||||
if (popstring(temp)) { visible_langs_num = 0; break; }
|
||||
langs[visible_langs_num].cp = myatoi(temp);
|
||||
langs[visible_langs_num].cp = myatou(temp);
|
||||
}
|
||||
|
||||
if (!docp || langs[visible_langs_num].cp == GetACP() || langs[visible_langs_num].cp == 0)
|
||||
|
@ -236,15 +234,3 @@ BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
|||
g_hInstance=hInst;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int myatoi(char *s)
|
||||
{
|
||||
unsigned int v=0;
|
||||
for (;;) {
|
||||
int c=*s++ - '0';
|
||||
if (c < 0 || c > 9) break;
|
||||
v*=10;
|
||||
v+=c;
|
||||
}
|
||||
return (int)v;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue