< prev index next >

src/hotspot/os/windows/os_windows.cpp

Print this page




4527   ov.OffsetHigh = (DWORD)(offset >> 32);
4528 
4529   HANDLE h = (HANDLE)::_get_osfhandle(fd);
4530 
4531   result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov);
4532 
4533   return result ? nread : 0;
4534 }
4535 
4536 
4537 // This method is a slightly reworked copy of JDK's sysNativePath
4538 // from src/windows/hpi/src/path_md.c
4539 
4540 // Convert a pathname to native format.  On win32, this involves forcing all
4541 // separators to be '\\' rather than '/' (both are legal inputs, but Win95
4542 // sometimes rejects '/') and removing redundant separators.  The input path is
4543 // assumed to have been converted into the character encoding used by the local
4544 // system.  Because this might be a double-byte encoding, care is taken to
4545 // treat double-byte lead characters correctly.
4546 //



4547 // This procedure modifies the given path in place, as the result is never
4548 // longer than the original.  There is no error return; this operation always
4549 // succeeds.
4550 char * os::native_path(char *path) {
4551   char *src = path, *dst = path, *end = path;
4552   char *colon = NULL;  // If a drive specifier is found, this will
4553                        // point to the colon following the drive letter
4554 
4555   // Assumption: '/', '\\', ':', and drive letters are never lead bytes
4556   assert(((!::IsDBCSLeadByte('/')) && (!::IsDBCSLeadByte('\\'))
4557           && (!::IsDBCSLeadByte(':'))), "Illegal lead byte");
4558 
4559   // Check for leading separators
4560 #define isfilesep(c) ((c) == '/' || (c) == '\\')
4561   while (isfilesep(*src)) {
4562     src++;
4563   }
4564 
4565   if (::isalpha(*src) && !::IsDBCSLeadByte(*src) && src[1] == ':') {
4566     // Remove leading separators if followed by drive specifier.  This




4527   ov.OffsetHigh = (DWORD)(offset >> 32);
4528 
4529   HANDLE h = (HANDLE)::_get_osfhandle(fd);
4530 
4531   result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov);
4532 
4533   return result ? nread : 0;
4534 }
4535 
4536 
4537 // This method is a slightly reworked copy of JDK's sysNativePath
4538 // from src/windows/hpi/src/path_md.c
4539 
4540 // Convert a pathname to native format.  On win32, this involves forcing all
4541 // separators to be '\\' rather than '/' (both are legal inputs, but Win95
4542 // sometimes rejects '/') and removing redundant separators.  The input path is
4543 // assumed to have been converted into the character encoding used by the local
4544 // system.  Because this might be a double-byte encoding, care is taken to
4545 // treat double-byte lead characters correctly.
4546 //
4547 // On Posix platforms, this function is a noop; it just returns the
4548 // input argument unchanged.
4549 //
4550 // This procedure modifies the given path in place, as the result is never
4551 // longer than the original.  There is no error return; this operation always
4552 // succeeds.
4553 char * os::native_path(char *path) {
4554   char *src = path, *dst = path, *end = path;
4555   char *colon = NULL;  // If a drive specifier is found, this will
4556                        // point to the colon following the drive letter
4557 
4558   // Assumption: '/', '\\', ':', and drive letters are never lead bytes
4559   assert(((!::IsDBCSLeadByte('/')) && (!::IsDBCSLeadByte('\\'))
4560           && (!::IsDBCSLeadByte(':'))), "Illegal lead byte");
4561 
4562   // Check for leading separators
4563 #define isfilesep(c) ((c) == '/' || (c) == '\\')
4564   while (isfilesep(*src)) {
4565     src++;
4566   }
4567 
4568   if (::isalpha(*src) && !::IsDBCSLeadByte(*src) && src[1] == ':') {
4569     // Remove leading separators if followed by drive specifier.  This


< prev index next >