Skip to content

Commit

Permalink
Add comment about heatshrink.c builds breaking due to err.h or getopt.h.
Browse files Browse the repository at this point in the history
A couple people have opened issues because they can't get this file
to build for Arduinos, etc., but it isn't supposed to be. Add a comment
comment explaining why right next to those header includes to clarify.

Closes #48, #61.
  • Loading branch information
silentbicycle committed Jul 4, 2021
1 parent c83a8dc commit 3d89d60
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Fixed fallthrough in getopt 'h'.

Added `CHANGELOG.md`.

Added comment to help explain build error when attempting to build the
command line interface for embedded systems without getopt.h/err.h.

Use constant rather than bare int 4096 for buffer size.

Fixed fallthrough compiler warning.
Expand Down
13 changes: 12 additions & 1 deletion src/heatshrink.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <assert.h>
#include <string.h>
#include <fcntl.h>
#include <getopt.h>

#include "heatshrink_encoder.h"
#include "heatshrink_decoder.h"
Expand All @@ -21,6 +20,18 @@
#define LOG(...) /* NO-OP */
#endif

/* If you're getting a build error because getopt.h or err.h are not
* available when compiling for an embedded platform, you're probably
* misundersting how this is supposed to be used.
*
* The encoder/decoder source files are for a library for embedded
* devices, but this file is for a command line program for a Unix-like
* environment, to work with data from embedded systems using the
* heatshrink library, experiment with how effectively different
* settings compress test data, etc. It is not supposed to be built for
* embedded devices, which are unlikely to have those headers. */
#include <getopt.h>

#if _WIN32
#include <errno.h>
#define HEATSHRINK_ERR(retval, ...) do { \
Expand Down

0 comments on commit 3d89d60

Please sign in to comment.