Changeset 268:5995c228c72f
- Timestamp:
- 07/06/08 09:35:58
(3 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Fix: string termination
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r259 |
r268 |
|
| 67 | 67 | * Each <code>String</code> in the array contains the absolute path for a single |
|---|
| 68 | 68 | * file or directory. |
|---|
| 69 | | * |
|---|
| | 69 | * |
|---|
| 70 | 70 | * @param object a java <code>String[]</code> containing the file names to be converted |
|---|
| 71 | 71 | * @param transferData an empty <code>TransferData</code> object that will |
|---|
| 72 | 72 | * be filled in on return with the platform specific format of the data |
|---|
| 73 | | * |
|---|
| | 73 | * |
|---|
| 74 | 74 | * @see Transfer#nativeToJava |
|---|
| 75 | 75 | */ |
|---|
| … | … | |
| 122 | 122 | * @return a java <code>String[]</code> containing a list of file names if the conversion |
|---|
| 123 | 123 | * was successful; otherwise null |
|---|
| 124 | | * |
|---|
| | 124 | * |
|---|
| 125 | 125 | * @see Transfer#javaToNative |
|---|
| 126 | 126 | */ |
|---|
| … | … | |
| 134 | 134 | int size = i - offset; |
|---|
| 135 | 135 | char* file = cast(char*)OS.g_malloc(size + 1); |
|---|
| 136 | | String fileBuffer = new char[size + 1]; |
|---|
| 137 | | System.arraycopy(temp, offset, fileBuffer, 0, size); |
|---|
| 138 | | file[ 0 .. size + 1 ] = fileBuffer; |
|---|
| 139 | | char*[] newFiles = new char*[files.length + 1]; |
|---|
| 140 | | SimpleType!(char*).arraycopy(files, 0, newFiles, 0, files.length); |
|---|
| 141 | | newFiles[files.length] = file; |
|---|
| 142 | | files = newFiles; |
|---|
| | 136 | file[ 0 .. size ] = temp[ offset .. offset+size ]; |
|---|
| | 137 | file[ size ] = '\0'; |
|---|
| | 138 | files ~= file; |
|---|
| 143 | 139 | offset = i + 2; |
|---|
| 144 | 140 | } |
|---|
| … | … | |
| 147 | 143 | int size = temp.length - offset; |
|---|
| 148 | 144 | char* file = cast(char*)OS.g_malloc(size + 1); |
|---|
| 149 | | String fileBuffer = new char[size + 1]; |
|---|
| 150 | | System.arraycopy(temp, offset, fileBuffer, 0, size); |
|---|
| 151 | | file[ 0 .. size+1 ] = fileBuffer; |
|---|
| 152 | | char*[] newFiles = new char*[files.length + 1]; |
|---|
| 153 | | SimpleType!(char*).arraycopy(files, 0, newFiles, 0, files.length); |
|---|
| 154 | | newFiles[files.length] = file; |
|---|
| 155 | | files = newFiles; |
|---|
| | 145 | file[ 0 .. size ] = temp[ offset .. offset+size ]; |
|---|
| | 146 | file[ size ] = '\0'; |
|---|
| | 147 | files ~= file; |
|---|
| 156 | 148 | } |
|---|
| 157 | 149 | String[] fileNames; |
|---|