[libbluray-devel] Fixed pointer casts

hpi1 git at videolan.org
Tue Mar 5 10:49:13 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Mar  5 11:39:34 2013 +0200| [a81e77b0aabb143698c1dd079a8afb629bdf421b] | committer: hpi1

Fixed pointer casts

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=a81e77b0aabb143698c1dd079a8afb629bdf421b
---

 src/libbluray/bdj/bdj.c                           |    2 +-
 src/libbluray/bdj/native/java_awt_BDFontMetrics.c |   19 ++++---
 src/libbluray/bdj/native/java_awt_BDGraphics.c    |    7 ++-
 src/libbluray/bdj/native/org_videolan_Libbluray.c |   59 +++++++++++----------
 4 files changed, 47 insertions(+), 40 deletions(-)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 4c2eafd..2dbb763 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -217,7 +217,7 @@ BDJAVA* bdj_open(const char *path, struct bluray *bd,
         return NULL;
     }
 
-    fptr_JNI_CreateJavaVM JNI_CreateJavaVM_fp = (fptr_JNI_CreateJavaVM)dl_dlsym(jvm_lib, "JNI_CreateJavaVM");
+    fptr_JNI_CreateJavaVM JNI_CreateJavaVM_fp = (fptr_JNI_CreateJavaVM)(intptr_t)dl_dlsym(jvm_lib, "JNI_CreateJavaVM");
 
     if (JNI_CreateJavaVM_fp == NULL) {
         dl_dlclose(jvm_lib);
diff --git a/src/libbluray/bdj/native/java_awt_BDFontMetrics.c b/src/libbluray/bdj/native/java_awt_BDFontMetrics.c
index c72ceaa..26a25d4 100644
--- a/src/libbluray/bdj/native/java_awt_BDFontMetrics.c
+++ b/src/libbluray/bdj/native/java_awt_BDFontMetrics.c
@@ -187,8 +187,11 @@ Java_java_awt_BDFontMetrics_charsWidthN(JNIEnv * env, jobject obj, jlong ftFace,
 #endif /* HAVE_FT2 */
 }
 
-#define CC (char*)  /*cast a literal from (const char*)*/
+#define CC (char*)             /* cast a literal from (const char*) */
+#define VC (void*)(uintptr_t)  /* cast function pointer to void* */
+#if defined __GNUC__
 #pragma GCC diagnostic ignored "-Wcast-qual"
+#endif
 
 BD_PRIVATE CPP_EXTERN const JNINativeMethod
 Java_java_awt_BDFontMetrics_methods[] =
@@ -196,37 +199,37 @@ Java_java_awt_BDFontMetrics_methods[] =
     {
         CC("initN"),
         CC("()J"),
-        Java_java_awt_BDFontMetrics_initN,
+        VC(Java_java_awt_BDFontMetrics_initN),
     },
     {
         CC("destroyN"),
         CC("(J)V"),
-        Java_java_awt_BDFontMetrics_destroyN,
+        VC(Java_java_awt_BDFontMetrics_destroyN),
     },
     {
         CC("loadFontN"),
         CC("(JLjava/lang/String;I)J"),
-        Java_java_awt_BDFontMetrics_loadFontN,
+        VC(Java_java_awt_BDFontMetrics_loadFontN),
     },
     {
         CC("destroyFontN"),
         CC("(J)V"),
-        Java_java_awt_BDFontMetrics_destroyFontN,
+        VC(Java_java_awt_BDFontMetrics_destroyFontN),
     },
     {
         CC("charWidthN"),
         CC("(JC)I"),
-        Java_java_awt_BDFontMetrics_charWidthN,
+        VC(Java_java_awt_BDFontMetrics_charWidthN),
     },
     {
         CC("stringWidthN"),
         CC("(JLjava/lang/String;)I"),
-        Java_java_awt_BDFontMetrics_stringWidthN,
+        VC(Java_java_awt_BDFontMetrics_stringWidthN),
     },
     {
         CC("charsWidthN"),
         CC("(J[CII)I"),
-        Java_java_awt_BDFontMetrics_charsWidthN,
+        VC(Java_java_awt_BDFontMetrics_charsWidthN),
     },
 };
 
