Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dxfread (and DISABLED_DXF/WRITE source inclusion issues) #888

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

fr-an-k
Copy link
Contributor

@fr-an-k fr-an-k commented Dec 3, 2023

This serves my use case of a javascript production environment (I'm using it already); converting to/from JSON uing CLI, until I can produce an npm or WASM equivalent of DXF <-> JSON converter.

Javascript is the most popular language dominating many platforms and it seems very uncommon for a library to not have bindings for it.

Converting indirectly through DWG is undesirable since this is very error prone and makes end users have to wait longer; the DXF files that I have to support are tens of MB.

Having this in the master branch would greatly simplify further development, especially since most of the DXF that I have to support are currently failing.

@fr-an-k
Copy link
Contributor Author

fr-an-k commented Dec 3, 2023

@rurban dxf_read_file was defined only when USE_WRITE was enabled, in what appears to be your commit.
I removed that part of the conditional to pass the tests, or was there a reason for that?
In that case I will solve it differently and add a comment to clarify.

@fr-an-k
Copy link
Contributor Author

fr-an-k commented Dec 3, 2023

I assumed LIBREDWG_DISABLE_WRITE is intended to exclude functions that write the dwg structure to any kind of file.

@fr-an-k fr-an-k changed the title dxfread dxfread (and DISABLED_DXF/WRITE source inclusion issues) Dec 3, 2023
@rurban rurban self-assigned this Dec 3, 2023
@rurban rurban added enhancement New feature or request cla_needed Waiting for the Copyright assignment labels Dec 3, 2023
@rurban
Copy link
Contributor

rurban commented Dec 3, 2023

USE_WRITE is needed because preR13 needs the add api for the control objects.

@fr-an-k
Copy link
Contributor Author

fr-an-k commented Dec 3, 2023

Ok thanks, shoulnd't USE_WRITE then ideally only be used to include preR13 support in dxf_read_file?
Also, it is correct that all the programs should be turned off for --disable-write?
Otherwise they would pretty much be an empty executable; even dwglayers and dwggrep have write dependencies.
Maybe it's better to simply remove the ifdefs for write (and tests for disable write), so it's always enabled.

@fr-an-k
Copy link
Contributor Author

fr-an-k commented Dec 7, 2023

@rurban would it be appropriate if I change dwgfuzz to support any input to any output?
Just for improved testing and to pass the PR tests, not for my own needs.

I ended up fixing the USE_WRITE issue by including encode.c when USE_WRITE is disabled but DXF is enabled.

@rurban
Copy link
Contributor

rurban commented Dec 7, 2023

Sure, as in llvmfuzz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla_needed Waiting for the Copyright assignment enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants