blob: cacaf91b870a71a31bc6e08862fe76e169cc3ef6 [file] [log] [blame]
The Android Open Source Projectcbb10112009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2005 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Abhishek Aryae0dce902015-08-20 17:38:16 -070017#define __STDC_LIMIT_MACROS
18#include <stdint.h>
19
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080020#include <utils/String8.h>
21
Elliott Hughes1f8bc862015-07-29 14:02:29 -070022#include <utils/Compat.h>
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080023#include <utils/Log.h>
Kenny Rootba0165b2010-11-09 14:37:23 -080024#include <utils/Unicode.h>
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080025#include <utils/String16.h>
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080026#include <utils/threads.h>
27
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080028#include <ctype.h>
29
Sergio Girod2529f22015-09-23 16:22:59 +010030#include "SharedBuffer.h"
31
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +090032/*
33 * Functions outside android is below the namespace android, since they use
34 * functions and constants in android namespace.
35 */
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080036
37// ---------------------------------------------------------------------------
38
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +090039namespace android {
40
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080041// Separator used by resource paths. This is not platform dependent contrary
42// to OS_PATH_SEPARATOR.
43#define RES_PATH_SEPARATOR '/'
44
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080045static SharedBuffer* gEmptyStringBuf = NULL;
46static char* gEmptyString = NULL;
47
48extern int gDarwinCantLoadAllObjects;
49int gDarwinIsReallyAnnoying;
50
Mathias Agopian9eb2a3b2013-05-06 20:20:50 -070051void initialize_string8();
52
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080053static inline char* getEmptyString()
54{
55 gEmptyStringBuf->acquire();
56 return gEmptyString;
57}
58
59void initialize_string8()
60{
Dan Egnor88753ae2010-05-06 00:55:09 -070061 // HACK: This dummy dependency forces linking libutils Static.cpp,
62 // which is needed to initialize String8/String16 classes.
63 // These variables are named for Darwin, but are needed elsewhere too,
64 // including static linking on any platform.
65 gDarwinIsReallyAnnoying = gDarwinCantLoadAllObjects;
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +090066
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080067 SharedBuffer* buf = SharedBuffer::alloc(1);
68 char* str = (char*)buf->data();
69 *str = 0;
70 gEmptyStringBuf = buf;
71 gEmptyString = str;
72}
73
74void terminate_string8()
75{
76 SharedBuffer::bufferFromData(gEmptyString)->release();
77 gEmptyStringBuf = NULL;
78 gEmptyString = NULL;
79}
80
81// ---------------------------------------------------------------------------
82
83static char* allocFromUTF8(const char* in, size_t len)
84{
85 if (len > 0) {
Sergio Giroebabef22015-08-18 14:44:54 +010086 if (len == SIZE_MAX) {
87 return NULL;
88 }
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080089 SharedBuffer* buf = SharedBuffer::alloc(len+1);
Steve Blockae074452012-01-09 18:35:44 +000090 ALOG_ASSERT(buf, "Unable to allocate shared buffer");
The Android Open Source Projectcbb10112009-03-03 19:31:44 -080091 if (buf) {
92 char* str = (char*)buf->data();
93 memcpy(str, in, len);
94 str[len] = 0;
95 return str;
96 }
97 return NULL;
98 }
99
100 return getEmptyString();
101}
102
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900103static char* allocFromUTF16(const char16_t* in, size_t len)
104{
Kenny Root9a2d83e2009-12-04 09:38:48 -0800105 if (len == 0) return getEmptyString();
106
Sergio Giro1cfa56d2016-06-28 18:02:29 +0100107 // Allow for closing '\0'
108 const ssize_t resultStrLen = utf16_to_utf8_length(in, len) + 1;
109 if (resultStrLen < 1) {
Kenny Rootba0165b2010-11-09 14:37:23 -0800110 return getEmptyString();
111 }
Kenny Root9a2d83e2009-12-04 09:38:48 -0800112
Sergio Giro1cfa56d2016-06-28 18:02:29 +0100113 SharedBuffer* buf = SharedBuffer::alloc(resultStrLen);
Steve Blockae074452012-01-09 18:35:44 +0000114 ALOG_ASSERT(buf, "Unable to allocate shared buffer");
Kenny Rootba0165b2010-11-09 14:37:23 -0800115 if (!buf) {
116 return getEmptyString();
Kenny Root9a2d83e2009-12-04 09:38:48 -0800117 }
118
Sergio Giro1cfa56d2016-06-28 18:02:29 +0100119 char* resultStr = (char*)buf->data();
120 utf16_to_utf8(in, len, resultStr, resultStrLen);
121 return resultStr;
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900122}
123
124static char* allocFromUTF32(const char32_t* in, size_t len)
125{
Kenny Rootba0165b2010-11-09 14:37:23 -0800126 if (len == 0) {
127 return getEmptyString();
128 }
129
Sergio Giro1cfa56d2016-06-28 18:02:29 +0100130 const ssize_t resultStrLen = utf32_to_utf8_length(in, len) + 1;
131 if (resultStrLen < 1) {
Kenny Rootba0165b2010-11-09 14:37:23 -0800132 return getEmptyString();
133 }
134
Sergio Giro1cfa56d2016-06-28 18:02:29 +0100135 SharedBuffer* buf = SharedBuffer::alloc(resultStrLen);
Steve Blockae074452012-01-09 18:35:44 +0000136 ALOG_ASSERT(buf, "Unable to allocate shared buffer");
Kenny Rootba0165b2010-11-09 14:37:23 -0800137 if (!buf) {
138 return getEmptyString();
139 }
140
Sergio Giro1cfa56d2016-06-28 18:02:29 +0100141 char* resultStr = (char*) buf->data();
142 utf32_to_utf8(in, len, resultStr, resultStrLen);
Kenny Rootba0165b2010-11-09 14:37:23 -0800143
Sergio Giro1cfa56d2016-06-28 18:02:29 +0100144 return resultStr;
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900145}
146
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800147// ---------------------------------------------------------------------------
148
149String8::String8()
150 : mString(getEmptyString())
151{
152}
153
Mathias Agopian4485d0d2013-05-08 16:04:13 -0700154String8::String8(StaticLinkage)
155 : mString(0)
156{
157 // this constructor is used when we can't rely on the static-initializers
158 // having run. In this case we always allocate an empty string. It's less
159 // efficient than using getEmptyString(), but we assume it's uncommon.
160
161 char* data = static_cast<char*>(
162 SharedBuffer::alloc(sizeof(char))->data());
163 data[0] = 0;
164 mString = data;
165}
166
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800167String8::String8(const String8& o)
168 : mString(o.mString)
169{
170 SharedBuffer::bufferFromData(mString)->acquire();
171}
172
173String8::String8(const char* o)
174 : mString(allocFromUTF8(o, strlen(o)))
175{
176 if (mString == NULL) {
177 mString = getEmptyString();
178 }
179}
180
181String8::String8(const char* o, size_t len)
182 : mString(allocFromUTF8(o, len))
183{
184 if (mString == NULL) {
185 mString = getEmptyString();
186 }
187}
188
189String8::String8(const String16& o)
190 : mString(allocFromUTF16(o.string(), o.size()))
191{
192}
193
194String8::String8(const char16_t* o)
195 : mString(allocFromUTF16(o, strlen16(o)))
196{
197}
198
199String8::String8(const char16_t* o, size_t len)
200 : mString(allocFromUTF16(o, len))
201{
202}
203
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900204String8::String8(const char32_t* o)
205 : mString(allocFromUTF32(o, strlen32(o)))
206{
207}
208
209String8::String8(const char32_t* o, size_t len)
210 : mString(allocFromUTF32(o, len))
211{
212}
213
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800214String8::~String8()
215{
216 SharedBuffer::bufferFromData(mString)->release();
217}
218
Sergio Girod2529f22015-09-23 16:22:59 +0100219size_t String8::length() const
220{
221 return SharedBuffer::sizeFromData(mString)-1;
222}
223
Jeff Brown1d618d62010-12-02 13:50:46 -0800224String8 String8::format(const char* fmt, ...)
225{
226 va_list args;
227 va_start(args, fmt);
228
229 String8 result(formatV(fmt, args));
230
231 va_end(args);
232 return result;
233}
234
235String8 String8::formatV(const char* fmt, va_list args)
236{
237 String8 result;
238 result.appendFormatV(fmt, args);
239 return result;
240}
241
Jeff Brown48da31b2010-09-12 17:55:08 -0700242void String8::clear() {
243 SharedBuffer::bufferFromData(mString)->release();
244 mString = getEmptyString();
245}
246
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800247void String8::setTo(const String8& other)
248{
249 SharedBuffer::bufferFromData(other.mString)->acquire();
250 SharedBuffer::bufferFromData(mString)->release();
251 mString = other.mString;
252}
253
254status_t String8::setTo(const char* other)
255{
Andreas Huber10e5da52010-06-10 11:14:26 -0700256 const char *newString = allocFromUTF8(other, strlen(other));
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800257 SharedBuffer::bufferFromData(mString)->release();
Andreas Huber10e5da52010-06-10 11:14:26 -0700258 mString = newString;
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800259 if (mString) return NO_ERROR;
260
261 mString = getEmptyString();
262 return NO_MEMORY;
263}
264
265status_t String8::setTo(const char* other, size_t len)
266{
Andreas Huber10e5da52010-06-10 11:14:26 -0700267 const char *newString = allocFromUTF8(other, len);
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800268 SharedBuffer::bufferFromData(mString)->release();
Andreas Huber10e5da52010-06-10 11:14:26 -0700269 mString = newString;
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800270 if (mString) return NO_ERROR;
271
272 mString = getEmptyString();
273 return NO_MEMORY;
274}
275
276status_t String8::setTo(const char16_t* other, size_t len)
277{
Andreas Huber10e5da52010-06-10 11:14:26 -0700278 const char *newString = allocFromUTF16(other, len);
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800279 SharedBuffer::bufferFromData(mString)->release();
Andreas Huber10e5da52010-06-10 11:14:26 -0700280 mString = newString;
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800281 if (mString) return NO_ERROR;
282
283 mString = getEmptyString();
284 return NO_MEMORY;
285}
286
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900287status_t String8::setTo(const char32_t* other, size_t len)
288{
Andreas Huber10e5da52010-06-10 11:14:26 -0700289 const char *newString = allocFromUTF32(other, len);
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900290 SharedBuffer::bufferFromData(mString)->release();
Andreas Huber10e5da52010-06-10 11:14:26 -0700291 mString = newString;
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900292 if (mString) return NO_ERROR;
293
294 mString = getEmptyString();
295 return NO_MEMORY;
296}
297
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800298status_t String8::append(const String8& other)
299{
300 const size_t otherLen = other.bytes();
301 if (bytes() == 0) {
302 setTo(other);
303 return NO_ERROR;
304 } else if (otherLen == 0) {
305 return NO_ERROR;
306 }
307
308 return real_append(other.string(), otherLen);
309}
310
311status_t String8::append(const char* other)
312{
313 return append(other, strlen(other));
314}
315
316status_t String8::append(const char* other, size_t otherLen)
317{
318 if (bytes() == 0) {
319 return setTo(other, otherLen);
320 } else if (otherLen == 0) {
321 return NO_ERROR;
322 }
323
324 return real_append(other, otherLen);
325}
326
Jeff Brown35a154e2010-07-15 23:54:05 -0700327status_t String8::appendFormat(const char* fmt, ...)
328{
Jeff Brown647925d2010-11-10 16:03:06 -0800329 va_list args;
330 va_start(args, fmt);
Jeff Brown35a154e2010-07-15 23:54:05 -0700331
Jeff Brown647925d2010-11-10 16:03:06 -0800332 status_t result = appendFormatV(fmt, args);
333
334 va_end(args);
335 return result;
336}
337
338status_t String8::appendFormatV(const char* fmt, va_list args)
339{
Fengwei Yinfff9d112014-02-27 01:17:09 +0800340 int n, result = NO_ERROR;
341 va_list tmp_args;
342
343 /* args is undefined after vsnprintf.
344 * So we need a copy here to avoid the
345 * second vsnprintf access undefined args.
346 */
347 va_copy(tmp_args, args);
348 n = vsnprintf(NULL, 0, fmt, tmp_args);
349 va_end(tmp_args);
350
Jeff Brown35a154e2010-07-15 23:54:05 -0700351 if (n != 0) {
352 size_t oldLength = length();
353 char* buf = lockBuffer(oldLength + n);
354 if (buf) {
Jeff Brown647925d2010-11-10 16:03:06 -0800355 vsnprintf(buf + oldLength, n + 1, fmt, args);
Jeff Brown35a154e2010-07-15 23:54:05 -0700356 } else {
357 result = NO_MEMORY;
358 }
359 }
Jeff Brown35a154e2010-07-15 23:54:05 -0700360 return result;
361}
362
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800363status_t String8::real_append(const char* other, size_t otherLen)
364{
365 const size_t myLen = bytes();
Samuel Tan95fd5272016-02-18 16:56:21 -0800366
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800367 SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
368 ->editResize(myLen+otherLen+1);
369 if (buf) {
370 char* str = (char*)buf->data();
371 mString = str;
372 str += myLen;
373 memcpy(str, other, otherLen);
374 str[otherLen] = '\0';
375 return NO_ERROR;
376 }
377 return NO_MEMORY;
378}
379
380char* String8::lockBuffer(size_t size)
381{
382 SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
383 ->editResize(size+1);
384 if (buf) {
385 char* str = (char*)buf->data();
386 mString = str;
387 return str;
388 }
389 return NULL;
390}
391
392void String8::unlockBuffer()
393{
394 unlockBuffer(strlen(mString));
395}
396
397status_t String8::unlockBuffer(size_t size)
398{
399 if (size != this->size()) {
400 SharedBuffer* buf = SharedBuffer::bufferFromData(mString)
401 ->editResize(size+1);
Jeff Brown35a154e2010-07-15 23:54:05 -0700402 if (! buf) {
403 return NO_MEMORY;
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800404 }
Jeff Brown35a154e2010-07-15 23:54:05 -0700405
406 char* str = (char*)buf->data();
407 str[size] = 0;
408 mString = str;
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800409 }
Jeff Brown35a154e2010-07-15 23:54:05 -0700410
411 return NO_ERROR;
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800412}
413
414ssize_t String8::find(const char* other, size_t start) const
415{
416 size_t len = size();
417 if (start >= len) {
418 return -1;
419 }
420 const char* s = mString+start;
421 const char* p = strstr(s, other);
422 return p ? p-mString : -1;
423}
424
Jeff Brown5ee915a2014-06-06 19:30:15 -0700425bool String8::removeAll(const char* other) {
426 ssize_t index = find(other);
427 if (index < 0) return false;
428
429 char* buf = lockBuffer(size());
430 if (!buf) return false; // out of memory
431
432 size_t skip = strlen(other);
433 size_t len = size();
434 size_t tail = index;
435 while (size_t(index) < len) {
436 ssize_t next = find(other, index + skip);
437 if (next < 0) {
438 next = len;
439 }
440
Andreas Gampedd060f02014-11-13 15:50:17 -0800441 memmove(buf + tail, buf + index + skip, next - index - skip);
Jeff Brown5ee915a2014-06-06 19:30:15 -0700442 tail += next - index - skip;
443 index = next;
444 }
445 unlockBuffer(tail);
446 return true;
447}
448
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800449void String8::toLower()
450{
451 toLower(0, size());
452}
453
454void String8::toLower(size_t start, size_t length)
455{
456 const size_t len = size();
457 if (start >= len) {
458 return;
459 }
460 if (start+length > len) {
461 length = len-start;
462 }
463 char* buf = lockBuffer(len);
464 buf += start;
465 while (length > 0) {
466 *buf = tolower(*buf);
467 buf++;
468 length--;
469 }
470 unlockBuffer(len);
471}
472
473void String8::toUpper()
474{
475 toUpper(0, size());
476}
477
478void String8::toUpper(size_t start, size_t length)
479{
480 const size_t len = size();
481 if (start >= len) {
482 return;
483 }
484 if (start+length > len) {
485 length = len-start;
486 }
487 char* buf = lockBuffer(len);
488 buf += start;
489 while (length > 0) {
490 *buf = toupper(*buf);
491 buf++;
492 length--;
493 }
494 unlockBuffer(len);
495}
496
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900497size_t String8::getUtf32Length() const
498{
Kenny Rootba0165b2010-11-09 14:37:23 -0800499 return utf8_to_utf32_length(mString, length());
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900500}
501
502int32_t String8::getUtf32At(size_t index, size_t *next_index) const
503{
Kenny Rootba0165b2010-11-09 14:37:23 -0800504 return utf32_from_utf8_at(mString, length(), index, next_index);
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900505}
506
Kenny Rootba0165b2010-11-09 14:37:23 -0800507void String8::getUtf32(char32_t* dst) const
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900508{
Kenny Rootba0165b2010-11-09 14:37:23 -0800509 utf8_to_utf32(mString, length(), dst);
Daisuke Miyakawa44dad3e2009-06-30 20:40:42 +0900510}
511
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800512// ---------------------------------------------------------------------------
513// Path functions
514
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800515void String8::setPathName(const char* name)
516{
517 setPathName(name, strlen(name));
518}
519
520void String8::setPathName(const char* name, size_t len)
521{
522 char* buf = lockBuffer(len);
523
524 memcpy(buf, name, len);
525
526 // remove trailing path separator, if present
527 if (len > 0 && buf[len-1] == OS_PATH_SEPARATOR)
528 len--;
529
530 buf[len] = '\0';
531
532 unlockBuffer(len);
533}
534
535String8 String8::getPathLeaf(void) const
536{
537 const char* cp;
538 const char*const buf = mString;
539
540 cp = strrchr(buf, OS_PATH_SEPARATOR);
541 if (cp == NULL)
542 return String8(*this);
543 else
544 return String8(cp+1);
545}
546
547String8 String8::getPathDir(void) const
548{
549 const char* cp;
550 const char*const str = mString;
551
552 cp = strrchr(str, OS_PATH_SEPARATOR);
553 if (cp == NULL)
554 return String8("");
555 else
556 return String8(str, cp - str);
557}
558
559String8 String8::walkPath(String8* outRemains) const
560{
561 const char* cp;
562 const char*const str = mString;
563 const char* buf = str;
564
565 cp = strchr(buf, OS_PATH_SEPARATOR);
566 if (cp == buf) {
567 // don't include a leading '/'.
568 buf = buf+1;
569 cp = strchr(buf, OS_PATH_SEPARATOR);
570 }
571
572 if (cp == NULL) {
573 String8 res = buf != str ? String8(buf) : *this;
574 if (outRemains) *outRemains = String8("");
575 return res;
576 }
577
578 String8 res(buf, cp-buf);
579 if (outRemains) *outRemains = String8(cp+1);
580 return res;
581}
582
583/*
584 * Helper function for finding the start of an extension in a pathname.
585 *
586 * Returns a pointer inside mString, or NULL if no extension was found.
587 */
588char* String8::find_extension(void) const
589{
590 const char* lastSlash;
591 const char* lastDot;
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800592 const char* const str = mString;
593
594 // only look at the filename
595 lastSlash = strrchr(str, OS_PATH_SEPARATOR);
596 if (lastSlash == NULL)
597 lastSlash = str;
598 else
599 lastSlash++;
600
601 // find the last dot
602 lastDot = strrchr(lastSlash, '.');
603 if (lastDot == NULL)
604 return NULL;
605
606 // looks good, ship it
607 return const_cast<char*>(lastDot);
608}
609
610String8 String8::getPathExtension(void) const
611{
612 char* ext;
613
614 ext = find_extension();
615 if (ext != NULL)
616 return String8(ext);
617 else
618 return String8("");
619}
620
621String8 String8::getBasePath(void) const
622{
623 char* ext;
624 const char* const str = mString;
625
626 ext = find_extension();
627 if (ext == NULL)
628 return String8(*this);
629 else
630 return String8(str, ext - str);
631}
632
633String8& String8::appendPath(const char* name)
634{
635 // TODO: The test below will fail for Win32 paths. Fix later or ignore.
636 if (name[0] != OS_PATH_SEPARATOR) {
637 if (*name == '\0') {
638 // nothing to do
639 return *this;
640 }
641
642 size_t len = length();
643 if (len == 0) {
644 // no existing filename, just use the new one
645 setPathName(name);
646 return *this;
647 }
648
649 // make room for oldPath + '/' + newPath
650 int newlen = strlen(name);
651
652 char* buf = lockBuffer(len+1+newlen);
653
654 // insert a '/' if needed
655 if (buf[len-1] != OS_PATH_SEPARATOR)
656 buf[len++] = OS_PATH_SEPARATOR;
657
658 memcpy(buf+len, name, newlen+1);
659 len += newlen;
660
661 unlockBuffer(len);
662
663 return *this;
664 } else {
665 setPathName(name);
666 return *this;
667 }
668}
669
670String8& String8::convertToResPath()
671{
672#if OS_PATH_SEPARATOR != RES_PATH_SEPARATOR
673 size_t len = length();
674 if (len > 0) {
675 char * buf = lockBuffer(len);
676 for (char * end = buf + len; buf < end; ++buf) {
677 if (*buf == OS_PATH_SEPARATOR)
678 *buf = RES_PATH_SEPARATOR;
679 }
680 unlockBuffer(len);
681 }
682#endif
683 return *this;
684}
685
The Android Open Source Projectcbb10112009-03-03 19:31:44 -0800686}; // namespace android