Skip to content

examples: simple_buffer: We must explicit convert pointer after mallo…#1026

Merged
Cyan4973 merged 1 commit intolz4:devfrom
kmou424:dev
Sep 4, 2021
Merged

examples: simple_buffer: We must explicit convert pointer after mallo…#1026
Cyan4973 merged 1 commit intolz4:devfrom
kmou424:dev

Conversation

@kmou424
Copy link
Copy Markdown
Contributor

@kmou424 kmou424 commented Sep 4, 2021

…c in c++

Aim: To adapt C++

Compilation errors:
simple_buffer.c:47:9: error: cannot initialize a variable of type 'char *' with an rvalue of type 'void '
char
compressed_data = malloc((size_t)max_dst_size);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
simple_buffer.c:76:15: error: cannot initialize a variable of type 'char *const' with an rvalue of type 'void '
char
const regen_buffer = malloc(src_size);
^ ~~~~~~~~~~~~~~~~
2 errors generated.

Generally, we need code that can be used in C and C++.I think this change will bring a better experience for visitors.

If this is unnecessary, please close this PR :)

…c in c++

Aim: To adapt C++

Compilation errors:
simple_buffer.c:47:9: error: cannot initialize a variable of type 'char *' with an rvalue of type 'void *'
  char* compressed_data = malloc((size_t)max_dst_size);
        ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
simple_buffer.c:76:15: error: cannot initialize a variable of type 'char *const' with an rvalue of type 'void *'
  char* const regen_buffer = malloc(src_size);
              ^              ~~~~~~~~~~~~~~~~
2 errors generated.
@Cyan4973 Cyan4973 merged commit d233473 into lz4:dev Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants