summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-03-31 04:16:15 +0200
committerHaru <haru@dotalux.com>2016-04-16 03:52:32 +0200
commitd04db4e48cc76accc559bbb30451b25936289a0d (patch)
treeed014a30e9c3bdbcb03041640db442b0ee909b70
parentab42483e0450fb9a9bd904a8b50df559e099a773 (diff)
downloadhercules-d04db4e48cc76accc559bbb30451b25936289a0d.tar.gz
hercules-d04db4e48cc76accc559bbb30451b25936289a0d.tar.bz2
hercules-d04db4e48cc76accc559bbb30451b25936289a0d.tar.xz
hercules-d04db4e48cc76accc559bbb30451b25936289a0d.zip
Added const qualifier to the input parameter of bin2hex
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/common/strlib.c7
-rw-r--r--src/common/strlib.h4
2 files changed, 5 insertions, 6 deletions
diff --git a/src/common/strlib.c b/src/common/strlib.c
index 997b01ffa..8f164f2e9 100644
--- a/src/common/strlib.c
+++ b/src/common/strlib.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -424,13 +424,12 @@ int strlib_strline(const char *str, size_t pos)
/// @param output Output string
/// @param input Binary input buffer
/// @param count Number of bytes to convert
-bool strlib_bin2hex(char *output, unsigned char *input, size_t count)
+bool strlib_bin2hex(char *output, const unsigned char *input, size_t count)
{
char toHex[] = "0123456789abcdef";
size_t i;
- for( i = 0; i < count; ++i )
- {
+ for (i = 0; i < count; ++i) {
*output++ = toHex[(*input & 0xF0) >> 4];
*output++ = toHex[(*input & 0x0F) >> 0];
++input;
diff --git a/src/common/strlib.h b/src/common/strlib.h
index c523f5d86..36dceef2d 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -125,7 +125,7 @@ struct strlib_interface {
/// Produces the hexadecimal representation of the given input.
/// The output buffer must be at least count*2+1 in size.
/// Returns true on success, false on failure.
- bool (*bin2hex_) (char* output, unsigned char* input, size_t count);
+ bool (*bin2hex_) (char *output, const unsigned char *input, size_t count);
};
struct stringbuf_interface {