From f3350670fb94f707196f7eb174e1a0f0c4745c6c Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 12 Dec 2008 17:45:03 +0000 Subject: [PATCH] simpler atoi for LangDLL and Banner git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5836 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/ExDLL/plugin.c | 15 +++++++++++++++ Contrib/ExDLL/plugin.h | 1 + 2 files changed, 16 insertions(+) diff --git a/Contrib/ExDLL/plugin.c b/Contrib/ExDLL/plugin.c index 24b9e3fe..0a55af19 100644 --- a/Contrib/ExDLL/plugin.c +++ b/Contrib/ExDLL/plugin.c @@ -99,6 +99,21 @@ int NSISCALL myatoi(const char *s) return v; } +unsigned NSISCALL myatou(const 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; +} + int NSISCALL myatoi_or(const char *s) { int v=0; diff --git a/Contrib/ExDLL/plugin.h b/Contrib/ExDLL/plugin.h index 29e1ab84..63b8b846 100644 --- a/Contrib/ExDLL/plugin.h +++ b/Contrib/ExDLL/plugin.h @@ -60,6 +60,7 @@ int NSISCALL popstringn(char *str, int maxlen); // with length limit, pass 0 for int NSISCALL popint(); // pops an integer int NSISCALL popint_or(); // with support for or'ing (2|4|8) int NSISCALL myatoi(const char *s); // converts a string to an integer +unsigned NSISCALL myatou(const char *s); // converts a string to an unsigned integer, decimal only int NSISCALL myatoi_or(const char *s); // with support for or'ing (2|4|8) void NSISCALL pushstring(const char *str); void NSISCALL pushint(int value);