Sfoglia il codice sorgente

core: mark const parameters as such

Daniele Bartolini 3 anni fa
parent
commit
170fad20ee
2 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 2 2
      src/core/memory/globals.cpp
  2. 2 2
      src/resource/expression_language.cpp

+ 2 - 2
src/core/memory/globals.cpp

@@ -77,7 +77,7 @@ namespace memory
 
 	// Stores the size in the header and pads with HEADER_PAD_VALUE up to the
 	// data pointer.
-	inline void fill(Header *header, void *data, u32 size)
+	inline void fill(Header *header, const void *data, u32 size)
 	{
 		header->size = size;
 		u32 *p = (u32 *)(header + 1);
@@ -90,7 +90,7 @@ namespace memory
 		return size + align + sizeof(Header);
 	}
 
-	inline void pad(Header *header, void *data)
+	inline void pad(Header *header, const void *data)
 	{
 		u32 *p = (u32 *)(header + 1);
 

+ 2 - 2
src/resource/expression_language.cpp

@@ -346,7 +346,7 @@ namespace expression_language
 	/// sequence of tokens in reverse polish notation. Any function found in the
 	/// token stream which only takes constant arguments is replaced by the
 	/// result of evaluating the function over the constant arguments.
-	static void fold_constants(Token *rpl, unsigned &num_tokens, CompileEnvironment &env)
+	static void fold_constants(Token *rpl, unsigned &num_tokens, const CompileEnvironment &env)
 	{
 		static const int MAX_ARITY = 4;
 		float stack_data[MAX_ARITY];
@@ -386,7 +386,7 @@ namespace expression_language
 	/// Generates bytecode from a program in RPL token stream form.
 	/// Returns the number of byte_code tokens generated. If the returned number is > capacity, only the first
 	/// capacity items are generated.
-	static unsigned generate_bytecode(Token *rpl, unsigned num_tokens, const CompileEnvironment &env, unsigned *byte_code, unsigned capacity)
+	static unsigned generate_bytecode(const Token *rpl, unsigned num_tokens, const CompileEnvironment &env, unsigned *byte_code, unsigned capacity)
 	{
 		unsigned size = 0;
 		unsigned overflow = 0;