diff options
author | Piotr Piastucki <leech.miranda@gmail.com> | 2014-08-13 13:46:55 +0000 |
---|---|---|
committer | Piotr Piastucki <leech.miranda@gmail.com> | 2014-08-13 13:46:55 +0000 |
commit | 96674592dd3493682a6cccb0b3dcf8ca019fd7a4 (patch) | |
tree | f42a68584d07fc2fd4a70c5866181327471e8f53 /protocols/SkypeClassic/src/util.c | |
parent | 3cf0b793fe90993ff333ba53104796f0c280118a (diff) |
Made SkypeClassic plugin compatible with Miranda IM again so that plugins for both IMs can be maintained with one codebase.
Compatibility wrapper for Miranda IM is in ng-compat/m_core.h
Changed files back to C and removed C++ code.
Changed Miranda NG project files so that the c files compile as C++ in order to be compatible with Miranda NG headers (/TP).
Added back build scripts and make file to automatically build Miranda IM version using Makefile.
git-svn-id: http://svn.miranda-ng.org/main/trunk@10177 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeClassic/src/util.c')
-rw-r--r-- | protocols/SkypeClassic/src/util.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/protocols/SkypeClassic/src/util.c b/protocols/SkypeClassic/src/util.c new file mode 100644 index 0000000000..ce5ad9c756 --- /dev/null +++ b/protocols/SkypeClassic/src/util.c @@ -0,0 +1,57 @@ +#include <stdlib.h>
+
+char * __cdecl strtok_r (
+ char * string,
+ const char * control,
+ char **nextoken
+ )
+{
+ unsigned char *str;
+ const unsigned char *ctrl = (const unsigned char*)control;
+
+ unsigned char map[32];
+ int count;
+
+ /* Clear control map */
+ for (count = 0; count < 32; count++)
+ map[count] = 0;
+
+ /* Set bits in delimiter table */
+ do {
+ map[*ctrl >> 3] |= (1 << (*ctrl & 7));
+ } while (*ctrl++);
+
+ /* Initialize str. If string is NULL, set str to the saved
+ * pointer (i.e., continue breaking tokens out of the string
+ * from the last strtok call) */
+ if (string)
+ str = (unsigned char*)string;
+ else
+ str = (unsigned char*)(*nextoken);
+
+ /* Find beginning of token (skip over leading delimiters). Note that
+ * there is no token iff this loop sets str to point to the terminal
+ * null (*str == '\0') */
+ while ( (map[*str >> 3] & (1 << (*str & 7))) && *str )
+ str++;
+
+ string = (char*)str;
+
+ /* Find the end of the token. If it is not the end of the string,
+ * put a null there. */
+ for ( ; *str ; str++ )
+ if ( map[*str >> 3] & (1 << (*str & 7)) ) {
+ *str++ = '\0';
+ break;
+ }
+
+ /* Update nextoken (or the corresponding field in the per-thread data
+ * structure */
+ *nextoken = (char*)str;
+
+ /* Determine if a token has been found. */
+ if ( string == (char*)str )
+ return NULL;
+ else
+ return string;
+}
|