diff --git a/src/libbluray/bdj/native/java_awt_BDGraphics.c b/src/libbluray/bdj/native/java_awt_BDGraphics.c
index 58e903f..6ed889a 100644
--- a/src/libbluray/bdj/native/java_awt_BDGraphics.c
+++ b/src/libbluray/bdj/native/java_awt_BDGraphics.c
@@ -91,8 +91,11 @@ Java_java_awt_BDGraphics_drawStringN(JNIEnv * env, jobject obj, jlong ftFace, js
 #endif /* HAVE_FT2 */
 }
 
-#define CC (char*)  /*cast a literal from (const char*)*/
+#define CC (char*)             /* cast a literal from (const char*) */
+#define VC (void*)(uintptr_t)  /* cast function pointer to void* */
+#if defined __GNUC__
 #pragma GCC diagnostic ignored "-Wcast-qual"
+#endif
 
 BD_PRIVATE CPP_EXTERN const JNINativeMethod
 Java_java_awt_BDGraphics_methods[] =
@@ -100,7 +103,7 @@ Java_java_awt_BDGraphics_methods[] =
     {
         CC("drawStringN"),
         CC("(JLjava/lang/String;III)V"),
-        Java_java_awt_BDGraphics_drawStringN,
+        VC(Java_java_awt_BDGraphics_drawStringN),
     },
 };
 
diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.c b/src/libbluray/bdj/native/org_videolan_Libbluray.c
index 03a14c3..6723b69 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.c
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.c
@@ -445,7 +445,8 @@ JNIEXPORT void JNICALL Java_org_videolan_Libbluray_updateGraphicN(JNIEnv * env,
     }
 }
 
