From 9931f7bb5faf4407bfae23003071a6cb89e79c76 Mon Sep 17 00:00:00 2001 From: germeier Date: Sat, 26 Oct 2002 13:07:42 +0000 Subject: make libmpio header files C++ compliant --- ChangeLog | 6 ++++++ libmpio/cis.h | 10 +++++++++- libmpio/debug.h | 10 +++++++++- libmpio/defs.h | 10 +++++++++- libmpio/directory.h | 10 +++++++++- libmpio/ecc.h | 10 +++++++++- libmpio/fat.h | 10 +++++++++- libmpio/io.h | 10 +++++++++- libmpio/mpio.c | 21 +++++++++++---------- libmpio/mpio.h | 10 +++++++++- libmpio/smartmedia.h | 10 +++++++++- 11 files changed, 98 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79e056d..b6f0cbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-10-26 Markus Germeier + + * libmpio/mpio.c (mpio_close): fixed segv + * libmpio/*.h: + make libmpio header files C++ compliant + 2002-10-23 Markus Germeier * libmpio/io.c (mpio_io_spare_read): fixed init progress counter diff --git a/libmpio/cis.h b/libmpio/cis.h index 2f3848c..c5d83b4 100644 --- a/libmpio/cis.h +++ b/libmpio/cis.h @@ -1,6 +1,6 @@ /* * - * $Id: cis.h,v 1.1 2002/10/06 21:19:50 germeier Exp $ + * $Id: cis.h,v 1.2 2002/10/26 13:07:42 germeier Exp $ * * Library for USB MPIO-* * @@ -28,7 +28,15 @@ #include "defs.h" +#ifdef __cplusplus +extern "C" { +#endif + /* generate and return a fresh CIS block */ BYTE *mpio_cis_gen(); +#ifdef __cplusplus +} +#endif + #endif diff --git a/libmpio/debug.h b/libmpio/debug.h index 4c7df21..09ae078 100644 --- a/libmpio/debug.h +++ b/libmpio/debug.h @@ -4,7 +4,7 @@ * Author: Dirk Meyer * Andreas Büsching * - * $Id: debug.h,v 1.1 2002/08/28 16:10:51 salmoon Exp $ + * $Id: debug.h,v 1.2 2002/10/26 13:07:43 germeier Exp $ */ #ifndef _MPIO_DEBUG_H_ @@ -30,6 +30,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + #ifndef PBOOL #define PBOOL(x) (x)?"True":"False" #endif @@ -97,6 +101,10 @@ void _octetstr(const char *package, const char* file, int line, int _use_debug(int level); +#ifdef __cplusplus +} +#endif + #endif /* _MPIO_DEBUG_H_ */ /* end of debug.h */ diff --git a/libmpio/defs.h b/libmpio/defs.h index 2cdb225..89195f0 100644 --- a/libmpio/defs.h +++ b/libmpio/defs.h @@ -1,7 +1,7 @@ /* -*- linux-c -*- */ /* - * $Id: defs.h,v 1.11 2002/09/28 00:32:41 germeier Exp $ + * $Id: defs.h,v 1.12 2002/10/26 13:07:43 germeier Exp $ * * Library for USB MPIO-* * @@ -30,6 +30,10 @@ #ifndef _MPIO_DEFS_H_ #define _MPIO_DEFS_H_ +#ifdef __cplusplus +extern "C" { +#endif + typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned int DWORD; @@ -265,5 +269,9 @@ typedef struct { // Up to 13 characters of a long name unsigned char name11_12[4]; // last 2 characters in name } mpio_dir_slot_t; +#ifdef __cplusplus +} +#endif + #endif /* _MPIO_DEFS_H_ */ diff --git a/libmpio/directory.h b/libmpio/directory.h index 2bd1b89..e3fe54d 100644 --- a/libmpio/directory.h +++ b/libmpio/directory.h @@ -1,6 +1,6 @@ /* * - * $Id: directory.h,v 1.4 2002/09/14 22:54:41 germeier Exp $ + * $Id: directory.h,v 1.5 2002/10/26 13:07:43 germeier Exp $ * * Library for USB MPIO-* * @@ -29,6 +29,10 @@ #include "fat.h" #include "time.h" +#ifdef __cplusplus +extern "C" { +#endif + /* root directory operations */ int mpio_rootdir_read (mpio_t *, mpio_mem_t); int mpio_rootdir_clear (mpio_t *, mpio_mem_t); @@ -53,4 +57,8 @@ int mpio_dentry_get_real(mpio_t *, mpio_mem_t, BYTE *, BYTE *, int, BYTE[12], WORD *, BYTE *, BYTE *, BYTE *, BYTE *, DWORD *); +#ifdef __cplusplus +} +#endif + #endif /* _MPIO_DIRECTORY_H_ */ diff --git a/libmpio/ecc.h b/libmpio/ecc.h index 8ac98ad..6b04191 100644 --- a/libmpio/ecc.h +++ b/libmpio/ecc.h @@ -1,6 +1,6 @@ /* * - * $Id: ecc.h,v 1.1 2002/08/28 16:10:51 salmoon Exp $ + * $Id: ecc.h,v 1.2 2002/10/26 13:07:43 germeier Exp $ * * Library for USB MPIO-* * @@ -28,9 +28,17 @@ #include "defs.h" +#ifdef __cplusplus +extern "C" { +#endif + /* 256 Bytes Data, 3 Byte ECC to generate */ int mpio_ecc_256_gen(BYTE *, BYTE *); /* 256 Bytes Data, 3 Bytes ECC to check and possibly correct */ int mpio_ecc_256_check(BYTE *, BYTE*); +#ifdef __cplusplus +} +#endif + #endif diff --git a/libmpio/fat.h b/libmpio/fat.h index 8255311..5ab7617 100644 --- a/libmpio/fat.h +++ b/libmpio/fat.h @@ -1,6 +1,6 @@ /* * - * $Id: fat.h,v 1.9 2002/10/06 21:19:50 germeier Exp $ + * $Id: fat.h,v 1.10 2002/10/26 13:07:43 germeier Exp $ * * Library for USB MPIO-* * @@ -28,6 +28,10 @@ #include "defs.h" +#ifdef __cplusplus +extern "C" { +#endif + /* generate fresh boot sectors for formatting of external mem */ BYTE *mpio_mbr_gen(BYTE); BYTE *mpio_pbr_gen(BYTE); @@ -74,4 +78,8 @@ BYTE mpio_fat_internal_find_fileindex(mpio_t *); void mpio_fatentry_hw2entry(mpio_t *, mpio_fatentry_t *); void mpio_fatentry_entry2hw(mpio_t *, mpio_fatentry_t *); +#ifdef __cplusplus +} +#endif + #endif /* _MPIO_FAT_H_ */ diff --git a/libmpio/io.h b/libmpio/io.h index 7536eee..8c41144 100644 --- a/libmpio/io.h +++ b/libmpio/io.h @@ -2,7 +2,7 @@ /* * - * $Id: io.h,v 1.11 2002/10/13 08:57:31 germeier Exp $ + * $Id: io.h,v 1.12 2002/10/26 13:07:43 germeier Exp $ * * Library for USB MPIO-* * @@ -33,6 +33,10 @@ #include "defs.h" +#ifdef __cplusplus +extern "C" { +#endif + /* phys.<->log. block mapping */ int mpio_zone_init(mpio_t *, mpio_cmd_t); /* context, memory bank, logical block */ @@ -84,4 +88,8 @@ int mpio_io_block_delete_phys(mpio_t *, BYTE, DWORD); int mpio_io_spare_read (mpio_t *, BYTE, DWORD, BYTE, BYTE, BYTE *, int, mpio_callback_init_t); +#ifdef __cplusplus +} +#endif + #endif /* _MPIO_IO_H_ */ diff --git a/libmpio/mpio.c b/libmpio/mpio.c index 11ae5c7..871bd98 100644 --- a/libmpio/mpio.c +++ b/libmpio/mpio.c @@ -1,6 +1,6 @@ /* * - * $Id: mpio.c,v 1.33 2002/10/13 12:03:51 germeier Exp $ + * $Id: mpio.c,v 1.34 2002/10/26 13:07:43 germeier Exp $ * * Library for USB MPIO-* * @@ -337,15 +337,16 @@ mpio_memory_free(mpio_t *m, mpio_mem_t mem, int *free) void mpio_close(mpio_t *m) { - close(m->fd); - - if(m->internal.fat) - free(m->internal.fat); - if(m->external.fat) - free(m->external.fat); - - free(m); - + if (m) { + close(m->fd); + + if(m->internal.fat) + free(m->internal.fat); + if(m->external.fat) + free(m->external.fat); + + free(m); + } } void diff --git a/libmpio/mpio.h b/libmpio/mpio.h index d90591f..a36cc49 100644 --- a/libmpio/mpio.h +++ b/libmpio/mpio.h @@ -1,7 +1,7 @@ #/* -*- linux-c -*- */ /* - * $Id: mpio.h,v 1.9 2002/09/24 15:38:03 germeier Exp $ + * $Id: mpio.h,v 1.10 2002/10/26 13:07:43 germeier Exp $ * * Library for USB MPIO-* * @@ -41,6 +41,10 @@ #include "defs.h" +#ifdef __cplusplus +extern "C" { +#endif + /* *init and shutdown */ @@ -114,6 +118,10 @@ void mpio_perror(char *prefix); * 2004: some functions to change the order of files * 2005: read mp3 tags of the files */ + +#ifdef __cplusplus +} +#endif #endif /* _MPIO_H_ */ diff --git a/libmpio/smartmedia.h b/libmpio/smartmedia.h index 1d01a07..a7d6b85 100644 --- a/libmpio/smartmedia.h +++ b/libmpio/smartmedia.h @@ -2,7 +2,7 @@ /* * - * $Id: smartmedia.h,v 1.1 2002/08/28 16:10:51 salmoon Exp $ + * $Id: smartmedia.h,v 1.2 2002/10/26 13:07:43 germeier Exp $ * * Library for USB MPIO-* * @@ -30,10 +30,18 @@ #include "defs.h" +#ifdef __cplusplus +extern "C" { +#endif + /* get our configuration for SmartMedia cards right */ int mpio_id2mem (BYTE); BYTE * mpio_id2manufacturer(BYTE); void mpio_id2geo(BYTE, mpio_disk_phy_t *); BYTE mpio_id_valid(BYTE); +#ifdef __cplusplus +} +#endif + #endif /* _MPIO_SMARTMEDIA_H_ */ -- cgit v1.2.3