Changeset 4511 for trunk/src/comdlg32/filetitle.c
- Timestamp:
- Oct 21, 2000, 8:42:42 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/filetitle.c
r3924 r4511 1 /* $Id: filetitle.c,v 1.3 2000-08-02 15:11:59 bird Exp $ */2 1 /* 3 2 * COMMDLG - File Dialogs … … 5 4 * Copyright 1994 Martin Ayotte 6 5 * Copyright 1996 Albrecht Kleine 7 *8 * Corel WINE 20000324 level9 6 */ 10 7 … … 16 13 #include "debugtools.h" 17 14 18 #include "heap.h" 15 #include "heap.h" /* Has to go */ 19 16 20 17 DEFAULT_DEBUG_CHANNEL(commdlg) … … 22 19 #include "cdlg.h" 23 20 24 #ifdef __WIN32OS2__25 #include <misc.h>26 #endif27 28 21 /*********************************************************************** 29 * GetFileTitleA(COMDLG32.8)22 * GetFileTitleA (COMDLG32.8) 30 23 * 31 24 */ 32 25 short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf) 33 26 { 34 27 int i, len; 35 28 36 29 TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf); 37 30 38 if(lpFile == NULL || (lpTitle == NULL))39 31 if(lpFile == NULL || lpTitle == NULL) 32 return -1; 40 33 41 34 len = strlen(lpFile); 42 35 43 44 36 if (len == 0) 37 return -1; 45 38 46 47 39 if(strpbrk(lpFile, "*[]")) 40 return -1; 48 41 49 42 len--; 50 43 51 52 44 if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':') 45 return -1; 53 46 54 55 56 57 58 59 60 61 47 for(i = len; i >= 0; i--) 48 { 49 if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':') 50 { 51 i++; 52 break; 53 } 54 } 62 55 63 64 56 if(i == -1) 57 i++; 65 58 66 TRACE("---> '%s' \n", &lpFile[i]); 59 TRACE("---> '%s' \n", &lpFile[i]); 60 61 len = strlen(lpFile+i)+1; 62 if(cbBuf < len) 63 return len; 67 64 68 len = strlen(lpFile+i)+1; 69 if(cbBuf < len) 70 return len; 71 72 strncpy(lpTitle,&lpFile[i],len); 73 return 0; 65 strncpy(lpTitle, &lpFile[i], len); 66 return 0; 74 67 } 75 68 76 69 77 70 /*********************************************************************** 78 * GetFileTitleW(COMDLG32.9)71 * GetFileTitleW (COMDLG32.9) 79 72 * 80 73 */ 81 74 short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, UINT cbBuf) 82 75 { 83 LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);/* Has to go */84 85 shortret;76 LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile); /* Has to go */ 77 LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf); 78 short ret; 86 79 87 80 ret = GetFileTitleA(file, title, cbBuf); 88 81 89 90 91 92 82 lstrcpynAtoW(lpTitle, title, cbBuf); 83 HeapFree(GetProcessHeap(), 0, file); 84 HeapFree(GetProcessHeap(), 0, title); 85 return ret; 93 86 } 94 87 95 88 89 #ifndef __WIN32OS2__ 96 90 /*********************************************************************** 97 * GetFileTitle16(COMMDLG.27)91 * GetFileTitle16 (COMMDLG.27) 98 92 */ 99 93 short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf) 100 94 { 101 95 return GetFileTitleA(lpFile, lpTitle, cbBuf); 102 96 } 97 #endif 103 98
Note:
See TracChangeset
for help on using the changeset viewer.