src/os/windows/vm/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7104565 Sdiff src/os/windows/vm

src/os/windows/vm/os_windows.cpp

Print this page




4218         *dst++ = *src++;
4219         if (*src) *dst++ = *src++;
4220         end = dst;
4221       } else {         /* Copy a single-byte character */
4222         char c = *src++;
4223         *dst++ = c;
4224         /* Space is not a legal ending character */
4225         if (c != ' ') end = dst;
4226       }
4227     }
4228   }
4229 
4230   *end = '\0';
4231 
4232   /* For "z:", add "." to work around a bug in the C runtime library */
4233   if (colon == dst - 1) {
4234           path[2] = '.';
4235           path[3] = '\0';
4236   }
4237 
4238   #ifdef DEBUG
4239     jio_fprintf(stderr, "sysNativePath: %s\n", path);
4240   #endif DEBUG
4241   return path;
4242 }
4243 
4244 // This code is a copy of JDK's sysSetLength
4245 // from src/windows/hpi/src/sys_api_md.c
4246 
4247 int os::ftruncate(int fd, jlong length) {
4248   HANDLE h = (HANDLE)::_get_osfhandle(fd);
4249   long high = (long)(length >> 32);
4250   DWORD ret;
4251 
4252   if (h == (HANDLE)(-1)) {
4253     return -1;
4254   }
4255 
4256   ret = ::SetFilePointer(h, (long)(length), &high, FILE_BEGIN);
4257   if ((ret == 0xFFFFFFFF) && (::GetLastError() != NO_ERROR)) {
4258       return -1;
4259   }
4260 




4218         *dst++ = *src++;
4219         if (*src) *dst++ = *src++;
4220         end = dst;
4221       } else {         /* Copy a single-byte character */
4222         char c = *src++;
4223         *dst++ = c;
4224         /* Space is not a legal ending character */
4225         if (c != ' ') end = dst;
4226       }
4227     }
4228   }
4229 
4230   *end = '\0';
4231 
4232   /* For "z:", add "." to work around a bug in the C runtime library */
4233   if (colon == dst - 1) {
4234           path[2] = '.';
4235           path[3] = '\0';
4236   }
4237 



4238   return path;
4239 }
4240 
4241 // This code is a copy of JDK's sysSetLength
4242 // from src/windows/hpi/src/sys_api_md.c
4243 
4244 int os::ftruncate(int fd, jlong length) {
4245   HANDLE h = (HANDLE)::_get_osfhandle(fd);
4246   long high = (long)(length >> 32);
4247   DWORD ret;
4248 
4249   if (h == (HANDLE)(-1)) {
4250     return -1;
4251   }
4252 
4253   ret = ::SetFilePointer(h, (long)(length), &high, FILE_BEGIN);
4254   if ((ret == 0xFFFFFFFF) && (::GetLastError() != NO_ERROR)) {
4255       return -1;
4256   }
4257 


src/os/windows/vm/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File