src/hotspot/share/runtime/java.cpp
changeset 59045 846fee5ea75e
parent 58842 6c255334120d
equal deleted inserted replaced
59044:8c9d0451433b 59045:846fee5ea75e
   731   uint64_t e = encode_jdk_version(*this);
   731   uint64_t e = encode_jdk_version(*this);
   732   uint64_t o = encode_jdk_version(other);
   732   uint64_t o = encode_jdk_version(other);
   733   return (e > o) ? 1 : ((e == o) ? 0 : -1);
   733   return (e > o) ? 1 : ((e == o) ? 0 : -1);
   734 }
   734 }
   735 
   735 
       
   736 /* See JEP 223 */
   736 void JDK_Version::to_string(char* buffer, size_t buflen) const {
   737 void JDK_Version::to_string(char* buffer, size_t buflen) const {
   737   assert(buffer && buflen > 0, "call with useful buffer");
   738   assert(buffer && buflen > 0, "call with useful buffer");
   738   size_t index = 0;
   739   size_t index = 0;
   739 
   740 
   740   if (!is_valid()) {
   741   if (!is_valid()) {
   742   } else {
   743   } else {
   743     int rc = jio_snprintf(
   744     int rc = jio_snprintf(
   744         &buffer[index], buflen - index, "%d.%d", _major, _minor);
   745         &buffer[index], buflen - index, "%d.%d", _major, _minor);
   745     if (rc == -1) return;
   746     if (rc == -1) return;
   746     index += rc;
   747     index += rc;
   747     if (_security > 0) {
   748     if (_patch > 0) {
   748       rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _security);
   749       rc = jio_snprintf(&buffer[index], buflen - index, ".%d.%d", _security, _patch);
   749       if (rc == -1) return;
   750       if (rc == -1) return;
   750       index += rc;
   751       index += rc;
   751     }
   752     } else if (_security > 0) {
   752     if (_patch > 0) {
   753       rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _security);
   753       rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _patch);
       
   754       if (rc == -1) return;
   754       if (rc == -1) return;
   755       index += rc;
   755       index += rc;
   756     }
   756     }
   757     if (_build > 0) {
   757     if (_build > 0) {
   758       rc = jio_snprintf(&buffer[index], buflen - index, "+%d", _build);
   758       rc = jio_snprintf(&buffer[index], buflen - index, "+%d", _build);