 |
Changeset 2586
- Timestamp:
- 09/29/07 13:45:43
(1 year ago)
- Author:
- kris
- Message:
fixes #649
added short-circuit to avoid appending multiple nulls
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2465 |
r2586 |
|
| 20 | 20 | { |
|---|
| 21 | 21 | if (s.ptr) |
|---|
| 22 | | s ~= '\0'; |
|---|
| | 22 | if (! (s.length && s[$-1] is 0)) |
|---|
| | 23 | s ~= '\0'; |
|---|
| 23 | 24 | return s.ptr; |
|---|
| 24 | 25 | } |
|---|
| … | … | |
| 40 | 41 | { |
|---|
| 41 | 42 | if (s.ptr) |
|---|
| 42 | | s ~= "\0"w; |
|---|
| | 43 | if (! (s.length && s[$-1] is 0)) |
|---|
| | 44 | s ~= "\0"w; |
|---|
| 43 | 45 | return s.ptr; |
|---|
| 44 | 46 | } |
|---|
| … | … | |
| 83 | 85 | assert(strlenz(p) == 2); |
|---|
| 84 | 86 | |
|---|
| 85 | | char[] test = ""; |
|---|
| | 87 | char[] test = "\0"; |
|---|
| 86 | 88 | p = toUtf8z(test); |
|---|
| 87 | 89 | assert(*p == 0); |
|---|
| | 90 | assert(p == test.ptr); |
|---|
| 88 | 91 | } |
|---|
| 89 | 92 | } |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic