Changeset 21947 for trunk/src


Ignore:
Timestamp:
Jan 18, 2012, 8:23:03 PM (14 years ago)
Author:
dmik
Message:

Add MSVCRTtempnam() to minivcrt.lib.

This is mainly to replace _tempnam() broken in kLIBC (see #63)
that may be needed somewhere in the future. This commit also
fixes the MSVCRTtempnam() and _wtempnam() implementations
(the first argument to GetTempPath() cannot be NULL).

Location:
trunk/src/msvcrt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/msvcrt/dir.c

    r21916 r21947  
    634634}
    635635
     636#ifdef __EMX__
     637
     638/*
     639 * NOTE: _fullpath() is broken in kLIBC and changes CWD (see
     640 * http://svn.netlabs.org/odin32/ticket/63 for details). Enable the
     641 * alternative implementation.
     642 */
     643
    636644/*********************************************************************
    637645 *              _fullpath (MSVCRT.@)
     
    695703  return absPath;
    696704}
     705
     706#endif /* __EMX__ */
    697707
    698708#ifndef __MINIVCRT__
  • trunk/src/msvcrt/file.c

    r21916 r21947  
    14361436}
    14371437
     1438#endif /* !__MINIVCRT__ */
     1439
     1440#ifdef __EMX__
     1441
     1442/*
     1443 * NOTE: _fullpath() is broken in kLIBC and changes CWD (see
     1444 * http://svn.netlabs.org/odin32/ticket/63 for details). Enable the
     1445 * alternative implementation.
     1446 */
     1447
    14381448/*********************************************************************
    14391449 *              _tempnam (MSVCRT.@)
     
    14421452{
    14431453  char tmpbuf[MAX_PATH];
     1454  char tmpdir[MAX_PATH-14];
    14441455
    14451456  TRACE("dir (%s) prefix (%s)\n",dir,prefix);
    1446   if (GetTempFileNameA(dir,prefix,0,tmpbuf))
    1447   {
    1448     TRACE("got name (%s)\n",tmpbuf);
    1449     return MSVCRT__strdup(tmpbuf);
     1457  if (!dir)
     1458  {
     1459    if (GetTempPathA(sizeof(tmpdir), tmpdir))
     1460      dir = tmpdir;
     1461  }
     1462  if (dir)
     1463  {
     1464    if (GetTempFileNameA(dir,prefix,0,tmpbuf))
     1465    {
     1466      TRACE("got name (%s)\n",tmpbuf);
     1467      return MSVCRT(_strdup(tmpbuf));
     1468    }
    14501469  }
    14511470  TRACE("failed (%ld)\n",GetLastError());
     
    14531472}
    14541473
    1455 #endif /* !__MINIVCRT__ */
     1474#endif /* __EMX__ */
    14561475
    14571476/*********************************************************************
     
    14611480{
    14621481  MSVCRT_wchar_t tmpbuf[MAX_PATH];
     1482  MSVCRT_wchar_t tmpdir[MAX_PATH-14];
    14631483
    14641484  TRACE("dir (%s) prefix (%s)\n",debugstr_w(dir),debugstr_w(prefix));
    1465   if (GetTempFileNameW(dir,prefix,0,tmpbuf))
    1466   {
    1467     TRACE("got name (%s)\n",debugstr_w(tmpbuf));
    1468     return _wcsdup(tmpbuf);
     1485  if (!dir)
     1486  {
     1487    if (GetTempPathW(sizeof(tmpdir)/sizeof(wchar_t), tmpdir))
     1488      dir = tmpdir;
     1489  }
     1490  if (dir)
     1491  {
     1492    if (GetTempFileNameW(dir,prefix,0,tmpbuf))
     1493    {
     1494      TRACE("got name (%s)\n",debugstr_w(tmpbuf));
     1495      return _wcsdup(tmpbuf);
     1496    }
    14691497  }
    14701498  TRACE("failed (%ld)\n",GetLastError());
Note: See TracChangeset for help on using the changeset viewer.