Skip to content

Commit

Permalink
Fix const correctness
Browse files Browse the repository at this point in the history
As reported by #137
  • Loading branch information
tbeu committed Nov 21, 2023
1 parent f757268 commit 0884b80
Show file tree
Hide file tree
Showing 24 changed files with 146 additions and 131 deletions.
4 changes: 2 additions & 2 deletions documentation/Mat_GetFileAccessMode.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd October 18, 2023
.Dd November 20, 2023
.Dt MAT_GETFILEACCESSMODE 3
.Os
.Sh NAME
Expand All @@ -33,7 +33,7 @@
.Fd #include <matio.h>
.Ft enum mat_acc
.Fo Mat_GetFileAccessMode
.Fa "mat_t *matfp"
.Fa "const mat_t *matfp"
.Fc
.Sh DESCRIPTION
The
Expand Down
4 changes: 2 additions & 2 deletions documentation/Mat_GetFilename.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 12, 2019
.Dd November 20, 2023
.Dt MAT_GETFILENAME 3
.Os
.Sh NAME
Expand All @@ -33,7 +33,7 @@
.Fd #include <matio.h>
.Ft const char *
.Fo Mat_GetFilename
.Fa "mat_t *matfp"
.Fa "const mat_t *matfp"
.Fc
.Sh DESCRIPTION
The
Expand Down
4 changes: 2 additions & 2 deletions documentation/Mat_GetHeader.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 25, 2019
.Dd November 20, 2023
.Dt MAT_GETHEADER 3
.Os
.Sh NAME
Expand All @@ -33,7 +33,7 @@
.Fd #include <matio.h>
.Ft const char *
.Fo Mat_GetHeader
.Fa "mat_t *matfp"
.Fa "const mat_t *matfp"
.Fc
.Sh DESCRIPTION
The
Expand Down
4 changes: 2 additions & 2 deletions documentation/Mat_GetVersion.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 12, 2019
.Dd November 20, 2023
.Dt MAT_GETVERSION 3
.Os
.Sh NAME
Expand All @@ -33,7 +33,7 @@
.Fd #include <matio.h>
.Ft enum mat_ft
.Fo Mat_GetVersion
.Fa "mat_t *matfp"
.Fa "const mat_t *matfp"
.Fc
.Sh DESCRIPTION
The
Expand Down
6 changes: 3 additions & 3 deletions documentation/Mat_VarCreate.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 12, 2019
.Dd November 20, 2023
.Dt MAT_VARCREATE 3
.Os
.Sh NAME
Expand All @@ -37,8 +37,8 @@
.Fa "enum matio_classes class_type"
.Fa "enum matio_types data_type"
.Fa "int rank"
.Fa "size_t *dims"
.Fa "void *data"
.Fa "const size_t *dims"
.Fa "const void *data"
.Fa "int opt"
.Fc
.Sh DESCRIPTION
Expand Down
4 changes: 2 additions & 2 deletions documentation/Mat_VarCreateStruct.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 12, 2019
.Dd November 20, 2023
.Dt MAT_VARCREATESTRUCT 3
.Os
.Sh NAME
Expand All @@ -35,7 +35,7 @@
.Fo Mat_VarCreateStruct
.Fa "const char *name"
.Fa "int rank"
.Fa "size_t *dims"
.Fa "const size_t *dims"
.Fa "const char **fields"
.Fa "unsigned nfields"
.Fc
Expand Down
4 changes: 2 additions & 2 deletions documentation/Mat_VarGetNumberOfFields.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 18, 2012
.Dd November 20, 2023
.Dt MAT_VARGETNUMBEROFFIELDS 3
.Os
.Sh NAME
Expand All @@ -33,7 +33,7 @@
.Fd #include <matio.h>
.Ft unsigned
.Fo Mat_VarGetNumberOfFields
.Fa "matvar_t *matvar"
.Fa "const matvar_t *matvar"
.Fc
.Sh DESCRIPTION
The
Expand Down
4 changes: 2 additions & 2 deletions documentation/Mat_VarGetSize.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd October 20, 2017
.Dd November 20, 2023
.Dt MAT_VARGETSIZE 3
.Os
.Sh NAME
Expand All @@ -33,7 +33,7 @@
.Fd #include <matio.h>
.Ft size_t
.Fo Mat_VarGetSize
.Fa "matvar_t *matvar"
.Fa "const matvar_t *matvar"
.Fc
.Sh DESCRIPTION
The
Expand Down
8 changes: 4 additions & 4 deletions documentation/Mat_VarGetStructs.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 16, 2012
.Dd November 20, 2023
.Dt MAT_VARGETSTRUCTS 3
.Os
.Sh NAME
Expand All @@ -34,9 +34,9 @@
.Ft matvar_t *
.Fo Mat_VarGetStructs
.Fa "const matvar_t *matvar"
.Fa "int *start"
.Fa "int *stride"
.Fa "int *edge"
.Fa "cons int *start"
.Fa "const int *stride"
.Fa "const int *edge"
.Fa "int copy_fields"
.Fc
.Sh DESCRIPTION
Expand Down
4 changes: 2 additions & 2 deletions documentation/Mat_VarPrint.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd October 20, 2017
.Dd November 20, 2023
.Dt MAT_VARPRINT 3
.Os
.Sh NAME
Expand All @@ -33,7 +33,7 @@
.Fd #include <matio.h>
.Ft void
.Fo Mat_VarPrint
.Fa "matvar_t *matvar"
.Fa "const matvar_t *matvar"
.Fa "int printdata"
.Fc
.Sh DESCRIPTION
Expand Down
6 changes: 3 additions & 3 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list))
#endif

static void (*logfunc)(int log_level, char *message) = NULL;
static void (*logfunc)(int log_level, const char *message) = NULL;
static const char *progname = NULL;
static char *strdup_vprintf(const char *format, va_list ap) MATIO_FORMATATTR_VPRINTF;

Expand Down Expand Up @@ -122,7 +122,7 @@ utf82u(const char *src)
* @param message logging message
*/
static void
mat_logfunc(int log_level, char *message)
mat_logfunc(int log_level, const char *message)
{
if ( progname ) {
if ( log_level & MATIO_LOG_LEVEL_CRITICAL ) {
Expand Down Expand Up @@ -463,7 +463,7 @@ Mat_LogInit(const char *prog_name)
* @return 0 on success
*/
int
Mat_LogInitFunc(const char *prog_name, void (*log_func)(int log_level, char *message))
Mat_LogInitFunc(const char *prog_name, void (*log_func)(int log_level, const char *message))
{
logfunc = log_func;
progname = prog_name;
Expand Down
Loading

0 comments on commit 0884b80

Please sign in to comment.