Ignore:
Timestamp:
Dec 18, 2011, 10:28:22 PM (14 years ago)
Author:
dmik
Message:

Merge branch gcc-kmk to trunk.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 bin
        2 Makefile.inc
         1env.cmd
         2LocalConfig.kmk
    • Property svn:mergeinfo set to
      /branches/gcc-kmkmergedeligible
  • trunk/src/kernel32/directory.cpp

    r21302 r21916  
    66 * Copyright 1998 Sander van Leeuwen
    77 *
    8  * NOTE: Directory creation has to be done in install program (odin\win) 
     8 * NOTE: Directory creation has to be done in install program (odin\win)
    99 *
    1010 * Parts based on Wine code (991031) (files\directory.c)
     
    1414 * Copyright 1995 Alexandre Julliard
    1515 *
    16  * TODO: 
     16 * TODO:
    1717 *  - System/window directories should be created by install program!
    1818 *
     
    3030#include <os2win.h>
    3131#include <stdlib.h>
     32#include <string.h>
     33#ifdef __GNUC__
     34#include <alloca.h>
     35#endif
    3236#include <unicode.h>
    3337#include <heapstring.h>
    3438#include <options.h>
    3539#include "initterm.h"
    36 #include <win\file.h>
    37 #include <string.h>
     40#include <win/file.h>
    3841#include "oslibdos.h"
    3942#include "profile.h"
     
    8083   len = strlen(DIR_System);
    8184   if(DIR_System[len-1] == '\\') {
    82         DIR_System[len-1] = 0; 
     85        DIR_System[len-1] = 0;
    8386   }
    8487   len = PROFILE_GetOdinIniString(ODINDIRECTORIES,"WINDOWS","",DIR_Windows,sizeof(DIR_Windows));
    8588   if (len > 2) {
    8689        if(DIR_Windows[len-1] == '\\') {
    87                 DIR_Windows[len-1] = 0; 
     90                DIR_Windows[len-1] = 0;
    8891        }
    8992   }
     
    116119   len = strlen(DIR_System);
    117120   if(DIR_System[len-1] == '\\') {
    118         DIR_System[len-1] = 0; 
     121        DIR_System[len-1] = 0;
    119122   }
    120123   strcpy(DIR_Windows, szWindowsDir);
    121124   len = strlen(DIR_Windows);
    122125   if(DIR_Windows[len-1] == '\\') {
    123         DIR_Windows[len-1] = 0; 
     126        DIR_Windows[len-1] = 0;
    124127   }
    125128
     
    146149  rc = OSLibDosQueryDir(nBufferLength, lpBuffer);
    147150  if(rc && rc < nBufferLength) {
    148        dprintf(("CurrentDirectory = %s (%d)", lpBuffer, rc)); 
    149   }
    150   else dprintf(("CurrentDirectory returned %d", rc)); 
     151       dprintf(("CurrentDirectory = %s (%d)", lpBuffer, rc));
     152  }
     153  else dprintf(("CurrentDirectory returned %d", rc));
    151154  return rc;
    152155}
     
    196199    return FALSE;
    197200  }
    198  
     201
    199202  // cut off trailing backslashes
    200203  // not if a process wants to change to the root directory
     
    204207       (len != 1) )
    205208  {
    206     LPSTR lpTemp = (LPSTR)_alloca(len);
     209    LPSTR lpTemp = (LPSTR)alloca(len);
    207210    lstrcpynA(lpTemp,
    208211              lpstrDirectory,
     
    264267
    265268  int len = strlen(lpstrDirectory);
    266  
     269
    267270  // cut off trailing backslashes
    268271  if ( (lpstrDirectory[len - 1] == '\\') ||
    269272       (lpstrDirectory[len - 1] == '/') )
    270273  {
    271     LPSTR lpTemp = (LPSTR)_alloca(len);
     274    LPSTR lpTemp = (LPSTR)alloca(len);
    272275    lstrcpynA(lpTemp,
    273276              lpstrDirectory,
     
    275278    lpstrDirectory = lpTemp;
    276279  }
    277  
     280
    278281  dprintf(("CreateDirectoryA %s", lpstrDirectory));
    279  
     282
    280283  // Creation of an existing directory will fail (verified in NT4 & XP)
    281284  DWORD dwAttr = GetFileAttributesA(lpstrDirectory);
    282   if(dwAttr != -1) 
     285  if(dwAttr != -1)
    283286  {
    284287      if (dwAttr & FILE_ATTRIBUTE_DIRECTORY)
     
    287290          return FALSE;
    288291      }
    289   } 
     292  }
    290293  return(OSLibDosCreateDirectory(lpstrDirectory));
    291294}
     
    437440    asciibuffer = (char *)alloca(uSize+1);
    438441
    439   if(lpBuffer && asciibuffer == NULL) 
     442  if(lpBuffer && asciibuffer == NULL)
    440443  {
    441444    DebugInt3();
     
    445448  if(rc && asciibuffer)
    446449    AsciiToUnicode(asciibuffer, lpBuffer);
    447  
     450
    448451  return(rc);
    449452}
     
    495498    asciibuffer = (char *)alloca(uSize+1);
    496499
    497   if(lpBuffer && asciibuffer == NULL) 
     500  if(lpBuffer && asciibuffer == NULL)
    498501  {
    499502    DebugInt3();
     
    503506  if(rc && asciibuffer)
    504507    AsciiToUnicode(asciibuffer, lpBuffer);
    505  
     508
    506509  return(rc);
    507510}
     
    524527{
    525528  int len = strlen(lpstrDirectory);
    526  
     529
    527530  if(lpstrDirectory == NULL) {
    528531     SetLastError(ERROR_INVALID_PARAMETER);
     
    533536       (lpstrDirectory[len - 1] == '/') )
    534537  {
    535     LPSTR lpTemp = (LPSTR)_alloca(len);
     538    LPSTR lpTemp = (LPSTR)alloca(len);
    536539    lstrcpynA(lpTemp,
    537540              lpstrDirectory,
     
    539542    lpstrDirectory = lpTemp;
    540543  }
    541  
     544
    542545  dprintf(("RemoveDirectory %s", lpstrDirectory));
    543546
     
    619622       those (according to SDK docs) */
    620623    if ((path != NULL) && strchr(path, ';')) {
    621         ret = OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)path, (LPSTR)name, 
     624        ret = OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)path, (LPSTR)name,
    622625                                 full_name, MAX_PATHNAME_LEN);
    623626        goto done;
     
    647650        name = tmp;
    648651    }
    649    
     652
    650653    /* If we have an explicit path, everything's easy */
    651654
     
    704707 *             filename is returned.
    705708 *    Failure: Zero
    706  * 
     709 *
    707710 * NOTES
    708711 *    Should call SetLastError(but currently doesn't).
     
    732735    LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
    733736    LPSTR extA  = HEAP_strdupWtoA( GetProcessHeap(), 0, ext );
    734  
     737
    735738    dprintf(("SearchPathA %s %s %s", pathA, nameA, extA));
    736739    DWORD ret = DIR_SearchPath( pathA, nameA, extA, (LPSTR)full_name );
    737  
     740
    738741    if (NULL != extA)
    739742      HeapFree( GetProcessHeap(), 0, extA );
    740  
     743
    741744    if (NULL != nameA)
    742745      HeapFree( GetProcessHeap(), 0, nameA );
    743  
     746
    744747    if (NULL != pathA)
    745748      HeapFree( GetProcessHeap(), 0, pathA );
    746  
     749
    747750    if (!ret) return 0;
    748751
Note: See TracChangeset for help on using the changeset viewer.