gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / kiki-portability-64bit.patch
1 This patch was downloaded from Debian:
2 https://anonscm.debian.org/viewvc/pkg-games/packages/trunk/kiki-the-nano-bot/debian/patches/portability-64bit.patch?revision=7984&view=co
3
4 Make 64-bit clean (string positions don't fit in an int on 64-bit machines)
5
6 Peter De Wachter (pdewacht@gmail.com)
7 placed in the public domain
8
9 Status: in upstream CVS
10
11 --- a/kodilib/src/tools/KFileTools.cpp
12 +++ b/kodilib/src/tools/KFileTools.cpp
13 @@ -214,8 +214,8 @@
14 // --------------------------------------------------------------------------------------------------------
15 string kFileSuffix ( const string & path )
16 {
17 - unsigned int lastDotPos = path.rfind(".");
18 - unsigned int lastSlashPos = path.rfind(kPathSep);
19 + std::string::size_type lastDotPos = path.rfind(".");
20 + std::string::size_type lastSlashPos = path.rfind(kPathSep);
21
22 if (lastDotPos < path.size() - 1 && (lastDotPos > lastSlashPos || lastSlashPos == string::npos))
23 {
24 @@ -228,7 +228,7 @@
25 string kFileDirName ( const string & path )
26 {
27 string native = kFileNativePath(path);
28 - unsigned int lastSlashPos = native.rfind(kPathSep);
29 + std::string::size_type lastSlashPos = native.rfind(kPathSep);
30 if (lastSlashPos < native.size())
31 {
32 return native.substr(0, lastSlashPos+1);
33 @@ -241,7 +241,7 @@
34 {
35 string native = kFileNativePath(path);
36 string baseName = native;
37 - unsigned int lastSlashPos = native.rfind(kPathSep);
38 + std::string::size_type lastSlashPos = native.rfind(kPathSep);
39 if (lastSlashPos < native.size() - 1)
40 {
41 baseName = native.substr(lastSlashPos+1);
42 --- a/kodilib/src/tools/KKeyTools.cpp
43 +++ b/kodilib/src/tools/KKeyTools.cpp
44 @@ -170,7 +170,7 @@
45 // --------------------------------------------------------------------------------------------------------
46 int kKeyGetDisplayWidthForKey ( const std::string & keyName )
47 {
48 - unsigned int keyPos = keyName.find('_', 0);
49 + std::string::size_type keyPos = keyName.find('_', 0);
50 if (keyPos == std::string::npos)
51 {
52 return kKeyGetDisplayWidthForPureKey(keyName) + KDL_MOD_KEY_SPACING;
53 @@ -313,7 +313,7 @@
54 int kKeyDisplayKey ( const std::string & keyName, const KPosition & pos )
55 {
56 KPosition start = pos;
57 - unsigned int keyPos = keyName.find('_', 0);
58 + std::string::size_type keyPos = keyName.find('_', 0);
59 if (keyPos == std::string::npos)
60 {
61 return start.x + kKeyDisplayPureKey(keyName, start) + KDL_MOD_KEY_SPACING;
62 @@ -380,7 +380,7 @@
63 // --------------------------------------------------------------------------------------------------------
64 SDL_keysym kKeyGetKeysymForKeyName ( const std::string & keyName )
65 {
66 - unsigned int pos = keyName.find('_');
67 + std::string::size_type pos = keyName.find('_');
68
69 std::string modString;
70 std::string symString = keyName;
71 --- a/kodilib/src/tools/KStringTools.cpp
72 +++ b/kodilib/src/tools/KStringTools.cpp
73 @@ -13,7 +13,7 @@
74 void kStringInsertStringBehindTags ( std::string & str, const std::string & insertString,
75 const std::string & tag )
76 {
77 - unsigned int oldPos = 0;
78 + std::string::size_type oldPos = 0;
79 while ((oldPos = str.find(tag, oldPos)) != std::string::npos)
80 {
81 oldPos += tag.size();
82 @@ -34,8 +34,8 @@
83 {
84 std::vector<std::string> components;
85
86 - unsigned int dividerLength = divider.size();
87 - unsigned int oldpos = 0, pos;
88 + std::string::size_type dividerLength = divider.size();
89 + std::string::size_type oldpos = 0, pos;
90
91 while ((pos = str.find(divider, oldpos)) != std::string::npos)
92 {
93 @@ -50,7 +50,7 @@
94 // --------------------------------------------------------------------------------------------------------
95 void kStringReplace ( std::string & str, const std::string & toReplace, const std::string & replacement )
96 {
97 - unsigned int pos = 0, chars = toReplace.size();
98 + std::string::size_type pos = 0, chars = toReplace.size();
99 while ((pos = str.find(toReplace, pos)) != std::string::npos)
100 {
101 str.replace(pos, chars, replacement);
102 @@ -60,11 +60,11 @@
103 // --------------------------------------------------------------------------------------------------------
104 void kStringReplaceTabs ( std::string & str, unsigned int tabWidth )
105 {
106 - unsigned int tabPos;
107 + std::string::size_type tabPos;
108 while ((tabPos = str.find('\t')) != std::string::npos)
109 {
110 - unsigned int lastNewlinePos = str.rfind('\n', tabPos-1);
111 - unsigned int relPos = (lastNewlinePos == std::string::npos) ? tabPos : tabPos - lastNewlinePos;
112 + std::string::size_type lastNewlinePos = str.rfind('\n', tabPos-1);
113 + std::string::size_type relPos = (lastNewlinePos == std::string::npos) ? tabPos : tabPos - lastNewlinePos;
114 str.replace(tabPos, 1, std::string(tabWidth-(relPos % tabWidth), ' '));
115 }
116 }
117 @@ -114,7 +114,7 @@
118 // --------------------------------------------------------------------------------------------------------
119 unsigned int kStringNthCharPos ( const std::string & str, unsigned int n, char c )
120 {
121 - unsigned int loc = n, oloc = 0;
122 + std::string::size_type loc = n, oloc = 0;
123 while (n > 0 && (loc = str.find(c, oloc)) != std::string::npos)
124 {
125 n--;
126 @@ -138,7 +138,7 @@
127 // --------------------------------------------------------------------------------------------------------
128 void kStringCropCols ( std::string & str, unsigned int columns )
129 {
130 - unsigned int oloc = 0, nloc = 0;
131 + std::string::size_type oloc = 0, nloc = 0;
132 while ((nloc = str.find('\n', oloc)) != std::string::npos)
133 {
134 if ((nloc - oloc) > columns)
135 @@ -160,10 +160,10 @@
136 unsigned int kStringCols ( const std::string & str )
137 {
138 if (str.size() == 0) return 0;
139 - int oloc = 0, nloc;
140 + long oloc = 0, nloc;
141 std::string substring;
142 int maxlength = 0, length;
143 - while ((nloc = str.find('\n', oloc)) != (int)std::string::npos)
144 + while ((nloc = str.find('\n', oloc)) != (long)std::string::npos)
145 {
146 substring = str.substr(oloc, nloc - oloc);
147 length = substring.size();
148 @@ -181,7 +181,7 @@
149 unsigned int kStringRows ( const std::string & str )
150 {
151 if (str.size() == 0) return 1;
152 - unsigned int loc = 0, lines = 0;
153 + std::string::size_type loc = 0, lines = 0;
154 while ((loc = str.find('\n', loc)) != std::string::npos) { lines++; loc++; }
155 if (str[str.size()-1] == '\n') return lines;
156 return lines+1;
157 @@ -204,8 +204,8 @@
158 {
159 static char str[256];
160 std::string format(fmt), subformat, text;
161 - unsigned int oloc = 0;
162 - unsigned int nloc = 0;
163 + std::string::size_type oloc = 0;
164 + std::string::size_type nloc = 0;
165
166 kStringReplaceTabs(format);
167
168 @@ -260,7 +260,7 @@
169 // --------------------------------------------------------------------------------------------------------
170 bool kStringHasSuffix ( const std::string & str, const std::string & suffix )
171 {
172 - unsigned int result = str.rfind(suffix);
173 + std::string::size_type result = str.rfind(suffix);
174 if (result == std::string::npos) return false;
175 return (result == str.size()-suffix.size());
176 }
177 --- a/kodilib/src/tools/KXMLTools.cpp
178 +++ b/kodilib/src/tools/KXMLTools.cpp
179 @@ -58,11 +58,11 @@
180 std::string kXMLParseToTagsInVector ( std::string & xml, const std::vector<std::string> & tags )
181 {
182 std::string open("<");
183 - unsigned int minLoc = std::string::npos;
184 + std::string::size_type minLoc = std::string::npos;
185 std::vector<std::string>::const_iterator iter = tags.begin();
186 while (iter != tags.end())
187 {
188 - unsigned int loc = xml.find(open+(*iter));
189 + std::string::size_type loc = xml.find(open+(*iter));
190 if (loc < minLoc) minLoc = loc;
191 iter++;
192 }
193 @@ -77,7 +77,7 @@
194 std::string value;
195 std::string nameStr(name);
196 nameStr += "='";
197 - unsigned int loc = xml.find(nameStr);
198 + std::string::size_type loc = xml.find(nameStr);
199 if (loc != std::string::npos)
200 {
201 loc += nameStr.size();
202 @@ -90,7 +90,7 @@
203 // --------------------------------------------------------------------------------------------------------
204 bool kXMLParseNamedCloseTag ( std::string & xml, const std::string & name, bool printError )
205 {
206 - unsigned int loc = xml.find('<');
207 + std::string::size_type loc = xml.find('<');
208 if (loc == std::string::npos)
209 {
210 if (printError) KConsole::printError(kStringPrintf("invalid XML:\nmissing close tag '%s'",
211 @@ -117,7 +117,7 @@
212 // --------------------------------------------------------------------------------------------------------
213 bool kXMLReadNamedOpenTag ( const std::string & xml, const std::string & name, std::string * attributes )
214 {
215 - unsigned int loc = xml.find('<'), endloc;
216 + std::string::size_type loc = xml.find('<'), endloc;
217
218 if (loc == std::string::npos || xml[loc+1] == '/') return false;
219
220 @@ -140,7 +140,7 @@
221 // --------------------------------------------------------------------------------------------------------
222 std::string kXMLParseNamedOpenTag ( std::string & xml, const std::string & name, std::string * attributes, bool printError )
223 {
224 - unsigned int loc = xml.find('<');
225 + std::string::size_type loc = xml.find('<');
226 if (loc == std::string::npos || xml[loc+1] == '/')
227 {
228 if (printError) KConsole::printError(kStringPrintf("invalid XML:\nmissing tag '%s'", name.c_str()));
229 @@ -191,7 +191,7 @@
230 // --------------------------------------------------------------------------------------------------------
231 bool kXMLParseOpenTag ( std::string & xml, std::string & name, std::string * attributes, bool printError )
232 {
233 - unsigned int loc = xml.find('<');
234 + std::string::size_type loc = xml.find('<');
235 if (loc == std::string::npos || xml[loc+1] == '/')
236 {
237 if (printError) KConsole::printError("invalid XML:\nmissing open tag");
238 @@ -295,7 +295,7 @@
239 // --------------------------------------------------------------------------------------------------------
240 bool kXMLParseValue( std::string & xml, const std::string & name, int type, void * value, bool printError )
241 {
242 - unsigned int loc = xml.find('<');
243 + std::string::size_type loc = xml.find('<');
244 if (loc == std::string::npos || xml[loc+1] == '/')
245 {
246 if (printError) KConsole::printError(kStringPrintf("invalid XML:\nmissing value '%s'", name.c_str()));
247 @@ -379,8 +379,8 @@
248 }
249 else if (typeString == "string")
250 {
251 - unsigned int first = substring.find("\"")+1;
252 - unsigned int last = substring.rfind("\"", std::string::npos);
253 + std::string::size_type first = substring.find("\"")+1;
254 + std::string::size_type last = substring.rfind("\"", std::string::npos);
255 *((std::string*)value) = substring.substr(first, last-first);
256 }
257
258 --- a/kodilib/src/types/KKey.cpp
259 +++ b/kodilib/src/types/KKey.cpp
260 @@ -31,7 +31,7 @@
261 // --------------------------------------------------------------------------------------------------------
262 std::string KKey::getUnmodifiedName () const
263 {
264 - unsigned int keyPos = name.find('_', 0);
265 + std::string::size_type keyPos = name.find('_', 0);
266 if (keyPos == std::string::npos)
267 {
268 return name;
269 @@ -42,7 +42,7 @@
270 // --------------------------------------------------------------------------------------------------------
271 std::string KKey::getModifierName () const
272 {
273 - unsigned int keyPos = name.find('_', 0);
274 + std::string::size_type keyPos = name.find('_', 0);
275 if (keyPos == std::string::npos)
276 {
277 return "";
278 --- a/kodilib/src/widgets/KFileNameField.cpp
279 +++ b/kodilib/src/widgets/KFileNameField.cpp
280 @@ -41,7 +41,7 @@
281 std::string restPath; // path behind cursor
282
283 // map cropped path to current directory and rest path to file prefix
284 - unsigned int lastSlashPos = croppedPath.rfind("/");
285 + std::string::size_type lastSlashPos = croppedPath.rfind("/");
286 if (lastSlashPos < croppedPath.size()-1)
287 {
288 restPath = croppedPath.substr(lastSlashPos+1);
289 @@ -88,7 +88,7 @@
290 }
291
292 // ............................collect list of entries in searchDir that match prefix restPath
293 - unsigned int restLength = restPath.size();
294 + std::string::size_type restLength = restPath.size();
295 std::vector<std::string> matchingEntries;
296 std::vector<std::string>::iterator iter = dir_entries.begin();
297 while (iter != dir_entries.end())
298 @@ -223,7 +223,7 @@
299 // --------------------------------------------------------------------------------------------------------
300 void KFileNameField::selectLastPathComponent ()
301 {
302 - unsigned int lastSlashPos = text.rfind("/");
303 + std::string::size_type lastSlashPos = text.rfind("/");
304 if (lastSlashPos == text.size()-1) lastSlashPos = text.rfind("/", lastSlashPos-1);
305 if (lastSlashPos < text.size()) cursor_pos = lastSlashPos+1;
306 else cursor_pos = 0;
307 --- a/src/gui/KikiMenu.cpp
308 +++ b/src/gui/KikiMenu.cpp
309 @@ -54,7 +54,7 @@
310 {
311 std::string item_text (itemText);
312 std::string event_name (itemText);
313 - unsigned int pos;
314 + std::string::size_type pos;
315 float scale_factor = 1.0;
316
317 KikiMenuItem * menu_item = new KikiMenuItem ();
318 --- a/src/gui/KikiTextLine.cpp
319 +++ b/src/gui/KikiTextLine.cpp
320 @@ -46,7 +46,7 @@
321 void KikiTextLine::setText ( const std::string & str )
322 {
323 text = str;
324 - unsigned int pos;
325 + std::string::size_type pos;
326
327 if ((pos = text.find ("$scale(")) != std::string::npos)
328 {