summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-06-12 10:34:10 +0200
committerPatrick Steinhardt <ps@pks.im>2018-06-12 10:34:10 +0200
commit2d9d246409d8131dfbbded2f880b784f205e93a5 (patch)
tree1a9445258d9e913e6d1eb11a72fe195ef3d1926a
parent795a5b28ad1f6e5dfd82d45bd7721914f49d31d3 (diff)
downloadlibgit2-2d9d246409d8131dfbbded2f880b784f205e93a5.tar.gz
diff: fix enum value being out of allowed range
The C89 standard states in ยง6.7.2.2 "Enumeration specifiers": > The expression that defines the value of an enumeration constant shall > be an integer constant expression that has a value representable as an > int. On most platforms, this effectively limits the range to a 32 bit signed integer. The enum `git_diff_option_t` though recently gained an entry `GIT_DIFF_INDENT_HEURISTIC = (1u << 31)`, which breaks this limit. Fix the issue by using a gap in `git_diff_option_t`'s enum values. While this has the benefit of retaining our API, it may break applications which do not get recompiled after upgrading libgit2. But as we are bumping the soversion on each release anyway and thus force a recompile of dependents, this is not a problem.
-rw-r--r--include/git2/diff.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index b7240ff98..3d810f589 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -171,6 +171,12 @@ typedef enum {
* Options controlling how output will be generated
*/
+ /** Use a heuristic that takes indentation and whitespace into account
+ * which generally can produce better diffs when dealing with ambiguous
+ * diff hunks.
+ */
+ GIT_DIFF_INDENT_HEURISTIC = (1u << 18),
+
/** Treat all files as text, disabling binary attributes & detection */
GIT_DIFF_FORCE_TEXT = (1u << 20),
/** Treat all files as binary, disabling text diffs */
@@ -206,12 +212,6 @@ typedef enum {
* can apply given diff information to binary files.
*/
GIT_DIFF_SHOW_BINARY = (1u << 30),
-
- /** Use a heuristic that takes indentation and whitespace into account
- * which generally can produce better diffs when dealing with ambiguous
- * diff hunks.
- */
- GIT_DIFF_INDENT_HEURISTIC = (1u << 31),
} git_diff_option_t;
/**