diff options
Diffstat (limited to 'plugins/Variables/src/parse_inet.cpp')
-rw-r--r-- | plugins/Variables/src/parse_inet.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index 0bc8ca2ed9..95c94aba7d 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -21,21 +21,18 @@ #include <wininet.h>
static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) {
-
- TCHAR *tres;
- char hex[8], *res;
- unsigned int cur;
+ char hex[8];
if (ai->argc != 2) {
return NULL;
}
- res = mir_t2a(ai->targv[1]);
+ char *res = mir_t2a(ai->targv[1]);
if (res == NULL) {
return NULL;
}
- cur = 0;
+ unsigned int cur = 0;
while (cur < strlen(res)) {
if (( (*(res+cur) >= '0') && (*(res+cur) <= '9')) || ( (*(res+cur) >= 'a') && (*(res+cur) <= 'z')) || ( (*(res+cur) >= 'A') && (*(res+cur) <= 'Z')) ) {
cur++;
@@ -51,7 +48,7 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) { cur+=strlen(hex);
}
- tres = mir_a2t(res);
+ TCHAR *tres = mir_a2t(res);
mir_free(res);
@@ -59,21 +56,18 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) { }
static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) {
-
- char *res, hex[8];
- TCHAR *tres;
- unsigned int cur;
+ char hex[8];
if (ai->argc != 2) {
return NULL;
}
- res = mir_t2a(ai->targv[1]);
+ char *res = mir_t2a(ai->targv[1]);
if (res == NULL) {
return NULL;
}
- cur = 0;
+ unsigned int cur = 0;
while (cur < strlen(res)) {
if ((*(res+cur) == '%') && (strlen(res+cur) >= 3)) {
memset(hex, '\0', sizeof(hex));
@@ -85,7 +79,7 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) { }
res = ( char* )mir_realloc(res, strlen(res)+1);
- tres = mir_a2t(res);
+ TCHAR *tres = mir_a2t(res);
mir_free(res);
@@ -93,8 +87,6 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) { }
static TCHAR *parseNToA(ARGUMENTSINFO *ai) {
-
- char *res;
struct in_addr in;
if (ai->argc != 2) {
@@ -102,7 +94,7 @@ static TCHAR *parseNToA(ARGUMENTSINFO *ai) { }
in.s_addr = ttoi(ai->targv[1]);
- res = inet_ntoa(in);
+ char *res = inet_ntoa(in);
if (res != NULL) {
return mir_a2t(res);
@@ -113,8 +105,6 @@ static TCHAR *parseNToA(ARGUMENTSINFO *ai) { }
static TCHAR *parseHToA(ARGUMENTSINFO *ai) {
-
- char *res;
struct in_addr in;
if (ai->argc != 2) {
@@ -122,7 +112,7 @@ static TCHAR *parseHToA(ARGUMENTSINFO *ai) { }
in.s_addr = htonl(ttoi(ai->targv[1]));
- res = inet_ntoa(in);
+ char *res = inet_ntoa(in);
if (res != NULL) {
return mir_a2t(res);
@@ -134,10 +124,10 @@ static TCHAR *parseHToA(ARGUMENTSINFO *ai) { int registerInetTokens() {
- registerIntToken(_T(URLENC), parseUrlEnc, TRF_FUNCTION, Translate("Internet Related\t(x)\tconverts each non-html character into hex format"));
- registerIntToken(_T(URLDEC), parseUrlDec, TRF_FUNCTION, Translate("Internet Related\t(x)\tconverts each hex value into non-html character"));
- registerIntToken(_T(NTOA), parseNToA, TRF_FUNCTION, Translate("Internet Related\t(x)\tconverts a 32-bit number to IPv4 dotted notation"));
- registerIntToken(_T(HTOA), parseHToA, TRF_FUNCTION, Translate("Internet Related\t(x)\tconverts a 32-bit number (in host byte order) to IPv4 dotted notation"));
+ registerIntToken(_T(URLENC), parseUrlEnc, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts each non-html character into hex format"));
+ registerIntToken(_T(URLDEC), parseUrlDec, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts each hex value into non-html character"));
+ registerIntToken(_T(NTOA), parseNToA, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts a 32-bit number to IPv4 dotted notation"));
+ registerIntToken(_T(HTOA), parseHToA, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts a 32-bit number (in host byte order) to IPv4 dotted notation"));
return 0;
}
|