comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/FileDialog.d @ 38:2e09b0e6857a

work on phobosfication
author Frank Benoit <benoit@tionex.de>
date Wed, 25 Mar 2009 11:18:25 +0100
parents 6dd524f61e62
children 9f4c18c268b2
comparison
equal deleted inserted replaced
37:46c5f8f56b41 38:2e09b0e6857a
276 } 276 }
277 277
278 /* Convert the title and copy it into lpstrTitle */ 278 /* Convert the title and copy it into lpstrTitle */
279 if (title is null) title = ""; 279 if (title is null) title = "";
280 /* Use the character encoding for the default locale */ 280 /* Use the character encoding for the default locale */
281 TCHAR[] buffer3 = StrToTCHARs (0, title, true); 281 auto buffer3 = StrToTCHARs (0, title, true);
282 int byteCount3 = buffer3.length * TCHAR.sizeof; 282 int byteCount3 = buffer3.length * TCHAR.sizeof;
283 auto lpstrTitle = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount3); 283 auto lpstrTitle = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount3);
284 OS.MoveMemory (lpstrTitle, buffer3.ptr, byteCount3); 284 OS.MoveMemory (lpstrTitle, buffer3.ptr, byteCount3);
285 285
286 /* Compute filters and copy into lpstrFilter */ 286 /* Compute filters and copy into lpstrFilter */
294 } 294 }
295 if (filterExtensions.length is 0) { 295 if (filterExtensions.length is 0) {
296 strFilter = strFilter ~ FILTER ~ '\0' ~ FILTER ~ '\0'; 296 strFilter = strFilter ~ FILTER ~ '\0' ~ FILTER ~ '\0';
297 } 297 }
298 /* Use the character encoding for the default locale */ 298 /* Use the character encoding for the default locale */
299 TCHAR[] buffer4 = StrToTCHARs (0, strFilter, true); 299 auto buffer4 = StrToTCHARs (0, strFilter, true);
300 int byteCount4 = buffer4.length * TCHAR.sizeof; 300 int byteCount4 = buffer4.length * TCHAR.sizeof;
301 auto lpstrFilter = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount4); 301 auto lpstrFilter = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount4);
302 OS.MoveMemory (lpstrFilter, buffer4.ptr, byteCount4); 302 OS.MoveMemory (lpstrFilter, buffer4.ptr, byteCount4);
303 303
304 /* Convert the fileName and filterName to C strings */ 304 /* Convert the fileName and filterName to C strings */
305 if (fileName is null) fileName = ""; 305 if (fileName is null) fileName = "";
306 /* Use the character encoding for the default locale */ 306 /* Use the character encoding for the default locale */
307 TCHAR[] name = StrToTCHARs (0, fileName, true); 307 auto name = StrToTCHARs (0, fileName, true);
308 308
309 /* 309 /*
310 * Copy the name into lpstrFile and ensure that the 310 * Copy the name into lpstrFile and ensure that the
311 * last byte is NULL and the buffer does not overrun. 311 * last byte is NULL and the buffer does not overrun.
312 */ 312 */
321 * Copy the path into lpstrInitialDir and ensure that 321 * Copy the path into lpstrInitialDir and ensure that
322 * the last byte is NULL and the buffer does not overrun. 322 * the last byte is NULL and the buffer does not overrun.
323 */ 323 */
324 if (filterPath is null) filterPath = ""; 324 if (filterPath is null) filterPath = "";
325 /* Use the character encoding for the default locale */ 325 /* Use the character encoding for the default locale */
326 TCHAR[] path = StrToTCHARs (0, filterPath.replace ('/', '\\'), true); 326 auto path = StrToTCHARs (0, filterPath.replace ('/', '\\'), true);
327 int byteCount5 = OS.MAX_PATH * TCHAR.sizeof; 327 int byteCount5 = OS.MAX_PATH * TCHAR.sizeof;
328 auto lpstrInitialDir = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount5); 328 auto lpstrInitialDir = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount5);
329 int byteCountDir = Math.min (path.length * TCHAR.sizeof, byteCount5 - TCHAR.sizeof); 329 int byteCountDir = Math.min (path.length * TCHAR.sizeof, byteCount5 - TCHAR.sizeof);
330 OS.MoveMemory (lpstrInitialDir, path.ptr, byteCountDir); 330 OS.MoveMemory (lpstrInitialDir, path.ptr, byteCountDir);
331 331