1
0
mirror of https://github.com/benhoyt/inih.git synced 2025-01-28 22:52:54 +08:00

148 Commits

Author SHA1 Message Date
Ben Hoyt
63a302cfe5 Comment tweaks; Subversion -> Git (about time!) 2024-10-27 10:15:33 +01:00
Isidro
f93ad9312e
Test that long sections are truncated (#180)
* test that long sections are truncated

at MAX_SECTION=50

* generated .txt executing unittest.sh

* expected result

* Sections will be ignores when len(section) > len(INI_MAX_LINE)

---------

Co-authored-by: Ben Hoyt <benhoyt@gmail.com>
2024-10-27 09:52:11 +01:00
Isidro
5f8fdf2509
tests: define only once the compiler and flag (#179)
* tests: define only once the compiler and flag

This way you could play with them easily. For example:
- use clang instead gcc
- -Wextra
- -fsanitize=address

* check CC environ and fallback to gcc

Can be used in continious integration
2024-10-24 07:21:07 +02:00
Isidro
ee1fdd21ad
Add preprocessor exclusions when INI_ALLOW_MULTILINE=0 (#178)
Exclude the `prev_name` variable and the ini_strncpy0() call
2024-10-24 07:17:02 +02:00
Isidro
cd5f939740
swap rstrip and lskip to reduce execution time of strlen() (#177) 2024-10-20 15:14:44 +02:00
matoro
ed4525140d
Add meson support for tests (#170)
Allows tests to use "meson test" instead of a shell script.  This also
means that they now fully respect user-specified toolchain (e.g. clang
compiler, custom CFLAGS, etc).  Running C++ test is conditional on
enabling INIReader support in the build.

```
 1/16 test_multi                               OK              0.05s
 2/16 test_multi_max_line                      OK              0.04s
 3/16 test_single                              OK              0.04s
 4/16 test_disallow_inline_comments            OK              0.03s
 5/16 test_stop_on_first_error                 OK              0.03s
 6/16 test_handler_lineno                      OK              0.02s
 7/16 test_heap                                OK              0.06s
 8/16 test_string                              OK              0.06s
 9/16 test_heap_max_line                       OK              0.05s
10/16 test_heap_realloc                        OK              0.05s
11/16 test_heap_realloc_max_line               OK              0.05s
12/16 test_heap_string                         OK              0.04s
13/16 test_call_handler_on_new_section         OK              0.04s
14/16 test_allow_no_value                      OK              0.03s
15/16 test_alloc                               OK              0.02s
16/16 test_INIReaderExample                    OK              0.02s

Ok:                 16
Expected Fail:      0
Fail:               0
Unexpected Pass:    0
Skipped:            0
Timeout:            0
```

Co-authored-by: matoro <matoro@users.noreply.github.com>
2024-06-12 09:47:53 +12:00
Ben Hoyt
077174edcb
Merge pull request #169 from benhoyt/remove-ossfuzz
Remove OSS-Fuzz support
2024-04-25 08:48:16 +12:00
Ben Hoyt
53a7c05339 Revert "[oss-fuzz] fuzzing support (#153)"
This reverts commit 9114067a92fa58694bd816bb52f805476908a8a2.
2024-04-25 08:44:06 +12:00
Ben Hoyt
e28a71f244 Revert "[Fuzzing] using cifuzz for PR (#154)"
This reverts commit bf103d87ba231080cc71056b11bfb6fccd2cbb13.
2024-04-25 08:41:10 +12:00
Marco Meyer-Conde
ec8539d519
INIReader: change variable visibility from private to protected (#165)
This allows for full feature inheritance.
2024-04-06 03:47:29 +01:00
Ben Hoyt
5cc5e2c246
Merge pull request #164 from benhoyt/ini-prefix
Add ini_ prefix even to static names so inih can be used as an #include
r58
2024-01-25 06:05:02 +13:00
Ben Hoyt
d032d6ff5c Bump up version for release r58 2024-01-25 05:58:14 +13:00
Ben Hoyt
238610ef4e Add ini_ prefix even to static names so inih can be used as an #include
Fixes #163
2024-01-25 05:54:17 +13:00
DownerCase
4e618f77d4
Specify C++11 std in meson build (#157)
Compilers differ on what the default standard is and I had to set C++11 standard as part of the [vcpkg port](https://github.com/microsoft/vcpkg/pull/33001) to get it work on MacOS.

Also you forgot to bump the version number last release.
2023-08-06 21:43:46 +01:00
Arjun
bf103d87ba
[Fuzzing] using cifuzz for PR (#154)
using [cifuzz](https://google.github.io/oss-fuzz/getting-started/continuous-integration) for fuzzing PR.
2023-07-27 18:07:22 +01:00
Arjun
fe1e8f82ae
[Fuzzing] fix harness (#156)
Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
2023-07-27 18:06:07 +01:00
Arjun
9114067a92
[oss-fuzz] fuzzing support (#153)
Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
2023-07-27 07:29:38 +01:00
Nat
9cecf0643d
Allow INIReader to read 64-bit integers (#151)
Add INIReader::GetInteger64 and INIReader::GetUnsigned64
r57
2023-07-07 03:00:45 +01:00
Ian Hilt
d6e9d1ba68
meson.build: fix start-of-line_comment_prefix variable name (#149) 2022-12-02 21:39:43 +00:00
jcormier
683babb8e3
Added a GetUnsigned function for getting unsigned integer values. (#147)
Allow getting unsigned integers without losing precision.
2022-11-28 19:25:32 +00:00
Migos
03c604adb1
Fix MSVC warning C4244: conversion from 'int' to 'char' (#142)
- ::tolower returns int
- MSVC throws the warning C4244: conversion from 'int' to 'char'
- this lambda static casts the return value back to char
2022-11-10 22:54:13 +00:00
Ben Hoyt
5e1d9e2625 Bump up version to r56 for release r56 2022-07-12 21:20:53 +12:00
Ben Hoyt
bd798c5377
Make inline comments work on subsequent lines of multiline values (#140)
This is a bug fix that makes inih's behaviour here work as per Python's
ConfigParser, which is what inih behaviour is (loosely) based on.

Thanks @silly2020 for the report. See
https://github.com/benhoyt/inih/issues/120#issuecomment-1181341960
2022-07-12 21:20:05 +12:00
Ben Hoyt
ef9da8f4f7
Use "gcc -Wall" when running tests (#139) 2022-07-12 21:11:30 +12:00
Bostjan Skufca Jese
0566527e70
Fix redundant cast-to-int when INI_USE_STACK!=0 (#137)
Code context (ini.c):

    101: #if INI_USE_STACK
    102:     char line[INI_MAX_LINE];
    103:     int max_line = INI_MAX_LINE;
    104: #else
    105:     char* line;
    106:     size_t max_line = INI_INITIAL_ALLOC;
    107: #endif
    ...
    133: while (reader(line, (int)max_line, stream) != NULL) {

SonarCloud is reporting a "code smell" due to a redundant cast to `int` at line
133. This only happens when INI_USE_STACK is true, and not otherwise, as in that
case, `max_line` is of type `size_t` that gets correctly casted to `int`.

This patch changes the type of `max_line` variable to `size_t` for all situations.

SonarCloud report URL:
https://sonarcloud.io/project/issues?pullRequest=221&issues=AYGYdhPZKkhmUWy1nsvP&open=AYGYdhPZKkhmUWy1nsvP&id=snoopy

Co-authored-by: Ben Hoyt <benhoyt@gmail.com>
2022-06-30 08:24:28 +12:00
Ben Hoyt
4bd3261ea4 Keep tipi.build message in README but delete other files
Thanks @pysco68.

See https://github.com/benhoyt/inih/pull/136
2022-04-15 15:03:45 +12:00
Ben Hoyt
f7f69c6cff Bump up version number to r55 for release r55 2022-03-26 10:31:24 +13:00
Sam James
ad0211b00d
meson.build: define version (#135)
Otherwise, the installed .pc file contains "Version: undefined".

Signed-off-by: Sam James <sam@gentoo.org>
2022-03-26 10:30:50 +13:00
Andrea Pappacoda
5a31af99c4
Add visibility symbols (#134)
They are required to properly build DLLs on Windows, and improve the
quality of shared objects on Linux.
See https://gcc.gnu.org/wiki/Visibility for details.

This issue was first discovered here:
https://github.com/mesonbuild/wrapdb/pull/340#issuecomment-1075102565
r54
2022-03-24 08:30:27 +13:00
Ben Hoyt
a52c0705c0 Add FUNDING.yml 2022-01-21 11:04:24 +13:00
Ben Hoyt
4f251f0ff7 Fix uninitialized field issues in ini_example.c 2021-04-23 08:19:07 +12:00
Ben Hoyt
0b9092e80a Revert test baseline tweak 2021-02-27 17:22:53 +13:00
Ben Hoyt
2f1ee9b1c9 Modify test baseline to ensure GH Actions fails 2021-02-27 17:21:58 +13:00
Ben Hoyt
4eb924d2ea Update readme to GitHub Actions badge 2021-02-27 17:21:05 +13:00
Ben Hoyt
0113f049a6 Travis -> GitHub Actions 2021-02-27 17:18:45 +13:00
Ben Hoyt
fcdecb8bdb Fuzzing support via AFL 2021-02-24 11:47:12 +13:00
Ben Hoyt
e492a253ec Ensure value passed to strcmp is non-NULL in unittest.c
Fixes #127. Thanks Seth Arnold.
2021-02-09 15:56:28 +13:00
Stephan Lachnit
cb55f57d87
meson: add static compile args to inih_dep (#126)
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
r53
2021-02-08 09:35:56 +13:00
Stephan Lachnit
98dafacc76
enable distro settings by default (#125)
* meson: enable distro settings by default

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>

* meson: add note about version in pkg-config file

See also #123.

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2021-02-07 14:08:34 +13:00
bkuhls
e192e47627
meson: optionally depend on c++ (#124)
This fix is needed to allow building with toolchains which lack c++.
2021-01-11 09:56:56 +13:00
Debabrata Deka
e35e230763
Add architecture ppc64le to travis build (#122) 2020-11-27 07:50:48 +13:00
Ben Hoyt
1e80a47dff
Add INI_CUSTOM_ALLOCATOR to allow using a custom memory allocator (#119)
Fixes https://github.com/benhoyt/inih/issues/118
r52
2020-10-13 21:25:18 +13:00
xx55tt
672457c6df
Meson: fix the integer conversions (#113)
Meson doesn't have a `str` function, so it's not possible to change the integer options.
`subprojects/inih/meson.build:50:8: ERROR: Unknown function "str".`
2020-08-04 09:03:26 +12:00
Ben Hoyt
d3eda4f60b Don't use __ reserved identifiers (fixes issue #111) 2020-07-19 14:57:51 +12:00
Stephan Lachnit
32519ea045
meson: remove project version (#109)
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-06-21 17:01:28 +12:00
Ben Hoyt
d7f465792c Fix #107 (ugh, I thought changing from strncpy was a bad idea) r51 2020-06-18 19:32:52 +12:00
Ben Hoyt
8fe4b21438 Use memcpy instead of strncpy to avoid gcc warnings (issue #104 and #91) r50 2020-06-04 18:13:04 +12:00
Stephan Lachnit
16787c478a
Add options for Meson (#103)
* README: initial malloc size before allow realloc
* meson: fix wrong dependency for INIReader
* meson: implement options
* r49 release
r49
2020-04-22 14:49:24 +12:00
Phoebe
3e95a77a42
Add vcpkg installation instructions (#102) 2020-04-01 21:27:33 +13:00
Stephan Lachnit
351217124d
r48 release (#100)
* Bump copyright to 2020
* Remove makefile for static library
* meson: version 48

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
r48
2020-03-01 19:31:28 +13:00