md5: add "const" qualifier to the "file" argument

This is intended to fix the following compiler warning in opkg-lede:

    /home/yousong/git-repo/lede-project/opkg-lede/libopkg/file_util.c: In function ‘file_md5sum_alloc’:
    /home/yousong/git-repo/lede-project/opkg-lede/libopkg/file_util.c:144:2: warning: passing argument 1 of ‘md5sum’ discards ‘const’ qualifier from pointer target type [enabled by default]
    In file included from /home/yousong/git-repo/lede-project/opkg-lede/libopkg/file_util.c:28:0:
    /home/yousong/.usr/include/libubox/md5.h:56:5: note: expected ‘char *’ but argument is of type ‘const char *’

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
Yousong Zhou 2017-03-20 19:42:01 +08:00 committed by Felix Fietkau
parent 96305a3caf
commit 7237302147
2 changed files with 2 additions and 2 deletions

2
md5.c
View file

@ -308,7 +308,7 @@ void md5_end(void *resbuf, md5_ctx_t *ctx)
memset(ctx, 0, sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx));
} }
int md5sum(char *file, void *md5_buf) int md5sum(const char *file, void *md5_buf)
{ {
char buf[256]; char buf[256];
md5_ctx_t ctx; md5_ctx_t ctx;

2
md5.h
View file

@ -53,6 +53,6 @@ typedef struct md5_ctx {
extern void md5_begin(md5_ctx_t *ctx); extern void md5_begin(md5_ctx_t *ctx);
extern void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); extern void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
extern void md5_end(void *resbuf, md5_ctx_t *ctx); extern void md5_end(void *resbuf, md5_ctx_t *ctx);
int md5sum(char *file, void *md5_buf); int md5sum(const char *file, void *md5_buf);
#endif #endif