Skip to content

compress.zlib: changed to pure V RFC-compliant code#27162

Open
JalonSolov wants to merge 2 commits into
vlang:masterfrom
JalonSolov:pure_v_zlib
Open

compress.zlib: changed to pure V RFC-compliant code#27162
JalonSolov wants to merge 2 commits into
vlang:masterfrom
JalonSolov:pure_v_zlib

Conversation

@JalonSolov
Copy link
Copy Markdown
Collaborator

Also added interop subdir with tests for full V<->C<->Python cross-validation.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5a66136f4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread vlib/compress/zlib/zlib.v
@JalonSolov
Copy link
Copy Markdown
Collaborator Author

Bounce to re-run CI.

@JalonSolov JalonSolov closed this May 16, 2026
@JalonSolov JalonSolov reopened this May 16, 2026

fn test_zlib_roundtrip_text() {
data := 'Hello world!'.bytes()
compressed := compress(data)!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
compressed := compress(data)!
compressed := compress(data)!
assert compressed != data

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be a good idea, to verify that compress does not just return its input.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it couldn't hurt, but it should never be necessary. zlib will always add it's header to the output, so even if the original data is unchanged, the output will always be different due to that header.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The confusion may be that it is calling compress, not compress_zlib. However, the default type if you call compress is zlib compression, not raw compression.

I debated about what the default should be... I'm thinking now that the default probably should be raw compression, without adding the zlib/gzip headers. Then this test would directly call compress_zlib, hopefully clearing the confusion.

What do you think, @spytheman ?

spytheman

This comment was marked as duplicate.

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