hotspot/src/share/vm/runtime/java.cpp
changeset 27471 6e56277909f1
parent 27157 364276bc8d8b
child 29208 b570d043f295
equal deleted inserted replaced
27467:cdc1d5bc86cf 27471:6e56277909f1
   703     return (e > o) ? 1 : ((e == o) ? 0 : -1);
   703     return (e > o) ? 1 : ((e == o) ? 0 : -1);
   704   }
   704   }
   705 }
   705 }
   706 
   706 
   707 void JDK_Version::to_string(char* buffer, size_t buflen) const {
   707 void JDK_Version::to_string(char* buffer, size_t buflen) const {
       
   708   assert(buffer && buflen > 0, "call with useful buffer");
   708   size_t index = 0;
   709   size_t index = 0;
       
   710 
   709   if (!is_valid()) {
   711   if (!is_valid()) {
   710     jio_snprintf(buffer, buflen, "%s", "(uninitialized)");
   712     jio_snprintf(buffer, buflen, "%s", "(uninitialized)");
   711   } else if (is_partially_initialized()) {
   713   } else if (is_partially_initialized()) {
   712     jio_snprintf(buffer, buflen, "%s", "(uninitialized) pre-1.6.0");
   714     jio_snprintf(buffer, buflen, "%s", "(uninitialized) pre-1.6.0");
   713   } else {
   715   } else {
   714     index += jio_snprintf(
   716     int rc = jio_snprintf(
   715         &buffer[index], buflen - index, "%d.%d", _major, _minor);
   717         &buffer[index], buflen - index, "%d.%d", _major, _minor);
       
   718     if (rc == -1) return;
       
   719     index += rc;
   716     if (_micro > 0) {
   720     if (_micro > 0) {
   717       index += jio_snprintf(&buffer[index], buflen - index, ".%d", _micro);
   721       rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _micro);
   718     }
   722     }
   719     if (_update > 0) {
   723     if (_update > 0) {
   720       index += jio_snprintf(&buffer[index], buflen - index, "_%02d", _update);
   724       rc = jio_snprintf(&buffer[index], buflen - index, "_%02d", _update);
       
   725       if (rc == -1) return;
       
   726       index += rc;
   721     }
   727     }
   722     if (_special > 0) {
   728     if (_special > 0) {
   723       index += jio_snprintf(&buffer[index], buflen - index, "%c", _special);
   729       rc = jio_snprintf(&buffer[index], buflen - index, "%c", _special);
       
   730       if (rc == -1) return;
       
   731       index += rc;
   724     }
   732     }
   725     if (_build > 0) {
   733     if (_build > 0) {
   726       index += jio_snprintf(&buffer[index], buflen - index, "-b%02d", _build);
   734       rc = jio_snprintf(&buffer[index], buflen - index, "-b%02d", _build);
   727     }
   735       if (rc == -1) return;
   728   }
   736       index += rc;
   729 }
   737     }
       
   738   }
       
   739 }