src/os/windows/vm/os_windows.cpp

Print this page




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




4207         *dst++ = *src++;
4208         if (*src) *dst++ = *src++;
4209         end = dst;
4210       } else {         /* Copy a single-byte character */
4211         char c = *src++;
4212         *dst++ = c;
4213         /* Space is not a legal ending character */
4214         if (c != ' ') end = dst;
4215       }
4216     }
4217   }
4218 
4219   *end = '\0';
4220 
4221   /* For "z:", add "." to work around a bug in the C runtime library */
4222   if (colon == dst - 1) {
4223           path[2] = '.';
4224           path[3] = '\0';
4225   }
4226 



4227   return path;
4228 }
4229 
4230 // This code is a copy of JDK's sysSetLength
4231 // from src/windows/hpi/src/sys_api_md.c
4232 
4233 int os::ftruncate(int fd, jlong length) {
4234   HANDLE h = (HANDLE)::_get_osfhandle(fd);
4235   long high = (long)(length >> 32);
4236   DWORD ret;
4237 
4238   if (h == (HANDLE)(-1)) {
4239     return -1;
4240   }
4241 
4242   ret = ::SetFilePointer(h, (long)(length), &high, FILE_BEGIN);
4243   if ((ret == 0xFFFFFFFF) && (::GetLastError() != NO_ERROR)) {
4244       return -1;
4245   }
4246