Changeset 3386


Ignore:
Timestamp:
Jun 10, 2007, 1:56:39 PM (18 years ago)
Author:
bird
Message:

Added SafeDosQueryAppType and SafeWinUpper (both untested).

Location:
branches/libc-0.6/src/emx
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/include/os2safe.h

    r1757 r3386  
    4242#define DosSetDateTime          SafeDosSetDateTime
    4343#define DosStartSession         SafeDosStartSession
     44#define DosQueryAppType         SafeDosQueryAppType
     45#define DosWinUpper             SafeDosWinUpper
    4446
    4547#endif
  • branches/libc-0.6/src/emx/src/libos2/safe/SafeDosQueryAppType.c

    r3345 r3386  
    22/** @file
    33 *
    4  * SafeDosDupHandle()
     4 * SafeDosQueryAppType()
    55 *
    6  * Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net>
     6 * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
    77 *
    88 *
     
    2727
    2828
    29 ULONG APIENTRY SafeDosDupHandle(HFILE hFile, PHFILE phFile);
    30 ULONG APIENTRY SafeDosDupHandle(HFILE hFile, PHFILE phFile)
     29ULONG APIENTRY SafeDosQueryAppType(PCSZ pszName, PULONG pulFlags);
     30ULONG APIENTRY SafeDosQueryAppType(PCSZ pszName, PULONG pulFlags)
    3131{
    32     ULONG rc;
    33     HFILE   hf1;
    34     PHFILE  phf1 = NULL;
     32    ULONG   rc;
     33    ULONG   ful1;
     34    PULONG  pful1 = NULL;
     35    SAFE_PCSZ(pszName);
    3536
    36     if (phFile)
     37    if (pulFlags)
    3738    {
    38         hf1 = *phFile;
    39         phf1 = &hf1;
     39        ful1 = *pulFlags;
     40        pful1 = &ful1;
    4041    }
    4142
    42     rc = DosDupHandle(hFile, phf1);
     43    rc = DosQueryAppType(SAFE_PCSZ_USE(pszName), pful1);
    4344
    44     if (phFile)
    45         *phFile = hf1;
     45    if (pulFlags)
     46        *pulFlags = ful1;
    4647
     48    SAFE_PCSZ_DONE(pszName);
     49    SAFE_DOS_FAILURE();
    4750    return rc;
    4851}
  • branches/libc-0.6/src/emx/src/libos2/safe/SafeWinUpper.c

    r3345 r3386  
    22/** @file
    33 *
    4  * SafeDosDupHandle()
     4 * SafeWinUpper()
    55 *
    66 * Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net>
     
    2323 */
    2424
    25 #define INCL_BASE
     25#define INCL_PM
    2626#include <os2.h>
     27#include "safe.h"
    2728
    28 
    29 ULONG APIENTRY SafeDosDupHandle(HFILE hFile, PHFILE phFile);
    30 ULONG APIENTRY SafeDosDupHandle(HFILE hFile, PHFILE phFile)
     29ULONG APIENTRY SafeWinUpper(HAB hab, ULONG idcp, ULONG idcc, PSZ psz);
     30ULONG APIENTRY SafeWinUpper(HAB hab, ULONG idcp, ULONG idcc, PSZ psz)
    3131{
    3232    ULONG rc;
    33     HFILE   hf1;
    34     PHFILE  phf1 = NULL;
    35 
    36     if (phFile)
     33    if (SAFE_IS_HIGH(psz))
    3734    {
    38         hf1 = *phFile;
    39         phf1 = &hf1;
     35        size_t cch = strlen(psz);
     36        char *pszTmp = _lmalloc(cch + 3);
     37        if (pszTmp)
     38        {
     39            memcpy(pszTmp, psz, cch + 1);
     40            pszTmp[cch + 1] = '\0';
     41            pszTmp[cch + 2] = '\0';
     42            rc = WinUpper(hab, idcp, idcc, pszTmp);
     43            if (rc > 0)
     44                memcpy(psz, pszTmp, rc <= cch ? rc + 1 : rc);
     45            free(pszTmp);
     46        }
     47        else
     48        {
     49            PSZ pszStart = psz;
     50            while (*psz)
     51            {
     52                PSZ pszNext = WinNextChar(hab, idcp, idcc, psz);
     53                if (pszNext - psz == 1)
     54                    *psz = WinUpperChar(hab, idcp, idcc, *psz);
     55                else if (pszNext - psz == 2)
     56                    *(PUSHORT)psz = WinUpperChar(hab, idcp, idcc, *(PUSHORT)psz); /* a wild guess. */
     57                else
     58                    break;
     59                psz = pszNext;
     60            }
     61            rc = psz - pszStart;
     62        }
    4063    }
    41 
    42     rc = DosDupHandle(hFile, phf1);
    43 
    44     if (phFile)
    45         *phFile = hf1;
    46 
     64    else
     65        rc = WinUpper(hab, idcp, idcc, psz);
    4766    return rc;
    4867}
Note: See TracChangeset for help on using the changeset viewer.