summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/RToken.cpp
Unidiff
Diffstat (limited to 'kabc/vcard/RToken.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/RToken.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/kabc/vcard/RToken.cpp b/kabc/vcard/RToken.cpp
index 2a85820..8fc0558 100644
--- a/kabc/vcard/RToken.cpp
+++ b/kabc/vcard/RToken.cpp
@@ -1,82 +1,82 @@
1/* 1/*
2 2
3 libvcard - vCard parsing library for vCard version 3.0 3 libvcard - vCard parsing library for vCard version 3.0
4 4
5 Copyright (C) 1999 Rik Hemsley rik@kde.org 5 Copyright (C) 1999 Rik Hemsley rik@kde.org
6 6
7 Permission is hereby granted, free of charge, to any person obtaining a copy 7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to 8 of this software and associated documentation files (the "Software"), to
9 deal in the Software without restriction, including without limitation the 9 deal in the Software without restriction, including without limitation the
10 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11 sell copies of the Software, and to permit persons to whom the Software is 11 sell copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions: 12 furnished to do so, subject to the following conditions:
13 13
14 The above copyright notice and this permission notice shall be included in 14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software. 15 all copies or substantial portions of the Software.
16 16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23*/ 23*/
24 24
25#include <string.h> 25#include <string.h>
26#include <stddef.h> 26#include <stddef.h>
27#include <qcstring.h> 27#include <q3cstring.h>
28#include <qstrlist.h> 28#include <q3strlist.h>
29 29
30namespace VCARD 30namespace VCARD
31{ 31{
32 32
33 Q_UINT32 33 Q_UINT32
34RTokenise(const char * str, const char * delim, QStrList & l) 34RTokenise(const char * str, const char * delim, Q3StrList & l)
35{ 35{
36 // FIXME no stderr ! 36 // FIXME no stderr !
37 l.clear(); 37 l.clear();
38 38
39 if (!delim || !str || strlen(delim) == 0 || strlen(str) == 0) return 0; 39 if (!delim || !str || strlen(delim) == 0 || strlen(str) == 0) return 0;
40 40
41 char * len = (char *)(str + strlen(str));// End of string. 41 char * len = (char *)(str + strlen(str));// End of string.
42 42
43 register char * rstart = new char[strlen(str) + 1]; 43 register char * rstart = new char[strlen(str) + 1];
44 register char * r = rstart; 44 register char * r = rstart;
45 45
46 46
47 register const char * i = str;// Cursor. 47 register const char * i = str;// Cursor.
48 48
49 while (i <= len) { 49 while (i <= len) {
50 50
51 if (*i == '\\') { // Escaped chars go straight through. 51 if (*i == '\\') { // Escaped chars go straight through.
52 *r++ = *i++; 52 *r++ = *i++;
53 if (i <= len) 53 if (i <= len)
54 *r++ = *i++; 54 *r++ = *i++;
55 continue; 55 continue;
56 } 56 }
57 57
58 if (strchr(delim, *i) != 0) { 58 if (strchr(delim, *i) != 0) {
59 // We hit a delimiter. If we have some text, make a new token. 59 // We hit a delimiter. If we have some text, make a new token.
60 // This has the effect that multiple delimiters are collapsed. 60 // This has the effect that multiple delimiters are collapsed.
61 // cs: We mustn't collapse multiple delimiters, otherwise we 61 // cs: We mustn't collapse multiple delimiters, otherwise we
62 // lose empty fields. 62 // lose empty fields.
63 *r = '\0'; 63 *r = '\0';
64 // if (r != rstart) { 64 // if (r != rstart) {
65 l.append(rstart); 65 l.append(rstart);
66 // } 66 // }
67 r = rstart; 67 r = rstart;
68 ++i; 68 ++i;
69 continue; 69 continue;
70 } 70 }
71 71
72 *r++ = *i++; 72 *r++ = *i++;
73 } 73 }
74 74
75 // Catch last token 75 // Catch last token
76 //if (r != rstart) { 76 //if (r != rstart) {
77 *r = '\0'; 77 *r = '\0';
78 l.append(rstart); 78 l.append(rstart);
79 //} 79 //}
80 80
81 r = 0; 81 r = 0;
82 82