diff options
Diffstat (limited to 'plugins/Variables')
34 files changed, 688 insertions, 1474 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index a0188f964c..65c924a4c3 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
@@ -26,7 +26,7 @@ struct _tagType }
static builtinCnfs[] =
{
- { CNF_FIRSTNAME, STR_FIRSTNAME },
+ { CNF_FIRSTNAME, STR_FIRSTNAME },
{ CNF_LASTNAME, STR_LASTNAME },
{ CNF_NICK, STR_NICK },
{ CNF_CUSTOMNICK, STR_CUSTOMNICK },
@@ -79,7 +79,7 @@ struct CONTACTCE DWORD flags;
wchar_t* tszContact;
MCONTACT hContact;
-};
+};
static int SortContactCache(const CONTACTCE *p1, const CONTACTCE *p2)
{
@@ -222,7 +222,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
-
+
// nick (not exact)
if ((dwFlags & CI_NICK) && !bMatch) {
ptrW szFind(getContactInfoT(CNF_NICK, hContact));
@@ -243,7 +243,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
-
+
// lastname (exact)
if ((dwFlags & CI_LASTNAME) && !bMatch) {
ptrW szFind(getContactInfoT(CNF_LASTNAME, hContact));
@@ -322,15 +322,14 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam) for (auto &it : arContactCache) {
if (hContact != it->hContact && (it->flags & CI_CNFINFO) == 0)
continue;
-
+
if ((isNick && (it->flags & CI_NICK)) ||
(isFirstName && (it->flags & CI_FIRSTNAME)) ||
(isLastName && (it->flags & CI_LASTNAME)) ||
(isEmail && (it->flags & CI_EMAIL)) ||
(isMyHandle && (it->flags & CI_LISTNAME)) ||
(it->flags & CI_CNFINFO) != 0 || // lazy; always invalidate CNF info cache entries
- (isUid && (it->flags & CI_UNIQUEID)))
- {
+ (isUid && (it->flags & CI_UNIQUEID))) {
/* remove from cache */
mir_free(it->tszContact);
arContactCache.remove(arContactCache.indexOf(&it));
diff --git a/plugins/Variables/src/contact.h b/plugins/Variables/src/contact.h index dc83dd73cb..f8d04de21d 100644 --- a/plugins/Variables/src/contact.h +++ b/plugins/Variables/src/contact.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
@@ -59,7 +59,7 @@ #define STR_COHOMEPAGE L"cohomepage"
#define STR_ACCOUNT L"account"
-#define STR_PROTOCOL L"protocol"
+#define STR_PROTOCOL L"protocol"
#define STR_STATUS L"status"
#define STR_INTERNALIP L"intip"
#define STR_EXTERNALIP L"extip"
@@ -69,12 +69,12 @@ #define CCNF_ACCOUNT 51 // CUSTOM, returns contact's account name (0.8.0+)
#define CCNF_PROTOCOL 50 // CUSTOM, returns the contact's protocol (human-readable)
#define CCNF_STATUS 49 // CUSTOM, returns status mode description
-#define CCNF_INTERNALIP 48 // CUSTOM, returns the contact's internal IP
-#define CCNF_EXTERNALIP 47 // CUSTOM, returns the contact's external IP
+#define CCNF_INTERNALIP 48 // CUSTOM, returns the contact's internal IP
+#define CCNF_EXTERNALIP 47 // CUSTOM, returns the contact's external IP
#define CCNF_GROUP 46 // CUSTOM, returns group name
#define CCNF_PROTOID 45 // CUSTOM, returns protocol ID instead of name
-#define PROTOID_HANDLE "_HANDLE_"
+#define PROTOID_HANDLE "_HANDLE_"
// Possible flags:
#define CI_PROTOID 0x00000001 // The contact in the string is encoded
@@ -91,11 +91,11 @@ // (contact details).
#define CI_UNIQUEID 0x00000040 // Search unique ids of the contac, e.g.
// UIN.
-#define CI_ALLFLAGS 0x7FFFFFFF // All possible combinations of previous flags
+#define CI_ALLFLAGS 0x7FFFFFFF // All possible combinations of previous flags
-#define CI_CNFINFO 0x40000000 // Searches one of the CNF_* flags (set
+#define CI_CNFINFO 0x40000000 // Searches one of the CNF_* flags (set
// flags to CI_CNFINFO|CNF_X), only one
// CNF_ type possible
#define CI_NEEDCOUNT 0x80000000 // returns contacts count
-wchar_t *encodeContactToString(MCONTACT hContact);
+wchar_t* encodeContactToString(MCONTACT hContact);
diff --git a/plugins/Variables/src/dbhelpers.h b/plugins/Variables/src/dbhelpers.h deleted file mode 100644 index 4949022c8a..0000000000 --- a/plugins/Variables/src/dbhelpers.h +++ /dev/null @@ -1,122 +0,0 @@ -/*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#pragma once
-
-#ifndef PREFIX_ITH
-#define PREFIX_ITH ""
-#endif
-
-// database helpers
-static int __inline DBWriteIthSettingByte(DWORD i, MCONTACT hContact,const char *szModule,const char *szSetting,BYTE val) {
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_set_b(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteIthSettingWord(DWORD i, MCONTACT hContact,const char *szModule,const char *szSetting,WORD val) {
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_set_w(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteIthSettingDword(DWORD i, MCONTACT hContact,const char *szModule,const char *szSetting,DWORD val) {
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_set_dw(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteIthSettingString(DWORD i, MCONTACT hContact,const char *szModule,const char *szSetting,const char *val) {
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_set_s(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBGetIthSettingByte(DWORD i, MCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_get_b(hContact, szModule, dbSetting, errorValue);
-}
-
-static WORD __inline DBGetIthSettingWord(DWORD i, MCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_get_w(hContact, szModule, dbSetting, errorValue);
-}
-
-static DWORD __inline DBGetIthSettingDword(DWORD i, MCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) {
-
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_get_dw(hContact, szModule, dbSetting, errorValue);
-}
-
-static int __inline DBGetIthSetting(DWORD i, MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
-
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_get(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBDeleteIthSetting(DWORD i, MCONTACT hContact,const char *szModule,const char *szSetting) {
-
- char dbSetting[128];
-
- mir_snprintf(dbSetting, "%s%u_%s", PREFIX_ITH, i, szSetting);
- return db_unset(hContact, szModule, dbSetting);
-}
-
-#define db_getb(a,b) db_get_b(NULL, MODULENAME, a, b)
-#define db_getw(a,b) db_get_w(NULL, MODULENAME, a, b)
-#define db_getd(a,b) db_get_dw(NULL, MODULENAME, a, b)
-#define db_gets(a,b) db_get(NULL, MODULENAME, a, b)
-#define db_setb(a,b) db_set_b(NULL, MODULENAME, a, (BYTE)(b))
-#define db_sets(a,b) db_set_s(NULL, MODULENAME, a, b)
-#define db_setts(a,b) db_set_ws(NULL, MODULENAME, a, b)
-#define db_setw(a,b) db_set_w(NULL, MODULENAME, a, (WORD)(b))
-#define db_setd(a,b) db_set_dw(NULL, MODULENAME, a, (DWORD)(b))
-#define db_del(a) db_unset(NULL, MODULENAME, a);
-
-#define dbi_getb(a,b,c) DBGetIthSettingByte(a, NULL, MODULENAME, b, c)
-#define dbi_getw(a,b,c) DBGetIthSettingWord(a, NULL, MODULENAME, b, c)
-#define dbi_getd(a,b,c) DBGetIthSettingDword(a, NULL, MODULENAME, b, c)
-#define dbi_gets(a,b,c) DBGetIthSetting(a, NULL, MODULENAME, b, c)
-#define dbi_setb(a,b,c) DBWriteIthSettingByte(a, NULL, MODULENAME, b, (BYTE)(c))
-#define dbi_sets(a,b,c) DBWriteIthSettingString(a, NULL, MODULENAME, b, c)
-#define dbi_setw(a,b,c) DBWriteIthSettingWord(a, NULL, MODULENAME, b, (WORD)(c))
-#define dbi_setd(a,b,c) DBWriteIthSettingDword(a, NULL, MODULENAME, b, (DWORD)(c))
-#define dbi_del(a,b) DBDeleteIthSetting(a, NULL, MODULENAME, b);
diff --git a/plugins/Variables/src/enumprocs.cpp b/plugins/Variables/src/enumprocs.cpp index be34fab55f..ebe665c817 100644 --- a/plugins/Variables/src/enumprocs.cpp +++ b/plugins/Variables/src/enumprocs.cpp @@ -1,34 +1,31 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// This file has been copied from msdn.microsoft.com
-//
-// EnumProc.c
-//
#include "stdafx.h"
-typedef struct {
+struct EnumInfoStruct
+{
DWORD dwPID;
PROCENUMPROC lpProc;
DWORD lParam;
BOOL bEnd;
-} EnumInfoStruct;
+};
// The EnumProcs function takes a pointer to a callback function
// that will be called once per process with the process filename
@@ -68,11 +65,11 @@ BOOL WINAPI EnumProcs(PROCENUMPROC lpProc, LPARAM lParam) procentry.dwSize = sizeof(PROCESSENTRY32);
bFlag = Process32Next(hSnapShot, &procentry);
- } else
- bFlag = FALSE;
+ }
+ else bFlag = FALSE;
}
- } else
- return FALSE;
+ }
+ else return FALSE;
return TRUE;
-}
\ No newline at end of file +}
diff --git a/plugins/Variables/src/enumprocs.h b/plugins/Variables/src/enumprocs.h index 7602fe8186..61c4ea717e 100644 --- a/plugins/Variables/src/enumprocs.h +++ b/plugins/Variables/src/enumprocs.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index 4b05a3476a..582b8d8da0 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -1,20 +1,20 @@ /* - Variables Plugin for Miranda-IM (www.miranda-im.org) - Copyright 2003-2006 P. Boon - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Variables Plugin for Miranda-IM (www.miranda-im.org) + Copyright 2003-2006 P. Boon + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdafx.h" @@ -212,7 +212,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } // dialog box for the tokens -static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) { +static wchar_t* getTokenCategory(TOKENREGISTEREX *tr) { if (tr == nullptr) { return nullptr; } @@ -239,7 +239,7 @@ static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) { } -static wchar_t *getHelpDescription(TOKENREGISTEREX *tr) +static wchar_t* getHelpDescription(TOKENREGISTEREX *tr) { if (tr == nullptr) return nullptr; @@ -261,7 +261,7 @@ static wchar_t *getHelpDescription(TOKENREGISTEREX *tr) } -static wchar_t *getTokenDescription(TOKENREGISTEREX *tr) +static wchar_t* getTokenDescription(TOKENREGISTEREX *tr) { if (tr == nullptr) return nullptr; diff --git a/plugins/Variables/src/lookup3.cpp b/plugins/Variables/src/lookup3.cpp deleted file mode 100644 index ecc39f1352..0000000000 --- a/plugins/Variables/src/lookup3.cpp +++ /dev/null @@ -1,637 +0,0 @@ -/*
--------------------------------------------------------------------------------
-lookup3.c, by Bob Jenkins, May 2006, Public Domain.
-These are functions for producing 32-bit hashes for hash table lookup.
-hashword(), hashlittle(), hashbig(), mix(), and final() are externally
-useful functions. Routines to test the hash are included if SELF_TEST
-is defined. You can use this mir_free for any purpose. It has no warranty.
-
-You probably want to use hashlittle(). hashlittle() and hashbig()
-hash byte arrays. hashlittle() is is faster than hashbig() on
-little-endian machines. Intel and AMD are little-endian machines.
-
-If you want to find a hash of, say, exactly 7 integers, do
- a = i1; b = i2; c = i3;
- mix(a,b,c);
- a += i4; b += i5; c += i6;
- mix(a,b,c);
- a += i7;
- final(a,b,c);
-then use c as the hash value. If you have a variable length array of
-4-byte integers to hash, use hashword(). If you have a byte array (like
-a character string), use hashlittle(). If you have several byte arrays, or
-a mix of things, see the comments above hashlittle().
--------------------------------------------------------------------------------
-*/
-//#define SELF_TEST 1
-
-#include "stdafx.h"
-
-typedef unsigned long int uint32; /* unsigned 4-byte quantities */
-typedef unsigned short int uint16; /* unsigned 2-byte quantities */
-typedef unsigned char uint8; /* unsigned 1-byte quantities */
-
-/*
- * My best guess at if you are big-endian or little-endian. This may
- * need adjustment.
- */
-#if defined(i386) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL)
-# define HASH_LITTLE_ENDIAN 1
-# define HASH_BIG_ENDIAN 0
-#elif defined(sparc)
-# define HASH_LITTLE_ENDIAN 0
-# define HASH_BIG_ENDIAN 1
-#else
-# define HASH_LITTLE_ENDIAN 0
-# define HASH_BIG_ENDIAN 0
-#endif
-
-#define hashsize(n) ((uint32)1<<(n))
-#define hashmask(n) (hashsize(n)-1)
-#define rot(x,k) (((x)<<(k)) ^ ((x)>>(32-(k))))
-
-/*
--------------------------------------------------------------------------------
-mix -- mix 3 32-bit values reversibly.
-
-This is reversible, so any information in (a,b,c) before mix() is
-still in (a,b,c) after mix().
-
-If four pairs of (a,b,c) inputs are run through mix(), or through
-mix() in reverse, there are at least 32 bits of the output that
-are sometimes the same for one pair and different for another pair.
-This was tested for:
-* pairs that differed by one bit, by two bits, in any combination
- of top bits of (a,b,c), or in any combination of bottom bits of
- (a,b,c).
-* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
- the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
- is commonly produced by subtraction) look like a single 1-bit
- difference.
-* the base values were pseudorandom, all zero but one bit set, or
- all zero plus a counter that starts at zero.
-
-Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
-satisfy this are
- 4 6 8 16 19 4
- 9 15 3 18 27 15
- 14 9 3 7 17 3
-Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
-for "differ" defined as + with a one-bit base and a two-bit delta. I
-used http://burtleburtle.net/bob/hash/avalanche.html to choose
-the operations, constants, and arrangements of the variables.
-
-This does not achieve avalanche. There are input bits of (a,b,c)
-that fail to affect some output bits of (a,b,c), especially of a. The
-most thoroughly mixed value is c, but it doesn't really even achieve
-avalanche in c.
-
-This allows some parallelism. Read-after-writes are good at doubling
-the number of bits affected, so the goal of mixing pulls in the opposite
-direction as the goal of parallelism. I did what I could. Rotates
-seem to cost as much as shifts on every machine I could lay my hands
-on, and rotates are much kinder to the top and bottom bits, so I used
-rotates.
--------------------------------------------------------------------------------
-*/
-#define mix(a,b,c) \
-{ \
- a -= c; a ^= rot(c, 4); c += b; \
- b -= a; b ^= rot(a, 6); a += c; \
- c -= b; c ^= rot(b, 8); b += a; \
- a -= c; a ^= rot(c,16); c += b; \
- b -= a; b ^= rot(a,19); a += c; \
- c -= b; c ^= rot(b, 4); b += a; \
-}
-
-/*
--------------------------------------------------------------------------------
-final -- final mixing of 3 32-bit values (a,b,c) into c
-
-Pairs of (a,b,c) values differing in only a few bits will usually
-produce values of c that look totally different. This was tested for
-* pairs that differed by one bit, by two bits, in any combination
- of top bits of (a,b,c), or in any combination of bottom bits of
- (a,b,c).
-* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
- the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
- is commonly produced by subtraction) look like a single 1-bit
- difference.
-* the base values were pseudorandom, all zero but one bit set, or
- all zero plus a counter that starts at zero.
-
-These constants passed:
- 14 11 25 16 4 14 24
- 12 14 25 16 4 14 24
-and these came close:
- 4 8 15 26 3 22 24
- 10 8 15 26 3 22 24
- 11 8 15 26 3 22 24
--------------------------------------------------------------------------------
-*/
-#define final(a,b,c) \
-{ \
- c ^= b; c -= rot(b,14); \
- a ^= c; a -= rot(c,11); \
- b ^= a; b -= rot(a,25); \
- c ^= b; c -= rot(b,16); \
- a ^= c; a -= rot(c,4); \
- b ^= a; b -= rot(a,14); \
- c ^= b; c -= rot(b,24); \
-}
-
-/*
---------------------------------------------------------------------
- This works on all machines. To be useful, it requires
- -- that the key be an array of uint32's, and
- -- that all your machines have the same endianness, and
- -- that the length be the number of uint32's in the key
-
- The function hashword() is identical to hashlittle() on little-endian
- machines, and identical to hashbig() on big-endian machines,
- except that the length has to be measured in uint32s rather than in
- bytes. hashlittle() is more complicated than hashword() only because
- hashlittle() has to dance around fitting the key bytes into registers.
---------------------------------------------------------------------
-*/
-uint32 hashword( uint32 *k, size_t length, uint32 initval)
-{
- uint32 a,b,c;
-
- /* Set up the internal state */
- a = b = c = 0xdeadbeef + (((uint32)length)<<2) + initval;
-
- /*------------------------------------------------- handle most of the key */
- while (length > 3)
- {
- a += k[0];
- b += k[1];
- c += k[2];
- mix(a,b,c);
- length -= 3;
- k += 3;
- }
-
- /*--------------------------------------------- handle the last 3 uint32's */
- switch(length) /* all the case statements fall through */
- {
- case 3 : c+=k[2];
- case 2 : b+=k[1];
- case 1 : a+=k[0];
- final(a,b,c);
- case 0: /* case 0: nothing left to add */
- break;
- }
- /*------------------------------------------------------ report the result */
- return c;
-}
-
-
-/*
--------------------------------------------------------------------------------
-hashlittle() -- hash a variable-length key into a 32-bit value
- k : the key (the unaligned variable-length array of bytes)
- length : the length of the key, counting by bytes
- initval : can be any 4-byte value
-Returns a 32-bit value. Every bit of the key affects every bit of
-the return value. Two keys differing by one or two bits will have
-totally different hash values.
-
-The best hash table sizes are powers of 2. There is no need to do
-mod a prime (mod is sooo slow!). If you need less than 32 bits,
-use a bitmask. For example, if you need only 10 bits, do
- h = (h & hashmask(10));
-In which case, the hash table should have hashsize(10) elements.
-
-If you are hashing n strings (uint8 **)k, do it like this:
- for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
-
-By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this
-code any way you wish, private, educational, or commercial. It's mir_free.
-
-Use for hash table lookup, or anything where one collision in 2^^32 is
-acceptable. Do NOT use for cryptographic purposes.
--------------------------------------------------------------------------------
-*/
-
-uint32 hashlittle( void *key, size_t length, uint32 initval)
-{
- uint32 a,b,c;
-
- /* Set up the internal state */
- a = b = c = 0xdeadbeef + ((uint32)length) + initval;
-
- if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x3)) {
- uint32 *k = ( uint32 *)key; /* read 32-bit chunks */
-
- /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
- while (length > 12)
- {
- a += k[0];
- b += k[1];
- c += k[2];
- mix(a,b,c);
- length -= 12;
- k += 3;
- }
-
- /*----------------------------- handle the last (probably partial) block */
- switch(length)
- {
- case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
- case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break;
- case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break;
- case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break;
- case 8 : b+=k[1]; a+=k[0]; break;
- case 7 : b+=k[1]&0xffffff; a+=k[0]; break;
- case 6 : b+=k[1]&0xffff; a+=k[0]; break;
- case 5 : b+=k[1]&0xff; a+=k[0]; break;
- case 4 : a+=k[0]; break;
- case 3 : a+=k[0]&0xffffff; break;
- case 2 : a+=k[0]&0xffff; break;
- case 1 : a+=k[0]&0xff; break;
- case 0 : return c; /* zero length strings require no mixing */
- }
-
- } else if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x1)) {
- uint16 *k = (uint16 *)key; /* read 16-bit chunks */
-
- /*--------------- all but last block: aligned reads and different mixing */
- while (length > 12)
- {
- a += k[0] + (((uint32)k[1])<<16);
- b += k[2] + (((uint32)k[3])<<16);
- c += k[4] + (((uint32)k[5])<<16);
- mix(a,b,c);
- length -= 12;
- k += 6;
- }
-
- /*----------------------------- handle the last (probably partial) block */
- switch(length)
- {
- case 12: c+=k[4]+(((uint32)k[5])<<16);
- b+=k[2]+(((uint32)k[3])<<16);
- a+=k[0]+(((uint32)k[1])<<16);
- break;
- case 11: c+=((uint32)(k[5]&0xff))<<16;/* fall through */
- case 10: c+=k[4];
- b+=k[2]+(((uint32)k[3])<<16);
- a+=k[0]+(((uint32)k[1])<<16);
- break;
- case 9 : c+=k[4]&0xff; /* fall through */
- case 8 : b+=k[2]+(((uint32)k[3])<<16);
- a+=k[0]+(((uint32)k[1])<<16);
- break;
- case 7 : b+=((uint32)(k[3]&0xff))<<16;/* fall through */
- case 6 : b+=k[2];
- a+=k[0]+(((uint32)k[1])<<16);
- break;
- case 5 : b+=k[2]&0xff; /* fall through */
- case 4 : a+=k[0]+(((uint32)k[1])<<16);
- break;
- case 3 : a+=((uint32)(k[1]&0xff))<<16;/* fall through */
- case 2 : a+=k[0];
- break;
- case 1 : a+=k[0]&0xff;
- break;
- case 0 : return c; /* zero length requires no mixing */
- }
-
- } else { /* need to read the key one byte at a time */
- uint8 *k = (uint8 *)key;
-
- /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
- while (length > 12)
- {
- a += k[0];
- a += ((uint32)k[1])<<8;
- a += ((uint32)k[2])<<16;
- a += ((uint32)k[3])<<24;
- b += k[4];
- b += ((uint32)k[5])<<8;
- b += ((uint32)k[6])<<16;
- b += ((uint32)k[7])<<24;
- c += k[8];
- c += ((uint32)k[9])<<8;
- c += ((uint32)k[10])<<16;
- c += ((uint32)k[11])<<24;
- mix(a,b,c);
- length -= 12;
- k += 12;
- }
-
- /*-------------------------------- last block: affect all 32 bits of (c) */
- switch(length) /* all the case statements fall through */
- {
- case 12: c+=((uint32)k[11])<<24;
- case 11: c+=((uint32)k[10])<<16;
- case 10: c+=((uint32)k[9])<<8;
- case 9 : c+=k[8];
- case 8 : b+=((uint32)k[7])<<24;
- case 7 : b+=((uint32)k[6])<<16;
- case 6 : b+=((uint32)k[5])<<8;
- case 5 : b+=k[4];
- case 4 : a+=((uint32)k[3])<<24;
- case 3 : a+=((uint32)k[2])<<16;
- case 2 : a+=((uint32)k[1])<<8;
- case 1 : a+=k[0];
- break;
- case 0 : return c;
- }
- }
-
- final(a,b,c);
- return c;
-}
-
-
-
-/*
- * hashbig():
- * This is the same as hashword() on big-endian machines. It is different
- * from hashlittle() on all machines. hashbig() takes advantage of
- * big-endian byte ordering.
- */
-uint32 hashbig( void *key, size_t length, uint32 initval)
-{
- uint32 a,b,c;
-
- /* Set up the internal state */
- a = b = c = 0xdeadbeef + ((uint32)length) + initval;
-
- if (HASH_BIG_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x3)) {
- uint32 *k = (uint32 *)key; /* read 32-bit chunks */
-
- /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
- while (length > 12)
- {
- a += k[0];
- b += k[1];
- c += k[2];
- mix(a,b,c);
- length -= 12;
- k += 3;
- }
-
- /*----------------------------- handle the last (probably partial) block */
- switch(length)
- {
- case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
- case 11: c+=k[2]<<8; b+=k[1]; a+=k[0]; break;
- case 10: c+=k[2]<<16; b+=k[1]; a+=k[0]; break;
- case 9 : c+=k[2]<<24; b+=k[1]; a+=k[0]; break;
- case 8 : b+=k[1]; a+=k[0]; break;
- case 7 : b+=k[1]<<8; a+=k[0]; break;
- case 6 : b+=k[1]<<16; a+=k[0]; break;
- case 5 : b+=k[1]<<24; a+=k[0]; break;
- case 4 : a+=k[0]; break;
- case 3 : a+=k[0]<<8; break;
- case 2 : a+=k[0]<<16; break;
- case 1 : a+=k[0]<<24; break;
- case 0 : return c; /* zero length strings require no mixing */
- }
-
- } else { /* need to read the key one byte at a time */
- uint8 *k = (uint8 *)key;
-
- /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
- while (length > 12)
- {
- a += ((uint32)k[0])<<24;
- a += ((uint32)k[1])<<16;
- a += ((uint32)k[2])<<8;
- a += ((uint32)k[3]);
- b += ((uint32)k[4])<<24;
- b += ((uint32)k[5])<<16;
- b += ((uint32)k[6])<<8;
- b += ((uint32)k[7]);
- c += ((uint32)k[8])<<24;
- c += ((uint32)k[9])<<16;
- c += ((uint32)k[10])<<8;
- c += ((uint32)k[11]);
- mix(a,b,c);
- length -= 12;
- k += 12;
- }
-
- /*-------------------------------- last block: affect all 32 bits of (c) */
- switch(length) /* all the case statements fall through */
- {
- case 12: c+=((uint32)k[11])<<24;
- case 11: c+=((uint32)k[10])<<16;
- case 10: c+=((uint32)k[9])<<8;
- case 9 : c+=k[8];
- case 8 : b+=((uint32)k[7])<<24;
- case 7 : b+=((uint32)k[6])<<16;
- case 6 : b+=((uint32)k[5])<<8;
- case 5 : b+=k[4];
- case 4 : a+=((uint32)k[3])<<24;
- case 3 : a+=((uint32)k[2])<<16;
- case 2 : a+=((uint32)k[1])<<8;
- case 1 : a+=k[0];
- break;
- case 0 : return c;
- }
- }
-
- final(a,b,c);
- return c;
-}
-
-
-#ifdef SELF_TEST
-
-/* used for timings */
-void driver1()
-{
- uint8 buf[256];
- uint32 i;
- uint32 h=0;
- time_t a,z;
-
- time(&a);
- for (i=0; i<256; ++i) buf[i] = 'x';
- for (i=0; i<1; ++i)
- {
- h = hashlittle(&buf[0],1,h);
- }
- time(&z);
- if (z-a > 0) printf("time %ld %.8lx\n", z-a, h);
-}
-
-/* check that every input bit changes every output bit half the time */
-#define HASHSTATE 1
-#define HASHLEN 1
-#define MAXPAIR 60
-#define MAXLEN 70
-void driver2()
-{
- uint8 qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1];
- uint32 c[HASHSTATE], d[HASHSTATE], i, j=0, k, l, m, z;
- uint32 e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE];
- uint32 x[HASHSTATE],y[HASHSTATE];
- uint32 hlen;
-
- printf("No more than %d trials should ever be needed \n",MAXPAIR/2);
- for (hlen=0; hlen < MAXLEN; ++hlen)
- {
- z=0;
- for (i=0; i<hlen; ++i) /*----------------------- for each input byte, */
- {
- for (j=0; j<8; ++j) /*------------------------ for each input bit, */
- {
- for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
- {
- for (l=0; l<HASHSTATE; ++l) e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32)0);
-
- /*---- check that every output bit is affected by that input bit */
- for (k=0; k<MAXPAIR; k+=2)
- {
- uint32 finished=1;
- /* keys have one bit different */
- for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8)0;}
- /* have a and b be two keys differing in only one bit */
- a[i] ^= (k<<j);
- a[i] ^= (k>>(8-j));
- c[0] = hashlittle(a, hlen, m);
- b[i] ^= ((k+1)<<j);
- b[i] ^= ((k+1)>>(8-j));
- d[0] = hashlittle(b, hlen, m);
- /* check every bit is 1, 0, set, and not set at least once */
- for (l=0; l<HASHSTATE; ++l)
- {
- e[l] &= (c[l]^d[l]);
- f[l] &= ~(c[l]^d[l]);
- g[l] &= c[l];
- h[l] &= ~c[l];
- x[l] &= d[l];
- y[l] &= ~d[l];
- if (e[l]|f[l]|g[l]|h[l]|x[l]|y[l]) finished=0;
- }
- if (finished) break;
- }
- if (k>z) z=k;
- if (k==MAXPAIR)
- {
- printf("Some bit didn't change: ");
- printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx ",
- e[0],f[0],g[0],h[0],x[0],y[0]);
- printf("i %ld j %ld m %ld len %ld\n",i,j,m,hlen);
- }
- if (z==MAXPAIR) goto done;
- }
- }
- }
- done:
- if (z < MAXPAIR)
- {
- printf("Mix success %2ld bytes %2ld initvals ",i,m);
- printf("required %ld trials\n",z/2);
- }
- }
- printf("\n");
-}
-
-/* Check for reading beyond the end of the buffer and alignment problems */
-void driver3()
-{
- uint8 buf[MAXLEN+20], *b;
- uint32 len;
- uint8 q[] = "This is the time for all good men to come to the aid of their country...";
- //uint32 dummy1;
- uint8 qq[] = "xThis is the time for all good men to come to the aid of their country...";
- //uint32 dummy2;
- uint8 qqq[] = "xxThis is the time for all good men to come to the aid of their country...";
- //uint32 dummy3;
- uint8 qqqq[] = "xxxThis is the time for all good men to come to the aid of their country...";
- uint32 h,i,j,ref,x,y;
- uint8 *p;
-
- printf("Endianness. These lines should all be the same (for values filled in):\n");
- printf("%.8lx %.8lx %.8lx\n",
- hashword((uint32 *)q, (sizeof(q)-1)/4, 13),
- hashword((uint32 *)q, (sizeof(q)-5)/4, 13),
- hashword((uint32 *)q, (sizeof(q)-9)/4, 13));
- p = q;
- printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n",
- hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
- hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13),
- hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13),
- hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13),
- hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13),
- hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13));
- p = &qq[1];
- printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n",
- hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
- hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13),
- hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13),
- hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13),
- hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13),
- hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13));
- p = &qqq[2];
- printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n",
- hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
- hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13),
- hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13),
- hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13),
- hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13),
- hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13));
- p = &qqqq[3];
- printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx %.8lx\n",
- hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
- hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13),
- hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13),
- hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13),
- hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13),
- hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13));
- printf("\n");
- for (h=0, b=buf+1; h<8; ++h, ++b)
- {
- for (i=0; i<MAXLEN; ++i)
- {
- len = i;
- for (j=0; j<i; ++j) *(b+j)=0;
-
- /* these should all be equal */
- ref = hashlittle(b, len, (uint32)1);
- *(b+i)=(uint8)~0;
- *(b-1)=(uint8)~0;
- x = hashlittle(b, len, (uint32)1);
- y = hashlittle(b, len, (uint32)1);
- if ((ref != x) || (ref != y))
- {
- printf("alignment error: %.8lx %.8lx %.8lx %ld %ld\n",ref,x,y,h,i);
- }
- }
- }
-}
-
-/* check for problems with nulls */
- void driver4()
-{
- uint8 buf[1];
- uint32 h,i,state[HASHSTATE];
-
-
- buf[0] = ~0;
- for (i=0; i<HASHSTATE; ++i) state[i] = 1;
- printf("These should all be different\n");
- for (i=0, h=0; i<8; ++i)
- {
- h = hashlittle(buf, (uint32)0, h);
- printf("%2ld 0-byte strings, hash is %.8lx\n", i, h);
- }
-}
-
-
-int main()
-{
- driver1(); /* test that the key is hashed: used for timings */
- driver2(); /* test that whole key is hashed thoroughly */
- driver3(); /* test that nothing but the key is hashed */
- driver4(); /* test hashing multiple buffers (all buffers are null) */
- return 1;
-}
-
-#endif /* SELF_TEST */
diff --git a/plugins/Variables/src/main.cpp b/plugins/Variables/src/main.cpp index 4bfff0a42d..b3d2377ec7 100644 --- a/plugins/Variables/src/main.cpp +++ b/plugins/Variables/src/main.cpp @@ -1,20 +1,20 @@ - /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is mir_free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+/*
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is mir_free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index 8cac54f7a7..ed4bf81e07 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -1,42 +1,42 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is mir_free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Variables Plugin for Miranda-IM (www.miranda-im.org)
+Copyright 2003-2006 P. Boon
+
+This program is mir_free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
-static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch( msg ) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- {
- DBVARIANT dbv;
- if (!db_get_ws( NULL, MODULENAME, SETTING_STARTUPTEXT, &dbv )) {
- SetDlgItemText(hwndDlg, IDC_FORMATTEXT, dbv.pwszVal);
- db_free(&dbv);
- }
+
+ DBVARIANT dbv;
+ if (!db_get_ws(NULL, MODULENAME, SETTING_STARTUPTEXT, &dbv)) {
+ SetDlgItemText(hwndDlg, IDC_FORMATTEXT, dbv.pwszVal);
+ db_free(&dbv);
}
+
CheckDlgButton(hwndDlg, IDC_PARSEATSTARTUP, db_get_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_STRIPCRLF, db_get_b(NULL, MODULENAME, SETTING_STRIPCRLF, 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_STRIPWS, db_get_b(NULL, MODULENAME, SETTING_STRIPWS, 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_STRIPALL, db_get_b(NULL, MODULENAME, SETTING_STRIPALL, 0) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE);
variables_skin_helpbutton(hwndDlg, IDC_SHOWHELP);
break;
@@ -48,13 +48,13 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA case IDC_STRIPWS:
case IDC_STRIPALL:
case IDC_FORMATTEXT:
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
gParseOpts.bStripEOL = IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF);
gParseOpts.bStripWS = IsDlgButtonChecked(hwndDlg, IDC_STRIPWS);
gParseOpts.bStripAll = IsDlgButtonChecked(hwndDlg, IDC_STRIPALL);
break;
}
- if (LOWORD(wParam) == IDC_FORMATTEXT && IsDlgButtonChecked( hwndDlg, IDC_AUTOPARSE ))
+ if (LOWORD(wParam) == IDC_FORMATTEXT && IsDlgButtonChecked(hwndDlg, IDC_AUTOPARSE))
SendMessage(hwndDlg, VARM_PARSE, 0, 0);
}
switch (LOWORD(wParam)) {
@@ -64,19 +64,19 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA case IDC_AUTOPARSE:
SendMessage(hwndDlg, VARM_PARSE, 0, 0);
- if (IsDlgButtonChecked( hwndDlg, IDC_AUTOPARSE ))
+ if (IsDlgButtonChecked(hwndDlg, IDC_AUTOPARSE))
SetTimer(hwndDlg, IDT_PARSE, 1000, nullptr);
else
KillTimer(hwndDlg, IDT_PARSE);
break;
case IDC_SHOWHELP:
- variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG|VHF_SETLASTSUBJECT, nullptr, nullptr);
+ variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG | VHF_SETLASTSUBJECT, nullptr, nullptr);
break;
case IDC_STRIPALL:
- EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE);
break;
}
break;
@@ -85,19 +85,19 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA if (((LPNMHDR)lParam)->code == PSN_APPLY) {
int len = SendDlgItemMessage(hwndDlg, IDC_FORMATTEXT, WM_GETTEXTLENGTH, 0, 0);
if (len >= 0) {
- wchar_t *szFormatText = (wchar_t*)mir_calloc((len+1)* sizeof(wchar_t));
+ wchar_t *szFormatText = (wchar_t*)mir_calloc((len + 1) * sizeof(wchar_t));
if (szFormatText == nullptr)
break;
- if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len+1) != 0)
+ if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len + 1) != 0)
db_set_ws(NULL, MODULENAME, SETTING_STARTUPTEXT, szFormatText);
mir_free(szFormatText);
}
- db_set_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP)?1:0));
- db_set_b(NULL, MODULENAME, SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF)?1:0));
- db_set_b(NULL, MODULENAME, SETTING_STRIPWS, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPWS)?1:0));
- db_set_b(NULL, MODULENAME, SETTING_STRIPALL, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?1:0));
+ db_set_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP) ? 1 : 0));
+ db_set_b(NULL, MODULENAME, SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF) ? 1 : 0));
+ db_set_b(NULL, MODULENAME, SETTING_STRIPWS, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPWS) ? 1 : 0));
+ db_set_b(NULL, MODULENAME, SETTING_STRIPALL, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? 1 : 0));
}
break;
@@ -111,7 +111,8 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA mir_free(newString);
}
mir_free(string);
- } }
+ }
+ }
break;
case WM_TIMER:
diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index 9fd2f4f6c0..f56c1b27b5 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
@@ -43,7 +43,7 @@ static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias) return nullptr;
}
-static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
+static wchar_t* replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
{
if (mir_wstrlen(tArg) == 0)
return res;
@@ -57,11 +57,11 @@ static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg) if (((signed int)mir_wstrlen(tArg) == (ecur - cur)) && (!wcsncmp(tArg, res + cur, mir_wstrlen(tArg)))) {
if (mir_wstrlen(rArg) > mir_wstrlen(tArg)) {
- res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + (mir_wstrlen(rArg) - mir_wstrlen(tArg)) + 1)*sizeof(wchar_t));
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + (mir_wstrlen(rArg) - mir_wstrlen(tArg)) + 1) * sizeof(wchar_t));
if (res == nullptr)
return nullptr;
}
- memmove(res + ecur + (mir_wstrlen(rArg) - mir_wstrlen(tArg)), res + ecur, (mir_wstrlen(res + ecur) + 1)*sizeof(wchar_t));
+ memmove(res + ecur + (mir_wstrlen(rArg) - mir_wstrlen(tArg)), res + ecur, (mir_wstrlen(res + ecur) + 1) * sizeof(wchar_t));
wcsncpy(res + cur, rArg, mir_wstrlen(rArg));
}
}
@@ -71,7 +71,7 @@ static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg) return res;
}
-static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai)
+static wchar_t* parseTranslateAlias(ARGUMENTSINFO *ai)
{
ALIASREGISTER *areg = searchAliasRegister(ai->argv.w[0]);
if (areg == nullptr || areg->argc != ai->argc - 1)
@@ -87,7 +87,7 @@ static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai) return res;
}
-static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** argv, wchar_t *szTranslation)
+static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t **argv, wchar_t *szTranslation)
{
if (szAlias == nullptr || szTranslation == nullptr || mir_wstrlen(szAlias) == 0)
return -1;
@@ -135,7 +135,7 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg return 0;
}
-static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
+static wchar_t* parseAddAlias(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -155,9 +155,9 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai) wchar_t *szArgs = nullptr;
for (int i = 0; i < argv.getCount(); i++) {
if (i == 0)
- szArgs = (wchar_t*)mir_calloc((mir_wstrlen(argv[i]) + 2)*sizeof(wchar_t));
+ szArgs = (wchar_t*)mir_calloc((mir_wstrlen(argv[i]) + 2) * sizeof(wchar_t));
else
- szArgs = (wchar_t*)mir_realloc(szArgs, (mir_wstrlen(szArgs) + mir_wstrlen(argv[i]) + 2)*sizeof(wchar_t));
+ szArgs = (wchar_t*)mir_realloc(szArgs, (mir_wstrlen(szArgs) + mir_wstrlen(argv[i]) + 2) * sizeof(wchar_t));
mir_wstrcat(szArgs, argv[i]);
if (i != argv.getCount() - 1)
diff --git a/plugins/Variables/src/parse_alias.h b/plugins/Variables/src/parse_alias.h index 15b70f9ae4..563ec91bf8 100644 --- a/plugins/Variables/src/parse_alias.h +++ b/plugins/Variables/src/parse_alias.h @@ -1,25 +1,25 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
-#define ADDALIAS L"alias"
+#define ADDALIAS L"alias"
int isValidTokenChar(wchar_t tc);
@@ -29,7 +29,7 @@ struct TArgList : public LIST<wchar_t> LIST<wchar_t>(1)
{}
- void destroy()
+ void destroy()
{
for (int i = 0; i < count; i++)
mir_free(items[i]);
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 10de3d36cb..815d587f4a 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -1,25 +1,25 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
-static wchar_t *getFullWinampTitleText()
+static wchar_t* getFullWinampTitleText()
{
HWND hwndWinamp = FindWindow(L"STUDIO", nullptr);
if (hwndWinamp == nullptr)
@@ -37,7 +37,7 @@ static wchar_t *getFullWinampTitleText() mir_free(szWinText);
return nullptr;
}
- wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_wstrlen(szWinText) + 1)*sizeof(wchar_t));
+ wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_wstrlen(szWinText) + 1) * sizeof(wchar_t));
if (szTitle == nullptr) {
mir_free(szWinText);
return nullptr;
@@ -49,7 +49,7 @@ static wchar_t *getFullWinampTitleText() return szTitle;
}
-static wchar_t *parseWinampSong(ARGUMENTSINFO *ai)
+static wchar_t* parseWinampSong(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
@@ -75,7 +75,7 @@ static wchar_t *parseWinampSong(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseWinampState(ARGUMENTSINFO *ai)
+static wchar_t* parseWinampState(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
@@ -103,4 +103,4 @@ void registerExternalTokens() {
registerIntToken(WINAMPSONG, parseWinampSong, TRF_FIELD, LPGEN("External Applications") "\t" LPGEN("retrieves song name of the song currently playing in Winamp"));
registerIntToken(WINAMPSTATE, parseWinampState, TRF_FIELD, LPGEN("External Applications") "\t" LPGEN("retrieves current Winamp state (Playing/Paused/Stopped)"));
-}
\ No newline at end of file +}
diff --git a/plugins/Variables/src/parse_external.h b/plugins/Variables/src/parse_external.h index 3b44bca045..82146214f2 100644 --- a/plugins/Variables/src/parse_external.h +++ b/plugins/Variables/src/parse_external.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index 0480c52627..080932fc12 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -1,25 +1,25 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
-static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai)
+static wchar_t* parseUrlEnc(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -50,7 +50,7 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai) return tres;
}
-static wchar_t *parseUrlDec(ARGUMENTSINFO *ai)
+static wchar_t* parseUrlDec(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -77,7 +77,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai) return tres;
}
-static wchar_t *parseNToA(ARGUMENTSINFO *ai)
+static wchar_t* parseNToA(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -87,7 +87,7 @@ static wchar_t *parseNToA(ARGUMENTSINFO *ai) return mir_a2u(inet_ntoa(in));
}
-static wchar_t *parseHToA(ARGUMENTSINFO *ai)
+static wchar_t* parseHToA(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
diff --git a/plugins/Variables/src/parse_inet.h b/plugins/Variables/src/parse_inet.h index 96acef8897..aafd99d9ae 100644 --- a/plugins/Variables/src/parse_inet.h +++ b/plugins/Variables/src/parse_inet.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp index 7a48c01931..5c623f64e2 100644 --- a/plugins/Variables/src/parse_logic.cpp +++ b/plugins/Variables/src/parse_logic.cpp @@ -1,25 +1,25 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
-static wchar_t *parseAnd(ARGUMENTSINFO *ai)
+static wchar_t* parseAnd(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return nullptr;
@@ -39,7 +39,7 @@ static wchar_t *parseAnd(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseFalse(ARGUMENTSINFO *ai)
+static wchar_t* parseFalse(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
@@ -48,7 +48,7 @@ static wchar_t *parseFalse(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseIf(ARGUMENTSINFO *ai)
+static wchar_t* parseIf(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return nullptr;
@@ -62,7 +62,7 @@ static wchar_t *parseIf(ARGUMENTSINFO *ai) return mir_wstrdup((fi.eCount == 0) ? ai->argv.w[2] : ai->argv.w[3]);
}
-static wchar_t *parseIf2(ARGUMENTSINFO *ai)
+static wchar_t* parseIf2(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -79,7 +79,7 @@ static wchar_t *parseIf2(ARGUMENTSINFO *ai) return mir_wstrdup(ai->argv.w[2]);
}
-static wchar_t *parseIf3(ARGUMENTSINFO *ai)
+static wchar_t* parseIf3(ARGUMENTSINFO *ai)
{
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -96,7 +96,7 @@ static wchar_t *parseIf3(ARGUMENTSINFO *ai) return nullptr;
}
-static wchar_t *parseIfequal(ARGUMENTSINFO *ai)
+static wchar_t* parseIfequal(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return nullptr;
@@ -116,7 +116,7 @@ static wchar_t *parseIfequal(ARGUMENTSINFO *ai) return mir_wstrdup(ai->argv.w[4]);
}
-static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
+static wchar_t* parseIfgreater(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return nullptr;
@@ -136,7 +136,7 @@ static wchar_t *parseIfgreater(ARGUMENTSINFO *ai) return mir_wstrdup(ai->argv.w[4]);
}
-static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
+static wchar_t* parseIflonger(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return nullptr;
@@ -161,7 +161,7 @@ static wchar_t *parseIflonger(ARGUMENTSINFO *ai) ?for(init, cond, incr, show)
*/
-static wchar_t *parseFor(ARGUMENTSINFO *ai)
+static wchar_t* parseFor(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return nullptr;
@@ -186,7 +186,7 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai) return nullptr;
}
}
- else res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(parsed) + 1)*sizeof(wchar_t));
+ else res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(parsed) + 1) * sizeof(wchar_t));
mir_wstrcat(res, parsed);
mir_free(parsed);
@@ -201,7 +201,7 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseEqual(ARGUMENTSINFO *ai)
+static wchar_t* parseEqual(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -212,7 +212,7 @@ static wchar_t *parseEqual(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseGreater(ARGUMENTSINFO *ai)
+static wchar_t* parseGreater(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -223,7 +223,7 @@ static wchar_t *parseGreater(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseLonger(ARGUMENTSINFO *ai)
+static wchar_t* parseLonger(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -234,7 +234,7 @@ static wchar_t *parseLonger(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseNot(ARGUMENTSINFO *ai)
+static wchar_t* parseNot(ARGUMENTSINFO *ai)
{
if (ai->argc != 2) {
return nullptr;
@@ -251,7 +251,7 @@ static wchar_t *parseNot(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseOr(ARGUMENTSINFO *ai)
+static wchar_t* parseOr(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return nullptr;
@@ -271,12 +271,12 @@ static wchar_t *parseOr(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseTrue(ARGUMENTSINFO *ai)
+static wchar_t* parseTrue(ARGUMENTSINFO *ai)
{
return (ai->argc != 1) ? nullptr : mir_wstrdup(L"");
}
-static wchar_t *parseXor(ARGUMENTSINFO *ai)
+static wchar_t* parseXor(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
diff --git a/plugins/Variables/src/parse_logic.h b/plugins/Variables/src/parse_logic.h index 7c5debd507..b8df26130f 100644 --- a/plugins/Variables/src/parse_logic.h +++ b/plugins/Variables/src/parse_logic.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index 31937df423..c6aedf013b 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -1,25 +1,25 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
-static wchar_t *parseAdd(ARGUMENTSINFO *ai)
+static wchar_t* parseAdd(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return nullptr;
@@ -31,7 +31,7 @@ static wchar_t *parseAdd(ARGUMENTSINFO *ai) return itot(result);
}
-static wchar_t *parseDiv(ARGUMENTSINFO *ai)
+static wchar_t* parseDiv(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -44,7 +44,7 @@ static wchar_t *parseDiv(ARGUMENTSINFO *ai) return itot(val1 / val2);
}
-static wchar_t *parseHex(ARGUMENTSINFO *ai)
+static wchar_t* parseHex(ARGUMENTSINFO *ai)
{
unsigned int i;
wchar_t szVal[34];
@@ -69,7 +69,7 @@ static wchar_t *parseHex(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseMod(ARGUMENTSINFO *ai)
+static wchar_t* parseMod(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -82,7 +82,7 @@ static wchar_t *parseMod(ARGUMENTSINFO *ai) return itot(val1 % val2);
}
-static wchar_t *parseMul(ARGUMENTSINFO *ai)
+static wchar_t* parseMul(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return nullptr;
@@ -94,7 +94,7 @@ static wchar_t *parseMul(ARGUMENTSINFO *ai) return itot(result);
}
-static wchar_t *parseMuldiv(ARGUMENTSINFO *ai)
+static wchar_t* parseMuldiv(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return nullptr;
@@ -105,7 +105,7 @@ static wchar_t *parseMuldiv(ARGUMENTSINFO *ai) return itot((ttoi(ai->argv.w[1])*ttoi(ai->argv.w[2])) / ttoi(ai->argv.w[3]));
}
-static wchar_t *parseMin(ARGUMENTSINFO *ai)
+static wchar_t* parseMin(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return nullptr;
@@ -117,7 +117,7 @@ static wchar_t *parseMin(ARGUMENTSINFO *ai) return itot(minVal);
}
-static wchar_t *parseMax(ARGUMENTSINFO *ai)
+static wchar_t* parseMax(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return nullptr;
@@ -129,7 +129,7 @@ static wchar_t *parseMax(ARGUMENTSINFO *ai) return itot(maxVal);
}
-static wchar_t *parseNum(ARGUMENTSINFO *ai)
+static wchar_t* parseNum(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -158,12 +158,12 @@ static wchar_t *parseNum(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseRand(ARGUMENTSINFO *)
+static wchar_t* parseRand(ARGUMENTSINFO *)
{
return itot(rand());
}
-static wchar_t *parseSub(ARGUMENTSINFO *ai)
+static wchar_t* parseSub(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return nullptr;
diff --git a/plugins/Variables/src/parse_math.h b/plugins/Variables/src/parse_math.h index b527572dfd..973d1e50e5 100644 --- a/plugins/Variables/src/parse_math.h +++ b/plugins/Variables/src/parse_math.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index e208489e97..f9b13bea14 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -1,25 +1,25 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
-static wchar_t *parseGetParent(ARGUMENTSINFO *ai)
+static wchar_t* parseGetParent(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -47,7 +47,7 @@ static wchar_t *parseGetParent(ARGUMENTSINFO *ai) return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
}
-static wchar_t *parseGetDefault(ARGUMENTSINFO *ai)
+static wchar_t* parseGetDefault(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -75,7 +75,7 @@ static wchar_t *parseGetDefault(ARGUMENTSINFO *ai) return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
}
-static wchar_t *parseGetMostOnline(ARGUMENTSINFO *ai)
+static wchar_t* parseGetMostOnline(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
diff --git a/plugins/Variables/src/parse_metacontacts.h b/plugins/Variables/src/parse_metacontacts.h index 9f8aa9cb7d..e59aebc2e5 100644 --- a/plugins/Variables/src/parse_metacontacts.h +++ b/plugins/Variables/src/parse_metacontacts.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index e3e042cad5..f54472db9e 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
@@ -234,7 +234,7 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai) lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0);
int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, nullptr, 0);
- wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
if (res == nullptr)
return nullptr;
@@ -277,7 +277,7 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai) lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, nullptr, 0);
- wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
if (res == nullptr)
return nullptr;
@@ -514,8 +514,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) flags &= ~DBE_LAST;
}
}
- }
- while ((!bEventOk) && (hDbEvent != NULL));
+ } while ((!bEventOk) && (hDbEvent != NULL));
return hDbEvent;
}
@@ -599,7 +598,7 @@ static wchar_t* parseVersionString(ARGUMENTSINFO *ai) return mir_a2u(versionString);
}
-static wchar_t *parseContactNameString(ARGUMENTSINFO *ai)
+static wchar_t* parseContactNameString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1 || ai->fi->hContact == NULL)
return nullptr;
@@ -609,7 +608,7 @@ static wchar_t *parseContactNameString(ARGUMENTSINFO *ai) return (ret == nullptr) ? nullptr : mir_wstrdup(ret);
}
-static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
+static wchar_t* parseMirDateString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
@@ -620,7 +619,7 @@ static wchar_t *parseMirDateString(ARGUMENTSINFO *ai) return mir_wstrdup(TimeZone_ToStringT(time(0), L"d s", ret, _countof(ret)));
}
-static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
+static wchar_t* parseMirandaCoreVar(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
@@ -632,7 +631,7 @@ static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai) return Utils_ReplaceVarsW(corevar);
}
-static wchar_t *parseMirSrvExists(ARGUMENTSINFO *ai)
+static wchar_t* parseMirSrvExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
diff --git a/plugins/Variables/src/parse_miranda.h b/plugins/Variables/src/parse_miranda.h index 8714c05ccd..2597be04b1 100644 --- a/plugins/Variables/src/parse_miranda.h +++ b/plugins/Variables/src/parse_miranda.h @@ -19,68 +19,58 @@ #pragma once
-#define VERSIONSTRING L"mirandaversion"
-#define CODETOSTATUS L"code2status"
-#define CONTACT L"contact"
-#define CONTACTCOUNT L"ccount"
-#define MIR_CONTACTINFO L"cinfo"
-#define DBPROFILENAME L"dbprofile"
-#define DBPROFILEPATH L"dbprofilepath"
-#define DBSETTING L"dbsetting"
-#define LSDATE L"lsdate"
-#define LSTIME L"lstime"
-#define LSSTATUS L"lsstatus"
-//#define SUBJECT "subject" // defined in variables.h
-#define MIRANDAPATH L"mirandapath"
-#define MYSTATUS L"mstatus"
-#define DBEVENT L"message" // may be extended later
-//#define PROTONAME "protoname" // depreciated
-#define PROTOINFO L"pinfo"
-#define TRANSLATE L"translate"
-#define CONTACT_NAME L"contactname"
-#define MIR_DATE L"date"
-#define SRVEXISTS L"srvexists"
+#define VERSIONSTRING L"mirandaversion"
+#define CODETOSTATUS L"code2status"
+#define CONTACT L"contact"
+#define CONTACTCOUNT L"ccount"
+#define MIR_CONTACTINFO L"cinfo"
+#define DBPROFILENAME L"dbprofile"
+#define DBPROFILEPATH L"dbprofilepath"
+#define DBSETTING L"dbsetting"
+#define LSDATE L"lsdate"
+#define LSTIME L"lstime"
+#define LSSTATUS L"lsstatus"
+#define MIRANDAPATH L"mirandapath"
+#define MYSTATUS L"mstatus"
+#define DBEVENT L"message" // may be extended later
+#define PROTOINFO L"pinfo"
+#define TRANSLATE L"translate"
+#define CONTACT_NAME L"contactname"
+#define MIR_DATE L"date"
+#define SRVEXISTS L"srvexists"
-#define STR_PINAME "name"
-#define STR_PIUIDTEXT "uidtext"
-#define STR_PIUIDSETTING "uidsetting"
-#define STR_PINICK "nick"
+#define STR_PINAME "name"
+#define STR_PIUIDTEXT "uidtext"
+#define STR_PIUIDSETTING "uidsetting"
+#define STR_PINICK "nick"
-#define SEEN_MODULE "SeenModule"
+#define SEEN_MODULE "SeenModule"
-#define STR_PROTOID L"protoid"
-#define STR_FIRST L"first"
-#define STR_LAST L"last"
-#define STR_SENT L"sent"
-#define STR_RCVD L"recv"
-#define STR_READ L"read"
-#define STR_UNREAD L"unread"
+#define STR_PROTOID L"protoid"
+#define STR_FIRST L"first"
+#define STR_LAST L"last"
+#define STR_SENT L"sent"
+#define STR_RCVD L"recv"
+#define STR_READ L"read"
+#define STR_UNREAD L"unread"
/* dbevent flags */
-/* these flags must contain:
-DBE_FIRST|DBE_LAST|DBE_NEXT|DBE_PREV
-and
-DBE_SENT|DBE_RCVD
-and
-DBE_READ|DBE_UNREAD
-and
-DBE_MESSAGE|DBE_URL|DBE_CONTACTS|DBE_ADDED|DBE_AUTHREQUEST|DBE_FILE|DBE_OTHER
-*/
-#define DBE_FIRST 0x00000001 // first event (conforming the rest of the flags)
-#define DBE_LAST 0x00000002 // last event (conforming the rest of the flags)
-#define DBE_NEXT 0x00000004 // next event (conforming the rest of the flags), hDbEvent must be set
-#define DBE_PREV 0x00000008 // prev event (conforming the rest of the flags), hDbEvent must be set
-#define DBE_SENT 0x00000010 // event was sent
-#define DBE_RCVD 0x00000020 // event was received
-#define DBE_READ 0x00000040 // event is read
-#define DBE_UNREAD 0x00000080 // event is not read
+#define DBE_FIRST 0x00000001 // first event (conforming the rest of the flags)
+#define DBE_LAST 0x00000002 // last event (conforming the rest of the flags)
+#define DBE_NEXT 0x00000004 // next event (conforming the rest of the flags), hDbEvent must be set
+#define DBE_PREV 0x00000008 // prev event (conforming the rest of the flags), hDbEvent must be set
+#define DBE_SENT 0x00000010 // event was sent
+#define DBE_RCVD 0x00000020 // event was received
+#define DBE_READ 0x00000040 // event is read
+#define DBE_UNREAD 0x00000080 // event is not read
+
/* type */
-#define DBE_MESSAGE 0x00000100 // event is a message, etc (pBlob = message)
-#define DBE_URL 0x00000200 // pBlob = message
-#define DBE_CONTACTS 0x00000400 // pBlob = 'some format', no string
-#define DBE_ADDED 0x00000800 // pBlob = 'some format', no string
-#define DBE_AUTHREQUEST 0x00001000 // pBlob = message
-#define DBE_FILE 0x00002000 // pBlob = DWORD + file + description
-#define DBE_OTHER 0x00008000
-#define DBE_ANYTYPE (DBE_MESSAGE|DBE_URL|DBE_CONTACTS|DBE_ADDED|DBE_AUTHREQUEST|DBE_FILE|DBE_STATUSCHANGE|DBE_OTHER)
-#define DBE_ANYFIRSTUNREAD (DBE_ANYTYPE|DBE_UNREAD|DBE_RCVD)
+#define DBE_MESSAGE 0x00000100 // event is a message, etc (pBlob = message)
+#define DBE_URL 0x00000200 // pBlob = message
+#define DBE_CONTACTS 0x00000400 // pBlob = 'some format', no string
+#define DBE_ADDED 0x00000800 // pBlob = 'some format', no string
+#define DBE_AUTHREQUEST 0x00001000 // pBlob = message
+#define DBE_FILE 0x00002000 // pBlob = DWORD + file + description
+#define DBE_OTHER 0x00008000
+#define DBE_ANYTYPE (DBE_MESSAGE|DBE_URL|DBE_CONTACTS|DBE_ADDED|DBE_AUTHREQUEST|DBE_FILE|DBE_STATUSCHANGE|DBE_OTHER)
+#define DBE_ANYFIRSTUNREAD (DBE_ANYTYPE|DBE_UNREAD|DBE_RCVD)
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index c6fd4e6737..1c987557a0 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
@@ -22,7 +22,7 @@ /*
pattern, subject
*/
-static wchar_t *parseRegExpCheck(ARGUMENTSINFO *ai)
+static wchar_t* parseRegExpCheck(ARGUMENTSINFO *ai)
{
const char *err;
int erroffset;
@@ -52,30 +52,29 @@ static wchar_t *parseRegExpCheck(ARGUMENTSINFO *ai) /*
pattern, subject, substring no (== PCRE string no (starting at 0))
*/
-static wchar_t *parseRegExpSubstr(ARGUMENTSINFO *ai)
+static wchar_t* parseRegExpSubstr(ARGUMENTSINFO *ai)
{
- const char *err;
- const wchar_t *substring;
- int erroffset, number;
- int offsets[99];
-
if (ai->argc != 4)
return nullptr;
- number = _wtoi(ai->argv.w[3]);
+ int number = _wtoi(ai->argv.w[3]);
if (number < 0)
return nullptr;
ai->flags = AIF_FALSE;
+ int erroffset;
+ const char *err;
pcre16 *ppat = pcre16_compile(ai->argv.w[1], 0, &err, &erroffset, nullptr);
if (ppat == nullptr)
return nullptr;
+ int offsets[99];
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
int nmat = pcre16_exec(ppat, extra, ai->argv.w[2], (int)mir_wstrlen(ai->argv.w[2]), 0, 0, offsets, 99);
if (nmat >= 0)
ai->flags &= ~AIF_FALSE;
+ const wchar_t *substring;
if (pcre16_get_substring(ai->argv.w[2], offsets, nmat, number, &substring) < 0)
ai->flags |= AIF_FALSE;
else {
@@ -91,4 +90,4 @@ void registerRegExpTokens() {
registerIntToken(REGEXPCHECK, parseRegExpCheck, TRF_FUNCTION, LPGEN("Regular Expressions") "\t(x,y)\t" LPGEN("(ANSI input only) the number of substring matches found in y with pattern x"));
registerIntToken(REGEXPSUBSTR, parseRegExpSubstr, TRF_FUNCTION, LPGEN("Regular Expressions") "\t(x,y,z)\t" LPGEN("(ANSI input only) substring match number z found in subject y with pattern x"));
-}
\ No newline at end of file +}
diff --git a/plugins/Variables/src/parse_regexp.h b/plugins/Variables/src/parse_regexp.h index 7242b74ab5..61788dd426 100644 --- a/plugins/Variables/src/parse_regexp.h +++ b/plugins/Variables/src/parse_regexp.h @@ -1,23 +1,23 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
-#define REGEXPCHECK L"regexp_check"
-#define REGEXPSUBSTR L"regexp_substr"
+#define REGEXPCHECK L"regexp_check"
+#define REGEXPSUBSTR L"regexp_substr"
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index e335a36d69..f7c2f9681c 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -1,25 +1,25 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
-static wchar_t *parseCaps(ARGUMENTSINFO *ai)
+static wchar_t* parseCaps(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -44,7 +44,7 @@ static wchar_t *parseCaps(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseCaps2(ARGUMENTSINFO *ai)
+static wchar_t* parseCaps2(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -64,13 +64,13 @@ static wchar_t *parseCaps2(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseCrlf(ARGUMENTSINFO *ai)
+static wchar_t* parseCrlf(ARGUMENTSINFO *ai)
{
ai->flags |= AIF_DONTPARSE;
return mir_wstrdup(L"\r\n");
}
-static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
+static wchar_t* parseEolToCrlf(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -95,7 +95,7 @@ static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseFixeol(ARGUMENTSINFO *ai)
+static wchar_t* parseFixeol(ARGUMENTSINFO *ai)
{
wchar_t *szReplacement;
if (ai->argc == 2)
@@ -123,7 +123,7 @@ static wchar_t *parseFixeol(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseFixeol2(ARGUMENTSINFO *ai)
+static wchar_t* parseFixeol2(ARGUMENTSINFO *ai)
{
wchar_t *szReplacement;
switch (ai->argc) {
@@ -155,7 +155,7 @@ static wchar_t *parseFixeol2(ARGUMENTSINFO *ai) return (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 1)*sizeof(wchar_t));
}
-static wchar_t *parseInsert(ARGUMENTSINFO *ai)
+static wchar_t* parseInsert(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return nullptr;
@@ -175,7 +175,7 @@ static wchar_t *parseInsert(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseLeft(ARGUMENTSINFO *ai)
+static wchar_t* parseLeft(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -194,7 +194,7 @@ static wchar_t *parseLeft(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseLen(ARGUMENTSINFO *ai)
+static wchar_t* parseLen(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -202,7 +202,7 @@ static wchar_t *parseLen(ARGUMENTSINFO *ai) return itot((int)mir_wstrlen(ai->argv.w[1]));
}
-static wchar_t *parseLineCount(ARGUMENTSINFO *ai)
+static wchar_t* parseLineCount(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -223,7 +223,7 @@ static wchar_t *parseLineCount(ARGUMENTSINFO *ai) return itot(count);
}
-static wchar_t *parseLower(ARGUMENTSINFO *ai)
+static wchar_t* parseLower(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -235,7 +235,7 @@ static wchar_t *parseLower(ARGUMENTSINFO *ai) return CharLower(res);
}
-static wchar_t *parseLongest(ARGUMENTSINFO *ai)
+static wchar_t* parseLongest(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return nullptr;
@@ -248,7 +248,7 @@ static wchar_t *parseLongest(ARGUMENTSINFO *ai) return mir_wstrdup(ai->argv.w[iLong]);
}
-static wchar_t *parseNoOp(ARGUMENTSINFO *ai)
+static wchar_t* parseNoOp(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -256,7 +256,7 @@ static wchar_t *parseNoOp(ARGUMENTSINFO *ai) return mir_wstrdup(ai->argv.w[1]);
}
-static wchar_t *parsePad(ARGUMENTSINFO *ai)
+static wchar_t* parsePad(ARGUMENTSINFO *ai)
{
wchar_t padchar;
switch (ai->argc) {
@@ -283,7 +283,7 @@ static wchar_t *parsePad(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parsePadright(ARGUMENTSINFO *ai)
+static wchar_t* parsePadright(ARGUMENTSINFO *ai)
{
wchar_t padchar;
switch (ai->argc) {
@@ -310,7 +310,7 @@ static wchar_t *parsePadright(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parsePadcut(ARGUMENTSINFO *ai)
+static wchar_t* parsePadcut(ARGUMENTSINFO *ai)
{
wchar_t padchar;
switch (ai->argc) {
@@ -339,7 +339,7 @@ static wchar_t *parsePadcut(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parsePadcutright(ARGUMENTSINFO *ai)
+static wchar_t* parsePadcutright(ARGUMENTSINFO *ai)
{
wchar_t padchar;
switch (ai->argc) {
@@ -368,7 +368,7 @@ static wchar_t *parsePadcutright(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseRepeat(ARGUMENTSINFO *ai)
+static wchar_t* parseRepeat(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -388,7 +388,7 @@ static wchar_t *parseRepeat(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseReplace(ARGUMENTSINFO *ai)
+static wchar_t* parseReplace(ARGUMENTSINFO *ai)
{
if ((ai->argc < 4) || (ai->argc % 2 != 0))
return nullptr;
@@ -419,7 +419,7 @@ static wchar_t *parseReplace(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseRight(ARGUMENTSINFO *ai)
+static wchar_t* parseRight(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -441,7 +441,7 @@ static wchar_t *parseRight(ARGUMENTSINFO *ai) /*
string, display size, scroll amount
*/
-static wchar_t *parseScroll(ARGUMENTSINFO *ai)
+static wchar_t* parseScroll(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return nullptr;
@@ -468,7 +468,7 @@ static wchar_t *parseScroll(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseShortest(ARGUMENTSINFO *ai)
+static wchar_t* parseShortest(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return nullptr;
@@ -481,7 +481,7 @@ static wchar_t *parseShortest(ARGUMENTSINFO *ai) return mir_wstrdup(ai->argv.w[iShort]);
}
-static wchar_t *parseStrchr(ARGUMENTSINFO *ai)
+static wchar_t* parseStrchr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -493,7 +493,7 @@ static wchar_t *parseStrchr(ARGUMENTSINFO *ai) return itot(c - ai->argv.w[1] + 1);
}
-static wchar_t *parseStrcmp(ARGUMENTSINFO *ai)
+static wchar_t* parseStrcmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -504,7 +504,7 @@ static wchar_t *parseStrcmp(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai)
+static wchar_t* parseStrmcmp(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return nullptr;
@@ -520,7 +520,7 @@ static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseStrncmp(ARGUMENTSINFO *ai)
+static wchar_t* parseStrncmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return nullptr;
@@ -535,7 +535,7 @@ static wchar_t *parseStrncmp(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseStricmp(ARGUMENTSINFO *ai)
+static wchar_t* parseStricmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -546,7 +546,7 @@ static wchar_t *parseStricmp(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai)
+static wchar_t* parseStrnicmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return nullptr;
@@ -561,7 +561,7 @@ static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseStrrchr(ARGUMENTSINFO *ai)
+static wchar_t* parseStrrchr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -573,7 +573,7 @@ static wchar_t *parseStrrchr(ARGUMENTSINFO *ai) return itot(c - ai->argv.w[1] + 1);
}
-static wchar_t *parseStrstr(ARGUMENTSINFO *ai)
+static wchar_t* parseStrstr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -585,7 +585,7 @@ static wchar_t *parseStrstr(ARGUMENTSINFO *ai) return itot(c - ai->argv.w[1] + 1);
}
-static wchar_t *parseSubstr(ARGUMENTSINFO *ai)
+static wchar_t* parseSubstr(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return nullptr;
@@ -605,7 +605,7 @@ static wchar_t *parseSubstr(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseSelect(ARGUMENTSINFO *ai)
+static wchar_t* parseSelect(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return nullptr;
@@ -617,7 +617,7 @@ static wchar_t *parseSelect(ARGUMENTSINFO *ai) return mir_wstrdup(ai->argv.w[n + 1]);
}
-static wchar_t *parseSwitch(ARGUMENTSINFO *ai)
+static wchar_t* parseSwitch(ARGUMENTSINFO *ai)
{
if (ai->argc % 2 != 0)
return nullptr;
@@ -629,7 +629,7 @@ static wchar_t *parseSwitch(ARGUMENTSINFO *ai) return nullptr;
}
-static wchar_t *parseTrim(ARGUMENTSINFO *ai)
+static wchar_t* parseTrim(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -655,7 +655,7 @@ static wchar_t *parseTrim(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseTab(ARGUMENTSINFO *ai)
+static wchar_t* parseTab(ARGUMENTSINFO *ai)
{
int count = 1;
if ((ai->argc == 2) && (mir_wstrlen(ai->argv.w[1]) > 0))
@@ -676,7 +676,7 @@ static wchar_t *parseTab(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseUpper(ARGUMENTSINFO *ai)
+static wchar_t* parseUpper(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -688,7 +688,7 @@ static wchar_t *parseUpper(ARGUMENTSINFO *ai) return CharUpper(res);
}
-static wchar_t *getNthWord(wchar_t *szString, int w)
+static wchar_t* getNthWord(wchar_t *szString, int w)
{
if (szString == nullptr)
return nullptr;
@@ -725,7 +725,7 @@ static wchar_t *getNthWord(wchar_t *szString, int w) return res;
}
-static wchar_t *parseWord(ARGUMENTSINFO *ai)
+static wchar_t* parseWord(ARGUMENTSINFO *ai)
{
if (ai->argc < 3 || ai->argc > 4)
return nullptr;
@@ -763,7 +763,7 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseExtratext(ARGUMENTSINFO *ai)
+static wchar_t* parseExtratext(ARGUMENTSINFO *ai)
{
if (ai->argc > 1)
return nullptr;
diff --git a/plugins/Variables/src/parse_str.h b/plugins/Variables/src/parse_str.h index 7f23c2a01a..a32ed3afa0 100644 --- a/plugins/Variables/src/parse_str.h +++ b/plugins/Variables/src/parse_str.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index ae1d72c3d9..e3d7d63ab9 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -1,25 +1,25 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
-static wchar_t *parseComputerName(ARGUMENTSINFO *ai)
+static wchar_t* parseComputerName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
@@ -40,80 +40,74 @@ static wchar_t *parseComputerName(ARGUMENTSINFO *ai) #include <pdh.h>
#include <pdhmsg.h>
-static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai)
+static wchar_t* parseCpuLoad(ARGUMENTSINFO *ai)
{
HQUERY hQuery;
PDH_FMT_COUNTERVALUE cValue;
HCOUNTER hCounter;
- wchar_t *szCounter, szVal[32];
+ wchar_t szVal[32];
if (ai->argc != 2)
return nullptr;
+ ptrW szCounter;
if (mir_wstrlen(ai->argv.w[1]) == 0)
szCounter = mir_wstrdup(L"\\Processor(_Total)\\% Processor Time");
else {
int size = (int)mir_wstrlen(ai->argv.w[1]) + 32;
szCounter = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
- if (szCounter == nullptr)
- return nullptr;
-
mir_snwprintf(szCounter, size, L"\\Process(%s)\\%% Processor Time", ai->argv.w[1]);
}
+
PDH_STATUS pdhStatus = PdhValidatePath(szCounter);
- if (pdhStatus != ERROR_SUCCESS) {
- mir_free(szCounter);
+ if (pdhStatus != ERROR_SUCCESS)
return nullptr;
- }
+
pdhStatus = PdhOpenQuery(nullptr, 0, &hQuery);
- if (pdhStatus != ERROR_SUCCESS) {
- mir_free(szCounter);
+ if (pdhStatus != ERROR_SUCCESS)
return nullptr;
- }
+
pdhStatus = PdhAddCounter(hQuery, szCounter, 0, &hCounter);
if (pdhStatus != ERROR_SUCCESS) {
- mir_free(szCounter);
pdhStatus = PdhCloseQuery(hQuery);
return nullptr;
}
+
pdhStatus = PdhCollectQueryData(hQuery);
if (pdhStatus != ERROR_SUCCESS) {
- mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
return nullptr;
}
+
Sleep(100);
pdhStatus = PdhCollectQueryData(hQuery);
if (pdhStatus != ERROR_SUCCESS) {
- mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
return nullptr;
}
+
pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_DOUBLE, (LPDWORD)nullptr, &cValue);
if (pdhStatus != ERROR_SUCCESS) {
- mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
return nullptr;
}
+
if (cValue.CStatus != ERROR_SUCCESS) {
- mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
return nullptr;
}
+
mir_snwprintf(szVal, L"%.0f", cValue.doubleValue);
- //PdhRemoveCounter(*hCounter);
PdhCloseQuery(hQuery);
- mir_free(szCounter);
-
return mir_wstrdup(szVal);
}
-static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai)
+static wchar_t* parseCurrentDate(ARGUMENTSINFO *ai)
{
wchar_t *szFormat;
if (ai->argc == 1 || (ai->argc > 1 && mir_wstrlen(ai->argv.w[1]) == 0))
@@ -134,7 +128,7 @@ static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai)
+static wchar_t* parseCurrentTime(ARGUMENTSINFO *ai)
{
wchar_t *szFormat;
if (ai->argc == 1 || (ai->argc > 1) && (mir_wstrlen(ai->argv.w[1]) == 0))
@@ -155,7 +149,7 @@ static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseDirectory(ARGUMENTSINFO *ai)
+static wchar_t* parseDirectory(ARGUMENTSINFO *ai)
{
if (ai->argc < 2 || ai->argc > 3)
return nullptr;
@@ -191,7 +185,7 @@ static wchar_t *parseDirectory(ARGUMENTSINFO *ai) path, depth
returns complete path up to "path depth - depth"
*/
-static wchar_t *parseDirectory2(ARGUMENTSINFO *ai)
+static wchar_t* parseDirectory2(ARGUMENTSINFO *ai)
{
if (ai->argc < 2 || ai->argc > 3)
return nullptr;
@@ -264,7 +258,7 @@ static int getTime(wchar_t *szTime, struct tm *date) return 0;
}
-static wchar_t *parseDiffTime(ARGUMENTSINFO *ai)
+static wchar_t* parseDiffTime(ARGUMENTSINFO *ai)
{
struct tm t0, t1;
wchar_t szTime[32];
@@ -287,7 +281,7 @@ static wchar_t *parseDiffTime(ARGUMENTSINFO *ai) return mir_wstrdup(szTime);
}
-static wchar_t *parseDirExists(ARGUMENTSINFO *ai)
+static wchar_t* parseDirExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -301,7 +295,7 @@ static wchar_t *parseDirExists(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai)
+static wchar_t* parseEnvironmentVariable(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -322,7 +316,7 @@ static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseFileExists(ARGUMENTSINFO *ai)
+static wchar_t* parseFileExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -336,7 +330,7 @@ static wchar_t *parseFileExists(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseFindWindow(ARGUMENTSINFO *ai)
+static wchar_t* parseFindWindow(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -359,7 +353,7 @@ static wchar_t *parseFindWindow(ARGUMENTSINFO *ai) // 2 = filter
// 3 = sperator
// 4 = [f]iles, [d]irs
-static wchar_t *parseListDir(ARGUMENTSINFO *ai)
+static wchar_t* parseListDir(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return nullptr;
@@ -430,7 +424,7 @@ static BOOL CALLBACK MyProcessEnumerator(DWORD, WORD, char *szProcess, LPARAM lP return TRUE;
}
-static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai)
+static wchar_t* parseProcessRunning(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
@@ -447,7 +441,7 @@ static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai) }
#endif
-static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai)
+static wchar_t* parseRegistryValue(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -519,7 +513,7 @@ static int TsToSystemTime(SYSTEMTIME *sysTime, time_t timestamp) return 0;
}
-static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai)
+static wchar_t* parseTimestamp2Date(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return nullptr;
@@ -551,7 +545,7 @@ static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai)
+static wchar_t* parseTimestamp2Time(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return nullptr;
@@ -583,7 +577,7 @@ static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai) return res;
}
-static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
+static wchar_t* parseTextFile(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -787,7 +781,7 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai) return nullptr;
}
-static wchar_t *parseUpTime(ARGUMENTSINFO *ai)
+static wchar_t* parseUpTime(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
@@ -825,7 +819,7 @@ static wchar_t *parseUpTime(ARGUMENTSINFO *ai) return mir_wstrdup(szVal);
}
-static wchar_t *parseUserName(ARGUMENTSINFO *ai)
+static wchar_t* parseUserName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
@@ -845,7 +839,7 @@ static wchar_t *parseUserName(ARGUMENTSINFO *ai) }
// clipboard support
-static wchar_t *parseClipboard(ARGUMENTSINFO *ai)
+static wchar_t* parseClipboard(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return nullptr;
diff --git a/plugins/Variables/src/parse_system.h b/plugins/Variables/src/parse_system.h index c35444007d..6a12c5843c 100644 --- a/plugins/Variables/src/parse_system.h +++ b/plugins/Variables/src/parse_system.h @@ -1,44 +1,44 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
-#define COMPUTERNAME L"computername"
-#define CPULOAD L"cpuload"
-#define CDATE L"cdate"
-#define CTIME L"ctime"
-#define DIRECTORY L"directory"
-#define DIRECTORY2 L"directory2"
-#define DIFFTIME L"difftime"
-#define DIREXISTS L"direxists"
-#define ENVIRONMENTVARIABLE L"env_var"
-#define FILEEXISTS L"fileexists"
-#define FINDWINDOW L"findwindow"
-#define LISTDIR L"ls"
-#define PROCESSRUNNING L"processrunning"
-#define REGISTRYVALUE L"regvalue"
-#define TIMESTAMP2DATE L"ts2date"
-#define TIMESTAMP2TIME L"ts2time"
-#define TXTFILE L"txtfile"
-#define UPTIME L"uptime"
-#define USERNAME L"username"
-#define CLIPBOARD L"clipboard"
+#define COMPUTERNAME L"computername"
+#define CPULOAD L"cpuload"
+#define CDATE L"cdate"
+#define CTIME L"ctime"
+#define DIRECTORY L"directory"
+#define DIRECTORY2 L"directory2"
+#define DIFFTIME L"difftime"
+#define DIREXISTS L"direxists"
+#define ENVIRONMENTVARIABLE L"env_var"
+#define FILEEXISTS L"fileexists"
+#define FINDWINDOW L"findwindow"
+#define LISTDIR L"ls"
+#define PROCESSRUNNING L"processrunning"
+#define REGISTRYVALUE L"regvalue"
+#define TIMESTAMP2DATE L"ts2date"
+#define TIMESTAMP2TIME L"ts2time"
+#define TXTFILE L"txtfile"
+#define UPTIME L"uptime"
+#define USERNAME L"username"
+#define CLIPBOARD L"clipboard"
-#define TXTFILEBUFSZ 4096
-#define MAX_REGVALUE_LENGTH 1024
+#define TXTFILEBUFSZ 4096
+#define MAX_REGVALUE_LENGTH 1024
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index 449352abd0..436ec5798e 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -48,7 +48,7 @@ static int addToVariablesRegister(wchar_t *szName, wchar_t *szText) return 0;
}
-static wchar_t *searchVariableRegister(wchar_t *szName)
+static wchar_t* searchVariableRegister(wchar_t *szName)
{
if ((szName == nullptr) || (mir_wstrlen(szName) <= 0))
return nullptr;
@@ -61,7 +61,7 @@ static wchar_t *searchVariableRegister(wchar_t *szName) return nullptr;
}
-static wchar_t *parsePut(ARGUMENTSINFO *ai)
+static wchar_t* parsePut(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -77,7 +77,7 @@ static wchar_t *parsePut(ARGUMENTSINFO *ai) return formatString(&fi);
}
-static wchar_t *parsePuts(ARGUMENTSINFO *ai)
+static wchar_t* parsePuts(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return nullptr;
@@ -88,7 +88,7 @@ static wchar_t *parsePuts(ARGUMENTSINFO *ai) return mir_wstrdup(L"");
}
-static wchar_t *parseGet(ARGUMENTSINFO *ai)
+static wchar_t* parseGet(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return nullptr;
diff --git a/plugins/Variables/src/parse_variables.h b/plugins/Variables/src/parse_variables.h index 88090b327d..08b3bd71df 100644 --- a/plugins/Variables/src/parse_variables.h +++ b/plugins/Variables/src/parse_variables.h @@ -1,29 +1,30 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
-typedef struct {
+struct VARIABLEREGISTER
+{
wchar_t *szName;
wchar_t *szText;
DWORD dwOwnerThread;
-} VARIABLEREGISTER;
+};
#define PUT L"put"
#define PUTS L"puts"
diff --git a/plugins/Variables/src/stdafx.h b/plugins/Variables/src/stdafx.h index ef895be881..926eeef75f 100644 --- a/plugins/Variables/src/stdafx.h +++ b/plugins/Variables/src/stdafx.h @@ -1,20 +1,20 @@ /*
- Variables Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Variables Plugin for Miranda-IM (www.miranda-im.org)
+Copyright 2003-2006 P. Boon
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp index 12838ec7fa..236389a4b6 100644 --- a/plugins/Variables/src/tokenregister.cpp +++ b/plugins/Variables/src/tokenregister.cpp @@ -37,17 +37,10 @@ static LIST<TokenRegisterEntry> tokens(100, CompareTokens); static mir_cs csRegister;
-unsigned long int hashlittle(void *key, size_t length, unsigned long int initval);
-
-static DWORD NameHashFunction(wchar_t *tszStr)
-{
- return (DWORD)hashlittle(tszStr, mir_wstrlen(tszStr)*sizeof(wchar_t), 0);
-}
-
static TokenRegisterEntry* FindTokenRegisterByName(wchar_t *name)
{
TokenRegisterEntry temp;
- temp.nameHash = NameHashFunction(name);
+ temp.nameHash = mir_hashstrW(name);
return tokens.find(&temp);
}
@@ -106,12 +99,12 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) if (newVr->flags & TRF_TCHAR) {
deRegisterToken(newVr->szTokenString.w);
- hash = NameHashFunction(newVr->szTokenString.w);
+ hash = mir_hashstrW(newVr->szTokenString.w);
}
else {
wchar_t *wtoken = mir_a2u(newVr->szTokenString.a);
deRegisterToken(wtoken);
- hash = NameHashFunction(wtoken);
+ hash = mir_hashstrW(wtoken);
mir_free(wtoken);
}
diff --git a/plugins/Variables/src/version.h b/plugins/Variables/src/version.h index e93bd0c549..a002618d9a 100644 --- a/plugins/Variables/src/version.h +++ b/plugins/Variables/src/version.h @@ -1,13 +1,13 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 2 -#define __RELEASE_NUM 3 -#define __BUILD_NUM 11 +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 2 +#define __RELEASE_NUM 3 +#define __BUILD_NUM 11 #include <stdver.h> #define __PLUGIN_NAME "Variables" #define __FILENAME "Variables.dll" -#define __DESCRIPTION "Adds support for dynamic variables in strings for plugins." -#define __AUTHOR "P Boon" -#define __AUTHORWEB "https://miranda-ng.org/p/Variables/" -#define __COPYRIGHT "© 2003-2008 P. Boon, Ricardo Pescuma, George Hazan" +#define __DESCRIPTION "Adds support for dynamic variables in strings for plugins." +#define __AUTHOR "P Boon" +#define __AUTHORWEB "https://miranda-ng.org/p/Variables/" +#define __COPYRIGHT "© 2003-2008 P. Boon, Ricardo Pescuma, George Hazan" |