Skip to content

Commit d5ab297

Browse files
authored
llama : constified llama_set_state_data's src (#5774)
1 parent 87c91c0 commit d5ab297

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llama.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12545,8 +12545,8 @@ size_t llama_copy_state_data(struct llama_context * ctx, uint8_t * dst) {
1254512545
}
1254612546

1254712547
// Sets the state reading from the specified source address
12548-
size_t llama_set_state_data(struct llama_context * ctx, uint8_t * src) {
12549-
uint8_t * inp = src;
12548+
size_t llama_set_state_data(struct llama_context * ctx, const uint8_t * src) {
12549+
const uint8_t * inp = src;
1255012550

1255112551
// set rng
1255212552
{
@@ -12555,7 +12555,7 @@ size_t llama_set_state_data(struct llama_context * ctx, uint8_t * src) {
1255512555

1255612556
GGML_ASSERT(rng_size <= LLAMA_MAX_RNG_STATE);
1255712557

12558-
std::string rng_str((char *)inp, rng_size); inp += rng_size;
12558+
std::string rng_str((const char *)inp, rng_size); inp += rng_size;
1255912559

1256012560
std::istringstream rng_ss(rng_str);
1256112561
rng_ss >> ctx->rng;

llama.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ extern "C" {
575575
// Returns the number of bytes read
576576
LLAMA_API size_t llama_set_state_data(
577577
struct llama_context * ctx,
578-
uint8_t * src);
578+
const uint8_t * src);
579579

580580
// Save/load session file
581581
LLAMA_API bool llama_load_session_file(

0 commit comments

Comments
 (0)