Ignore:
Timestamp:
Sep 15, 2001, 11:26:26 AM (24 years ago)
Author:
sandervl
Message:

restored old version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comdlg32/filetitle.c

    r6708 r6709  
    1313#include "debugtools.h"
    1414
    15 #include "heap.h"   /* Has to go */
     15#include "heap.h"       /* Has to go */
    1616
    1717DEFAULT_DEBUG_CHANNEL(commdlg)
     
    2020
    2121/***********************************************************************
    22  *  GetFileTitleA       (COMDLG32.8)
     22 *      GetFileTitleA           (COMDLG32.8)
    2323 *
    2424 */
    2525short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
    2626{
    27     int i, len;
     27        int i, len;
    2828
    29     TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf);
     29        TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf);
    3030
    31     if(lpFile == NULL || lpTitle == NULL)
    32         return -1;
     31        if(lpFile == NULL || lpTitle == NULL)
     32                return -1;
    3333
    34     len = strlen(lpFile);
     34        len = strlen(lpFile);
    3535
    36     if (len == 0)
    37         return -1;
     36        if (len == 0)
     37                return -1;
    3838
    39     if(strpbrk(lpFile, "*[]"))
    40         return -1;
     39        if(strpbrk(lpFile, "*[]"))
     40                return -1;
    4141
    42     len--;
     42        len--;
    4343
    44     if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
    45         return -1;
     44        if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
     45                return -1;
    4646
    47     for(i = len; i >= 0; i--)
    48     {
    49         if (lpFile[i] == '/' ||  lpFile[i] == '\\' ||  lpFile[i] == ':')
    50         {
    51             i++;
    52             break;
    53         }
    54     }
     47        for(i = len; i >= 0; i--)
     48        {
     49                if (lpFile[i] == '/' ||  lpFile[i] == '\\' ||  lpFile[i] == ':')
     50                {
     51                        i++;
     52                        break;
     53                }
     54        }
    5555
    56     if(i == -1)
    57         i++;
     56        if(i == -1)
     57                i++;
    5858
    59     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;
    6064
    61     len = strlen(lpFile+i)+1;
    62     if(cbBuf < len)
    63         return len;
    64 
    65     strncpy(lpTitle, &lpFile[i], len);
    66     return 0;
     65        strncpy(lpTitle, &lpFile[i], len);
     66        return 0;
    6767}
    6868
    6969
    7070/***********************************************************************
    71  *  GetFileTitleW       (COMDLG32.9)
     71 *      GetFileTitleW           (COMDLG32.9)
    7272 *
    7373 */
    7474short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, UINT cbBuf)
    7575{
    76     LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);  /* Has to go */
    77     LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf);
    78     short   ret;
     76        LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);      /* Has to go */
     77        LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf);
     78        short   ret;
    7979
    80     ret = GetFileTitleA(file, title, cbBuf);
     80        ret = GetFileTitleA(file, title, cbBuf);
    8181
    82     lstrcpynAtoW(lpTitle, title, cbBuf);
    83     HeapFree(GetProcessHeap(), 0, file);
    84     HeapFree(GetProcessHeap(), 0, title);
    85     return ret;
     82        lstrcpynAtoW(lpTitle, title, cbBuf);
     83        HeapFree(GetProcessHeap(), 0, file);
     84        HeapFree(GetProcessHeap(), 0, title);
     85        return ret;
    8686}
    8787
     
    8989#ifndef __WIN32OS2__
    9090/***********************************************************************
    91  *  GetFileTitle16      (COMMDLG.27)
     91 *      GetFileTitle16          (COMMDLG.27)
    9292 */
    9393short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf)
    9494{
    95     return GetFileTitleA(lpFile, lpTitle, cbBuf);
     95        return GetFileTitleA(lpFile, lpTitle, cbBuf);
    9696}
    9797#endif
Note: See TracChangeset for help on using the changeset viewer.