- Timestamp:
- Jan 9, 2011, 11:42:41 PM (15 years ago)
- Location:
- trunk/src/msvcrt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/msvcrt/dir.c
r21542 r21550 65 65 66 66 #ifdef __EMX__ 67 // restore the EMX version of _fullpath 68 #undef _fullpath 67 #include <direct.h> 69 68 #endif 70 69 … … 572 571 } 573 572 } 574 575 #ifndef __MINIVCRT__576 573 577 574 /* INTERNAL: Helper for _fullpath. Modified PD code from 'snippets'. */ … … 689 686 690 687 if (!relPath || !*relPath) 691 return MSVCRT __getcwd(absPath, size);688 return MSVCRT(_getcwd)(absPath, size); 692 689 693 690 if (size < 4) 694 691 { 695 *MSVCRT__errno() = MSVCRT _ERANGE;692 *MSVCRT__errno() = MSVCRT(ERANGE); 696 693 return NULL; 697 694 } … … 728 725 729 726 if (!absPath) 730 return MSVCRT __strdup(res);727 return MSVCRT(_strdup(res)); 731 728 strcpy(absPath,res); 732 729 return absPath; 733 730 } 731 732 #ifndef __MINIVCRT__ 734 733 735 734 /********************************************************************* … … 774 773 TRACE("returning %s\n",path); 775 774 } 776 777 #else /* !__MINIVCRT__ */778 779 #ifdef __EMX__780 781 // The EMX version of _fullpath() returns int instead of char* and implicitly782 // changes the current drive. It also doesn't expect absPath to be NULL and783 // allocate a buffer in this case. Provide a wrapper to fix these issues.784 char *MSVCRT__fullpath(char * absPath, const char* relPath, unsigned int size)785 {786 char *buf = NULL;787 if (absPath == NULL)788 {789 size = PATH_MAX;790 absPath = buf = (char *)MSVCRT_malloc(size);791 if (buf == NULL)792 {793 *MSVCRT__errno() = ENOMEM;794 return NULL;795 }796 }797 798 int d = _getdrive();799 char *result = _fullpath(absPath, relPath, size) == 0 ? absPath : NULL;800 _chdrive(d);801 802 if (result == NULL && buf != NULL)803 MSVCRT_free(buf);804 805 return result;806 }807 808 #endif /* EMX */809 775 810 776 #endif /* !__MINIVCRT__ */ -
trunk/src/msvcrt/minivcrt_internal.h
r21506 r21550 27 27 #define MSVCRT__errno _errno 28 28 #define MSVCRT__getdrive _getdrive 29 #ifndef __EMX__30 #define MSVCRT__fullpath _fullpath31 #endif32 29 33 30 #define MSVCRT_malloc malloc
Note:
See TracChangeset
for help on using the changeset viewer.