< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page




2661   // So long as UTF8::convert_to_utf8 returns resource strings, we don't have to do anything
2662 JVM_END
2663 
2664 
2665 JVM_ENTRY(jboolean, JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2))
2666   JVMWrapper("JVM_IsSameClassPackage");
2667   oop class1_mirror = JNIHandles::resolve_non_null(class1);
2668   oop class2_mirror = JNIHandles::resolve_non_null(class2);
2669   Klass* klass1 = java_lang_Class::as_Klass(class1_mirror);
2670   Klass* klass2 = java_lang_Class::as_Klass(class2_mirror);
2671   return (jboolean) Reflection::is_same_class_package(klass1, klass2);
2672 JVM_END
2673 
2674 // Printing support //////////////////////////////////////////////////
2675 extern "C" {
2676 
2677 ATTRIBUTE_PRINTF(3, 0)
2678 int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
2679   // Reject count values that are negative signed values converted to
2680   // unsigned; see bug 4399518, 4417214
2681   if ((intptr_t)count <= 0) return -1;
2682 
2683   int result = os::vsnprintf(str, count, fmt, args);
2684   if (result > 0 && (size_t)result >= count) {
2685     result = -1;
2686   }
2687 
2688   return result;
2689 }
2690 
2691 ATTRIBUTE_PRINTF(3, 4)
2692 int jio_snprintf(char *str, size_t count, const char *fmt, ...) {
2693   va_list args;
2694   int len;
2695   va_start(args, fmt);
2696   len = jio_vsnprintf(str, count, fmt, args);
2697   va_end(args);
2698   return len;
2699 }
2700 
2701 ATTRIBUTE_PRINTF(2, 3)
2702 int jio_fprintf(FILE* f, const char *fmt, ...) {
2703   int len;
2704   va_list args;




2661   // So long as UTF8::convert_to_utf8 returns resource strings, we don't have to do anything
2662 JVM_END
2663 
2664 
2665 JVM_ENTRY(jboolean, JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2))
2666   JVMWrapper("JVM_IsSameClassPackage");
2667   oop class1_mirror = JNIHandles::resolve_non_null(class1);
2668   oop class2_mirror = JNIHandles::resolve_non_null(class2);
2669   Klass* klass1 = java_lang_Class::as_Klass(class1_mirror);
2670   Klass* klass2 = java_lang_Class::as_Klass(class2_mirror);
2671   return (jboolean) Reflection::is_same_class_package(klass1, klass2);
2672 JVM_END
2673 
2674 // Printing support //////////////////////////////////////////////////
2675 extern "C" {
2676 
2677 ATTRIBUTE_PRINTF(3, 0)
2678 int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
2679   // Reject count values that are negative signed values converted to
2680   // unsigned; see bug 4399518, 4417214
2681   if ((intptr_t)count < 0) return -1;
2682 
2683   int result = os::vsnprintf(str, count, fmt, args);
2684   if (count > 0 && result > 0 && (size_t)result >= count) {
2685     result = -1;
2686   }
2687 
2688   return result;
2689 }
2690 
2691 ATTRIBUTE_PRINTF(3, 4)
2692 int jio_snprintf(char *str, size_t count, const char *fmt, ...) {
2693   va_list args;
2694   int len;
2695   va_start(args, fmt);
2696   len = jio_vsnprintf(str, count, fmt, args);
2697   va_end(args);
2698   return len;
2699 }
2700 
2701 ATTRIBUTE_PRINTF(2, 3)
2702 int jio_fprintf(FILE* f, const char *fmt, ...) {
2703   int len;
2704   va_list args;


< prev index next >