Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pygame's portmidi to 2.0.4 #317

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

MateusRodCosta
Copy link
Contributor

Fixes #316

Tested as working when building against fdo 23.08

Tested as working when building against fdo 23.08
@MateusRodCosta MateusRodCosta requested a review from a team as a code owner September 11, 2024 23:40
@bbhtt
Copy link
Contributor

bbhtt commented Sep 12, 2024

More work is needed to get pygame building on 24.08:

src_c/font.c:584:12: error: assignment to ‘Uint16 *’ {aka ‘short unsigned int *’} from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]
  584 |     buffer = Bytes_AS_STRING(obj);
      |            ^
In file included from src_c/pygame.h:32,
                 from src_c/font.c:32:
src_c/font.c: In function ‘font_init’:

And this is only one, there are several other errors that need to be fixed.

diff --git a/src_c/font.c b/src_c/font.c
index a6b6cd5..62ebc44 100644
--- a/src_c/font.c
+++ b/src_c/font.c
@@ -581,7 +581,7 @@ font_metrics(PyObject *self, PyObject *args)
         Py_DECREF(obj);
         return NULL;
     }
-    buffer = Bytes_AS_STRING(obj);
+    buffer = (Uint16 *)Bytes_AS_STRING(obj);
     length = Bytes_GET_SIZE(obj) / sizeof(Uint16);
     for (i = 1 /* skip BOM */; i < length; i++) {
         ch = buffer[i];
diff --git a/src_c/pypm.pyx b/src_c/pypm.pyx
index d66e7a1..5b1cfe0 100644
--- a/src_c/pypm.pyx
+++ b/src_c/pypm.pyx
@@ -103,7 +103,7 @@ cdef extern from "portmidi.h":
                          PmDeviceID inputDevice,
                          void *inputDriverInfo,
                          long bufferSize,
-                         long (*PmPtr) (), # long = PtTimestamp
+                         PmTimeProcPtr time_proc, # long = PtTimestamp
                          void *time_info)
 
     PmError Pm_OpenOutput(PortMidiStream** stream,
@@ -522,11 +522,14 @@ cdef class Input:
         """Instantiate MIDI input stream object."""
 
         cdef PmError err
+        cdef PmTimeProcPtr PmPtr
         self.device = input_device
         self.debug = 0
 
+        PmPtr = <PmTimeProcPtr>&Pt_Time
+
         err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
-                           &Pt_Time, NULL)
+                           PmPtr, NULL)
         if err < 0:
             raise Exception(Pm_GetErrorText(err))
 
diff --git a/src_c/scrap_x11.c b/src_c/scrap_x11.c
index e9a982a..039453b 100644
--- a/src_c/scrap_x11.c
+++ b/src_c/scrap_x11.c
@@ -795,7 +795,7 @@ pygame_scrap_get_types(void)
 #if PY3
         PyObject *chars;
 #endif
-        int pos = 0;
+        Py_ssize_t pos = 0;
         int i = 0;
         PyObject *dict =
             (_currentmode == SCRAP_SELECTION) ? _selectiondata : _clipdata;

will handle some of them

@MateusRodCosta
Copy link
Contributor Author

Well, I believe I will build dtipbijays with my own fork of shared-modules and fdo runtime.
Sorry, but I am not that good at C to contribute with patches for the compilation errors.

@bbhtt bbhtt merged commit 88c7813 into flathub:master Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pygame does not build with 24.08 runtime
2 participants