Convert all functions in ZydisFormatter to take const arguments

This commit is contained in:
Duncan Ogilvie 2017-10-14 13:39:00 +02:00
parent 90e4626d11
commit d459b39bb7
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 32 additions and 32 deletions

View File

@ -326,7 +326,7 @@ enum ZydisDecoratorTypes
ZYDIS_DECORATOR_TYPE_MAX_VALUE = ZYDIS_DECORATOR_TYPE_EVICTION_HINT ZYDIS_DECORATOR_TYPE_MAX_VALUE = ZYDIS_DECORATOR_TYPE_EVICTION_HINT
}; };
typedef struct ZydisFormatter_ ZydisFormatter; typedef struct ZydisFormatter_ ZydisFormatter;
/** /**
* @brief Defines the @c ZydisFormatterNotifyFunc function pointer. * @brief Defines the @c ZydisFormatterNotifyFunc function pointer.
@ -341,7 +341,7 @@ typedef struct ZydisFormatter_ ZydisFormatter;
* @c ZYDIS_FORMATTER_HOOK_POST hook-types. * @c ZYDIS_FORMATTER_HOOK_POST hook-types.
*/ */
typedef ZydisStatus (*ZydisFormatterNotifyFunc)(const ZydisFormatter* formatter, typedef ZydisStatus (*ZydisFormatterNotifyFunc)(const ZydisFormatter* formatter,
ZydisDecodedInstruction* instruction); const ZydisDecodedInstruction* instruction);
/** /**
* @brief Defines the @c ZydisFormatterFormatFunc function pointer. * @brief Defines the @c ZydisFormatterFormatFunc function pointer.
@ -361,7 +361,7 @@ typedef ZydisStatus (*ZydisFormatterNotifyFunc)(const ZydisFormatter* formatter,
* @c ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES and @c ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC hook-types. * @c ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES and @c ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC hook-types.
*/ */
typedef ZydisStatus (*ZydisFormatterFormatFunc)(const ZydisFormatter* formatter, typedef ZydisStatus (*ZydisFormatterFormatFunc)(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction); char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction);
/** /**
* @brief Defines the @c ZydisFormatterFormatOperandFunc function pointer. * @brief Defines the @c ZydisFormatterFormatOperandFunc function pointer.
@ -397,8 +397,8 @@ typedef ZydisStatus (*ZydisFormatterFormatFunc)(const ZydisFormatter* formatter,
* hook-types. * hook-types.
*/ */
typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(const ZydisFormatter* formatter, typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand); const ZydisDecodedOperand* operand);
/** /**
* @brief Defines the @c ZydisFormatterFormatAddressFunc function pointer. * @brief Defines the @c ZydisFormatterFormatAddressFunc function pointer.
@ -419,8 +419,8 @@ typedef ZydisStatus (*ZydisFormatterFormatOperandFunc)(const ZydisFormatter* for
* This function type is used for the @c ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS hook-type. * This function type is used for the @c ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS hook-type.
*/ */
typedef ZydisStatus (*ZydisFormatterFormatAddressFunc)(const ZydisFormatter* formatter, typedef ZydisStatus (*ZydisFormatterFormatAddressFunc)(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand, uint64_t address); const ZydisDecodedOperand* operand, uint64_t address);
/** /**
* @brief Defines the @c ZydisFormatterFormatDecoratorFunc function pointer. * @brief Defines the @c ZydisFormatterFormatDecoratorFunc function pointer.
@ -444,8 +444,8 @@ typedef ZydisStatus (*ZydisFormatterFormatAddressFunc)(const ZydisFormatter* for
* This function type is used for the @c ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR hook-type. * This function type is used for the @c ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR hook-type.
*/ */
typedef ZydisStatus (*ZydisFormatterFormatDecoratorFunc)(const ZydisFormatter* formatter, typedef ZydisStatus (*ZydisFormatterFormatDecoratorFunc)(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand, ZydisDecoratorType type); const ZydisDecodedOperand* operand, ZydisDecoratorType type);
/** /**
* @brief Defines the @c ZydisFormatter struct. * @brief Defines the @c ZydisFormatter struct.

View File

@ -47,7 +47,7 @@
/* ---------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintPrefixesIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterPrintPrefixesIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction) char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction)
{ {
@ -90,7 +90,7 @@ static ZydisStatus ZydisFormatterPrintPrefixesIntel(const ZydisFormatter* format
} }
static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction) char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction)
{ {
@ -117,8 +117,8 @@ static ZydisStatus ZydisFormatterPrintMnemonicIntel(const ZydisFormatter* format
/* ---------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterFormatOperandRegIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterFormatOperandRegIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand) const ZydisDecodedOperand* operand)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -139,8 +139,8 @@ static ZydisStatus ZydisFormatterFormatOperandRegIntel(const ZydisFormatter* for
} }
static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand) const ZydisDecodedOperand* operand)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -213,8 +213,8 @@ static ZydisStatus ZydisFormatterFormatOperandMemIntel(const ZydisFormatter* for
} }
static ZydisStatus ZydisFormatterFormatOperandPtrIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterFormatOperandPtrIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand) const ZydisDecodedOperand* operand)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -230,8 +230,8 @@ static ZydisStatus ZydisFormatterFormatOperandPtrIntel(const ZydisFormatter* for
} }
static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand) const ZydisDecodedOperand* operand)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -276,8 +276,8 @@ static ZydisStatus ZydisFormatterFormatOperandImmIntel(const ZydisFormatter* for
/* ---------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand, uint64_t address) const ZydisDecodedOperand* operand, uint64_t address)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -298,8 +298,8 @@ static ZydisStatus ZydisFormatterPrintAddressIntel(const ZydisFormatter* formatt
} }
static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand) const ZydisDecodedOperand* operand)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -332,8 +332,8 @@ static ZydisStatus ZydisFormatterPrintDisplacementIntel(const ZydisFormatter* fo
} }
static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand) const ZydisDecodedOperand* operand)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -388,8 +388,8 @@ static ZydisStatus ZydisFormatterPrintImmediateIntel(const ZydisFormatter* forma
/* ---------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------- */
static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand) const ZydisDecodedOperand* operand)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -486,8 +486,8 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* for
} }
static ZydisStatus ZydisFormatterPrintSegmentIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterPrintSegmentIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand) const ZydisDecodedOperand* operand)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -532,8 +532,8 @@ static ZydisStatus ZydisFormatterPrintSegmentIntel(const ZydisFormatter* formatt
} }
static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction, char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operand, ZydisDecoratorType type) const ZydisDecodedOperand* operand, ZydisDecoratorType type)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction || !operand)
{ {
@ -742,7 +742,7 @@ static ZydisStatus ZydisFormatterPrintDecoratorIntel(const ZydisFormatter* forma
} }
static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatter, static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatter,
char** buffer, size_t bufferLen, ZydisDecodedInstruction* instruction) char** buffer, size_t bufferLen, const ZydisDecodedInstruction* instruction)
{ {
if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction) if (!formatter || !buffer || !*buffer || (bufferLen <= 0) || !instruction)
{ {