On Monday 22 May 2006 10:16, Loïc Minier wrote: > On Fri, Apr 14, 2006, Wesley J. Landaker wrote: > [...] > > > The libmms headers have a lot of functions that use > > parameters named "this" > > [...] > > > (Also, it's quite common to have an ifdef on __cplusplus and do an > > automatic extern "C" block, but that's just a niceity, since if it's > > missing it can be handled on the C++ client code side without modifying > > the libmms headers.) > > Would you be so kind to offer a patch that you'd confirm renders libmms > usable from C++ code?
Here is a patch. =) -- Wesley J. Landaker <[EMAIL PROTECTED]> <xmpp:[EMAIL PROTECTED]> OpenPGP FP: 4135 2A3B 4726 ACC5 9094 0097 F0A9 8A4C 4CD6 E3D2
diff -ru libmms-0.2.orig/src/mms.h libmms-0.2/src/mms.h --- libmms-0.2.orig/src/mms.h 2005-12-12 02:24:19.000000000 -0700 +++ libmms-0.2/src/mms.h 2006-06-04 13:56:27.304412147 -0600 @@ -41,17 +41,25 @@ #include "bswap.h" #include "mmsio.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef struct mms_s mms_t; mms_t* mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth); -int mms_read (mms_io_t *io, mms_t *this, char *data, int len); -uint32_t mms_get_length (mms_t *this); -void mms_close (mms_t *this); +int mms_read (mms_io_t *io, mms_t *instance, char *data, int len); +uint32_t mms_get_length (mms_t *instance); +void mms_close (mms_t *instance); + +int mms_peek_header (mms_t *instance, char *data, int maxsize); -int mms_peek_header (mms_t *this, char *data, int maxsize); +off_t mms_get_current_pos (mms_t *instance); -off_t mms_get_current_pos (mms_t *this); +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif diff -ru libmms-0.2.orig/src/mmsh.h libmms-0.2/src/mmsh.h --- libmms-0.2.orig/src/mmsh.h 2005-12-12 02:24:20.000000000 -0700 +++ libmms-0.2/src/mmsh.h 2006-06-04 13:56:52.873248780 -0600 @@ -28,16 +28,24 @@ #include <inttypes.h> #include "mmsio.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef struct mmsh_s mmsh_t; char* mmsh_connect_common(int *s ,int *port, char *url, char **host, char **path, char **file); mmsh_t* mmsh_connect (mms_io_t *io, void *data, const char *url_, int bandwidth); -int mmsh_read (mms_io_t *io, mmsh_t *this, char *data, int len); -uint32_t mmsh_get_length (mmsh_t *this); -off_t mmsh_get_current_pos (mmsh_t *this); -void mmsh_close (mmsh_t *this); +int mmsh_read (mms_io_t *io, mmsh_t *instance, char *data, int len); +uint32_t mmsh_get_length (mmsh_t *instance); +off_t mmsh_get_current_pos (mmsh_t *instance); +void mmsh_close (mmsh_t *instance); + +int mmsh_peek_header (mmsh_t *instance, char *data, int maxsize); -int mmsh_peek_header (mmsh_t *this, char *data, int maxsize); +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif diff -ru libmms-0.2.orig/src/mmsio.h libmms-0.2/src/mmsio.h --- libmms-0.2.orig/src/mmsio.h 2005-11-30 06:21:24.000000000 -0700 +++ libmms-0.2/src/mmsio.h 2006-06-04 13:54:47.985699998 -0600 @@ -1,6 +1,10 @@ #ifndef __MMS_IO_H__ #define __MMS_IO_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef off_t (*mms_io_write_func)(void *data, int socket, char *buf, off_t num); typedef off_t (*mms_io_read_func)(void *data, int socket, char *buf, off_t num); @@ -69,4 +73,8 @@ void mms_set_default_io_impl(const mms_io_t *io); const mms_io_t* mms_get_default_io_impl(); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __MMS_IO_H__ */
pgpabnnwdsbRd.pgp
Description: PGP signature