-#define CC (char*)  /*cast a literal from (const char*)*/
+#define CC (char*)             /* cast a literal from (const char*) */
+#define VC (void*)(uintptr_t)  /* cast function pointer to void* */
 #if defined __GNUC__
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
@@ -456,142 +457,142 @@ Java_org_videolan_Libbluray_methods[] =
     {
         CC("getVolumeIDN"),
         CC("(J)[B"),
-        Java_org_videolan_Libbluray_getVolumeIDN,
+        VC(Java_org_videolan_Libbluray_getVolumeIDN),
     },
     {
         CC("getPMSNN"),
         CC("(J)[B"),
-        Java_org_videolan_Libbluray_getPMSNN,
+        VC(Java_org_videolan_Libbluray_getPMSNN),
     },
     {
         CC("getTitleInfoN"),
         CC("(JI)Lorg/videolan/TitleInfo;"),
-        Java_org_videolan_Libbluray_getTitleInfoN,
+        VC(Java_org_videolan_Libbluray_getTitleInfoN),
     },
     {
         CC("getPlaylistInfoN"),
         CC("(JI)Lorg/videolan/PlaylistInfo;"),
-        Java_org_videolan_Libbluray_getPlaylistInfoN,
+        VC(Java_org_videolan_Libbluray_getPlaylistInfoN),
     },
     {
         CC("getTitlesN"),
         CC("(J)I"),
-        Java_org_videolan_Libbluray_getTitlesN,
+        VC(Java_org_videolan_Libbluray_getTitlesN),
     },
     {
         CC("seekN"),
         CC("(JJ)J"),
-        Java_org_videolan_Libbluray_seekN,
+        VC(Java_org_videolan_Libbluray_seekN),
     },
     {
         CC("seekTimeN"),
         CC("(JJ)J"),
-        Java_org_videolan_Libbluray_seekTimeN,
+        VC(Java_org_videolan_Libbluray_seekTimeN),
     },
     {
         CC("seekChapterN"),
         CC("(JI)J"),
-        Java_org_videolan_Libbluray_seekChapterN,
+        VC(Java_org_videolan_Libbluray_seekChapterN),
     },
     {
         CC("chapterPosN"),
         CC("(JI)J"),
-        Java_org_videolan_Libbluray_chapterPosN,
+        VC(Java_org_videolan_Libbluray_chapterPosN),
     },
     {
         CC("getCurrentChapterN"),
         CC("(J)I"),
-        Java_org_videolan_Libbluray_getCurrentChapterN,
+        VC(Java_org_videolan_Libbluray_getCurrentChapterN),
     },
     {
         CC("seekMarkN"),
         CC("(JI)J"),
-        Java_org_videolan_Libbluray_seekMarkN,
+        VC(Java_org_videolan_Libbluray_seekMarkN),
     },
     {
         CC("seekPlayItemN"),
         CC("(JI)J"),
-        Java_org_videolan_Libbluray_seekPlayItemN,
+        VC(Java_org_videolan_Libbluray_seekPlayItemN),
     },
     {
         CC("selectPlaylistN"),
         CC("(JI)I"),
-        Java_org_videolan_Libbluray_selectPlaylistN,
+        VC(Java_org_videolan_Libbluray_selectPlaylistN),
     },
     {
         CC("selectTitleN"),
         CC("(JI)I"),
-        Java_org_videolan_Libbluray_selectTitleN,
+        VC(Java_org_videolan_Libbluray_selectTitleN),
     },
     {
         CC("selectAngleN"),
         CC("(JI)I"),
-        Java_org_videolan_Libbluray_selectAngleN,
+        VC(Java_org_videolan_Libbluray_selectAngleN),
     },
     {
         CC("seamlessAngleChangeN"),
         CC("(JI)V"),
-        Java_org_videolan_Libbluray_seamlessAngleChangeN,
+        VC(Java_org_videolan_Libbluray_seamlessAngleChangeN),
     },
     {
         CC("getTitleSizeN"),
         CC("(J)J"),
-        Java_org_videolan_Libbluray_getTitleSizeN,
+        VC(Java_org_videolan_Libbluray_getTitleSizeN),
     },
     {
         CC("getCurrentTitleN"),
         CC("(J)I"),
-        Java_org_videolan_Libbluray_getCurrentTitleN,
+        VC(Java_org_videolan_Libbluray_getCurrentTitleN),
     },
     {
         CC("getCurrentAngleN"),
         CC("(J)I"),
-        Java_org_videolan_Libbluray_getCurrentAngleN,
+        VC(Java_org_videolan_Libbluray_getCurrentAngleN),
     },
     {
         CC("tellN"),
         CC("(J)J"),
-        Java_org_videolan_Libbluray_tellN,
+        VC(Java_org_videolan_Libbluray_tellN),
     },
     {
         CC("tellTimeN"),
         CC("(J)J"),
-        Java_org_videolan_Libbluray_tellTimeN,
+        VC(Java_org_videolan_Libbluray_tellTimeN),
     },
     {
         CC("selectRateN"),
         CC("(JF)I"),
-        Java_org_videolan_Libbluray_selectRateN,
+        VC(Java_org_videolan_Libbluray_selectRateN),
     },
     {
         CC("writeGPRN"),
         CC("(JII)I"),
-        Java_org_videolan_Libbluray_writeGPRN,
+        VC(Java_org_videolan_Libbluray_writeGPRN),
     },
     {
         CC("writePSRN"),
         CC("(JII)I"),
-        Java_org_videolan_Libbluray_writePSRN,
+        VC(Java_org_videolan_Libbluray_writePSRN),
     },
     {
         CC("readGPRN"),
         CC("(JI)I"),
-        Java_org_videolan_Libbluray_readGPRN,
+        VC(Java_org_videolan_Libbluray_readGPRN),
     },
     {
         CC("readPSRN"),
         CC("(JI)I"),
-        Java_org_videolan_Libbluray_readPSRN,
+        VC(Java_org_videolan_Libbluray_readPSRN),
     },
     {
         CC("getBdjoN"),
         CC("(JLjava/lang/String;)Lorg/videolan/bdjo/Bdjo;"),
-        Java_org_videolan_Libbluray_getBdjoN,
+        VC(Java_org_videolan_Libbluray_getBdjoN),
     },
     {
         CC("updateGraphicN"),
         CC("(JII[I)V"),
-        Java_org_videolan_Libbluray_updateGraphicN,
+        VC(Java_org_videolan_Libbluray_updateGraphicN),
     },
 };
 



More information about the libbluray-devel mailing list