Граф коммитов

67 Коммитов

Автор SHA1 Сообщение Дата
Ahson Khan c770dd2f04
Update az_json_string_unescape to accept az_span as destination to improve usability of API. (#2412)
* Update az_json_string_unescape to accept az_span as destination to improve usability of API.

* Clang formatting.
2022-11-09 19:06:38 -08:00
Anton Kolesnyk 94b5847e5e
Fix minimum log buffer size calculation (#2372) 2022-10-27 17:54:30 -07:00
Dane Walton f9bfb8f76e
add base64 url encoder (#2329) 2022-09-14 12:19:26 -05:00
Ahson Khan e88c6b0422
Add null terminator for char* based json string unescape, and precondition on input length (#2303)
* Add null terminator for char* based json string unescape, and precondition on input length

* Add remark comment about precondition and null terimination

* Update doc comment typo

* Remove the test cases about insufficient space.

* Fix clang formatting.

* Add null terminator tests.

* Test that the null terminator is there at the end.

* Fix build errors.
2022-08-09 18:59:33 -07:00
George Arama 89cc5c13f6
Unescape json string (in , out of plac#2290)
* first pass

* A few small updates

* revert cmakesettings, and some file format

* fix char conv

* remove static

* pointerize

* test

* disable

* fix tests

* free

* lint

* the cmake of glory

* remove wrapper API

* remove build folder

* clang

* PR comments

* remark

* argh

* PR comments

* PR comments

* Test updates from PR

* added unit test for missing

* some more PR comments
2022-07-29 11:49:57 -07:00
George Arama 935cb92bdb
Unescape (#2287)
* first pass

* A few small updates

* revert cmakesettings, and some file format

* fix char conv

* remove static

* pointerize

* test

* disable

* fix tests

* free

* lint

* the cmake of glory

* remove wrapper API

* remove build folder

* clang

* PR comments

* remark

* argh
2022-07-28 14:53:19 -07:00
Charlie Barto 3e18d44ebb
Activate address sanitizer in CI, on Linux and Windows (#2219)
* Actually use the COMCKA_LIB variable that we set in the top level CMakeLists.txt

* rename global_compile_options.txt to .cmake

This results in better colorization in editors, and is less suprising.

* add ADDRESS_SANITIZER option

* add asan to CI, use

* use - instead of / for sanitize=address, so things work with other compilers

* make the canary compiler-specific.

* make an imported target for cmocka if it's too old to have a real imported target.

* link asan when using gcc

* make only the static analysis lie compiler specific.

* use target_link_libraries and target_include_directories instead of set_property

This is required to properly expand build type keywords.

* Revert "use target_link_libraries and target_include_directories instead of set_property"

This reverts commit f10143e03b.

* Revert "make an imported target for cmocka if it's too old to have a real imported target."

This reverts commit fd708295b8.

* just do target detection, don't try and make an imported target

the imported target doesn't work because it has build type keywords.

* supress "asan needs debug mode for good error reporting.

* ignore the linker warning about better debug info too.

* Remove the canary

* Add asan to a debug linux build.

* whitespace

* whitespace mk2

* update readme to mention asan

* asan option description nits

* add some explenation of the changes to linker warnings

* add note about compiler warning as well.
2022-07-05 15:32:22 -07:00
Ahson Khan 36a7257760
Add total bytes written public field to the JSON writer, by moving it from internal. (#2102)
* Add total bytes written public field to the JSON writer, by moving it
from internal.

* Add doc comments to internal json writer fields.

* Fix typo in comment, close bracket.
2022-02-08 17:34:01 -08:00
Anton Kolesnyk 5ad7985d50
Telemetry options constructor and component name size constraint (#1976) 2021-11-03 19:26:25 -07:00
Anton Kolesnyk 994916db1c
HTTP request telemetry improvements (#1968)
* HTTP request telemetry improvements

* Changelog improvements

* Fix warning

* Correct braces

* Remove extra arg

* Fix unit test, plus inline constant

* Empty Component Name triggers precondition failure

* Use constants

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-11-02 15:21:40 -07:00
Anton Kolesnyk 7b237f2105
get_http_status_code() helper function (#1961)
* az_http_response_get_status_code()

* Add unit test

* Update unit test

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-10-26 11:46:30 -07:00
Ahson Khan 4c881ccf0f
Add unit test to make sure internal state of json writer is set (#1907)
correctly.
2021-09-09 00:10:47 +00:00
Ahson Khan ec4df09dc0
Add base64 encoding and decoding APIs that accept az_span. (#1816)
* Add base64 encoding and decoding APIs that accept az_span.

* Add entry to the changelog.

* Address PR feedback - move const to r.h.s.
2021-07-08 21:26:47 +00:00
Ahson Khan 5d04d5bf97
Add public current depth field to JSON reader. (#1802)
* Add public current depth field to JSON reader.

* Add a CL entry.

* Fix typo in src comment.
2021-07-06 18:48:47 +00:00
Dane Walton c9ed195790
generate map files for iot samples (#1656) 2021-03-23 11:41:20 -07:00
Ahson Khan df15084af9
Make sure az_json_writer_append_json_text appends a comma between elements of an array. (#1600)
* Make sure az_json_writer_append_json_text appends a comma between
elements of an array.

* update changelog entry.
2021-02-12 13:17:10 -08:00
Ahson Khan 5344596208
Fix bounds check while processing JSON string to avoid out-of-range access. (#1404)
Fixes https://github.com/Azure/azure-sdk-for-c/issues/1352
2020-10-03 01:40:08 +00:00
Victor Vazquez 19cd72dfd1
Consume CMocka CMake module directly from CMocka repo (#1382)
Removing the CMake module used to create cmocka tests. It was taken from some 3rd party instead of taking it directly from CMoka modules (https://gitlab.com/cmocka/cmocka/-/blob/master/cmake/Modules/AddCMockaTest.cmake)
2020-09-30 16:39:49 +00:00
Victor Vazquez b5477ae0e5
avoid reading from size 0 span (#1379)
fixes: #1351
2020-09-30 04:53:29 +00:00
Ahson Khan f38f6ed374
Remove trailing white space and insert final new lines. (#1242)
* Remove trailing whitespace and insert final new lines.

* Revert "Remove trailing whitespace and insert final new lines."

This reverts commit 1c6539a6ca.

* Remove trailing whitespace, insert final new lines, and consistently use
LF.

* Revert "Remove trailing whitespace and insert final new lines."

This reverts commit 1c6539a6ca.

* Remove trailing whitespace and insert final new lines, leaving end of
lines as default.

* Normalize line endings.

* Fix header guard.

* Run clang format.

* Re-run editor config.
2020-09-24 21:15:44 -07:00
Ahson Khan deb716a15b
Use a should_write callback method to let the caller decide what should and shouldn't get logged. (#1317)
* Use a should_write callback method to let the caller decide what should
and shouldn't get logged.

* Update parameter name to match expectation.

* Make sure to use the write_nothing callback in a test.

* Update comments and split az_log_set_callbacks to two individual
functions.

* Rename az_log_set_callback to az_log_set_message_callback and update
tests.

* Fix typo and invert ifndef to avoid double negatives.

* Address PR feedback.

* Update method names.

* Revert formatting change to internal file.

* Missed name change and update the changlog.

* Update core readme.

* Fix typo in name and docs as part of rename.

* Address changelog feedback.

* Remove unused headers, update comments, address feedback.

* Rename az_log_filer_fn to az_log_classification_filter_fn.

* Use a different version of the log engine.
2020-09-23 19:19:28 -07:00
Ahson Khan c30c45efe9
Make az_log_set_classifications internal. (#1333)
* Make az_log_set_classifications internal.

* Update readme, and callsites, fix name, and make things internal.

* Add indentation.

* Update changelog.

* Fix param name in comment.
2020-09-21 17:03:17 -07:00
Ahson Khan 9257a28c84
Move IoT az_result and log classification enum values to separate headers without introducing new typedefs (#1297)
* Turn az_resut enum values to macros.

* Move the IoT specific macros.

* Add new line.

* Make sure all az_result values have the same type, signed int.

* Use anonymous enums instead of define macros.

* Add names to enums.

* Fixup names and update changelog.

* Add _core suffix to az_result and log.

* Update doc comment to include references to each header.

* Address PR feedback - use alias'd name for cast.

* Revert unrelated, accidental comment formatting change.
2020-09-18 13:34:27 -07:00
Anton Kolesnyk bb4f941423
Make Platform functions to return az_result (#1256) 2020-09-17 08:25:14 -07:00
Ahson Khan 07c055c11b
Rename AZ_ERROR_INSUFFICIENT_SPAN_SIZE to be more generic: AZ_ERROR_NOT_ENOUGH_SPACE (#1221)
* Rename AZ_ERROR_INSUFFICIENT_SPAN_SIZE to be more generic:
AZ_ERROR_NOT_ENOUGH_SPACE.

* Update changelog.

* Fix spacing/formatting.
2020-09-04 17:21:19 -07:00
Daniel Jurek 8dc7062646
Only create map files if cmake is 3.13 or greater (#1208)
* Only create map files if cmake is 3.13 or greater
* Use a module for producting map files
* Review feedback
* Give warning message that map files won't be generated
2020-09-04 16:21:59 -07:00
Ahson Khan c12a010792
Update doxygen version to 1.8.20 to get some recent bug fixes. (#1135)
* Update doxygen version to 1.8.20 to get some recent bug fixes.

* Update the storage docs.

* Revert "Update the storage docs."

This reverts commit 182cd006ff.

* Fix a typo to trigger a new CI run.
2020-09-03 11:34:40 -07:00
Anton Kolesnyk 5c7444dfcd
Remove az pair (#1194) 2020-09-02 13:11:20 -07:00
Anton Kolesnyk 32a88e1b85
Remove Client Secret Credential (#1193)
* Remove Client Secret Credential
2020-09-02 09:46:47 -07:00
Ahson Khan bb1b4532ea
Fix AV in logging when classification array isn't valid and add tests. (#1174)
* Fix AV in logging when classification array isn't valid and add tests.

* Revert cmakesettings json change.

* Remove unnecessary assert, to docouple sequence of test runs.

* Update null to empty.

* Update tests for when logging is turned off.

* Go back to for-loop instead of while-loop.

* Add another success test for logging.

* Move the validation to a precondition check.

* Rename test.

* Address PR feedback and put ifdef around validation method.

* Apply rename across the tests.
2020-09-01 13:47:58 -07:00
Ahson Khan 18bc763c9e
Do not differentiate between empty and null span - rename macro. (#1168)
* Do not differentiate between empty and null span - rename macro.

* Update all code paths that relied on az_span_ptr == NULL to
differentiate between a null span and an empty span to use az_span_size
== 0.

* Add test for twin_parse_received_topic with incomplete received_topic.

* Update some doc comments.
2020-08-31 12:01:05 -07:00
Anton Kolesnyk a5af625e83
Macro cleanup (#1162) 2020-08-31 11:05:29 -07:00
Anton Kolesnyk 1ab7de174e
Make AZ_RETURN_IF... internal. (#1160) 2020-08-28 17:15:42 -07:00
Daniel Jurek 356e4ddf9f
Generate map files (#956)
* Generate map files

* Only copy map files to staging directory if publishing map files

* Artifact names can't have slashes

* Move PublishMapFiles to a matrix entry where samples are built

* Remove GenerateMapFiles.cmake, use straight-through syntax

* Don't refer to GenerateMapFiles.cmake

* Eliminate one more instance of generate_map_file, Publish map files with preconditions OFF

* Apply suggestions from code review

Co-authored-by: Ahson Khan <ahkha@microsoft.com>

* Experiment with release build and size minimizing optimization

* Parameterize build type

Co-authored-by: Ahson Khan <ahkha@microsoft.com>
2020-08-28 09:25:24 -07:00
Ahson Khan 9137165c03
Add AZ_ERROR_HTTP_NO_MORE_HEADERS and update az_http_response_get_next_header to return it. (#1157)
* Add AZ_ERROR_HTTP_NO_MORE_HEADERS and update
az_http_response_get_next_header to return it.

* Update logging test.

* Update changelog.

* Fix test string being compared against.

* Address PR feedback.

* Update docs and changelog.

* Add back the HTTP in fix to the name.

* Move HTTP_ADAPTER to 9 since we added a new error.
2020-08-27 19:54:17 -07:00
Ahson Khan 453340c77a
Rename az_failed and az_succeeded to az_result_failed and az_result_succeeded. (#1152)
* Rename az_failed and az_succeeded to az_result_failed and
az_result_succeeded.

* Add changelog entry.

* Update changes based on merge from master.

* Missed a couple of IoT samples.

* Add back include header that was unintentionally removed.

* Don't reorder certain header includes.
2020-08-27 19:09:19 -07:00
Ahson Khan bc577de6d8
Add ability to append existing JSON text value to the JSON writer, with runtime validation. (#1095)
* Add ability to append existing JSON text value to the JSON writer, with
validation.

* Remove unnecessary checks that are unreachable and make value validation
available outside of preconditions.

* Update comment wording to avoid overloading 'value'

* Fix typo in comment.

* Add entry to changelog file.

* Add tests for both valid and invalid scenarios.

* Add some more test cases.

* Uncomment blocked test for apppending partial JSON.

* Address PR feedback and update doc comment. Use new retval format.

* Remove unnecessary new lins in tests.
2020-08-24 15:23:08 -07:00
Ahson Khan 7f24621d86
Remove unused internal method since it has no callers: (#1109)
'az_http_request_append_path'
2020-08-24 15:18:16 -07:00
Ahson Khan f5393a79e1
Fix issue where json reader was sometimes returning done wheb reading (#1115)
partial or incomplete JSON text.
2020-08-24 14:16:18 -07:00
Anton Kolesnyk 4d2f0902b9
Core and Storage docs formatting tweaks (#1057) 2020-08-21 23:09:18 -07:00
Ahson Khan 74126624cf
Disable or fix all the SDK warnings for the release configurations. (#1097)
* Disable SDK warnings for the release configurations.

* Add linker warning workaround for the other iot samples.

* Store the function result as a bool in the precondition test macro to workaround release build optimizations.
2020-08-21 22:36:30 -07:00
Ahson Khan 11996e793f
Fix the strict-aliasing issue in _az_isfinite. (#1099)
* Fix the strict-aliasing issue in _az_isfinite.

* Use memcpy as a workaround for strict aliasing warning.

* Add some more comments and a precondition check on size.

* Remove precondition check since the sizeof comparison was constant.

* Fix similar issue in tests.
2020-08-21 22:33:17 -07:00
Ahson Khan 9ce11465d1
Optimize for code size URL encoding and appending path to request. (#1094)
* Optimize for code size URL encoding and appending path to request.

* Apply similar improvements to set_q_param where profitable and fix test
to allow partial writing to destination while encoding.
2020-08-21 15:07:44 -07:00
Victor Vazquez 1bd2c8731c
Url encoding on http (#1067)
Adding parameter to append_path and set_query_parameter to describe if the values are url-encoded or not.
This changes make sure that the url for the request is always url-encoded
2020-08-21 11:12:00 -07:00
Ahson Khan f33ac998fc
Rename AZ_ERROR_EOF az_result to a more descriptive as AZ_ERROR_UNEXPECTED_END. (#1029) 2020-08-10 11:56:53 -07:00
Ahson Khan 7a3d63d225
Fix typos and spacing issues in contributing, security, changelog, issue templates, and \eng\ markdowns. (#1012)
* Fix typos and spacing issues in contributing, security, changelog, issue
templates, and \eng\ markdowns.

* Fix some typos in API doc comments and code.

* Remove changlog file from docs as part of resolving merge conflict.

* Reapply the linter fixes to the moved changelog file.

* Revert changes to SECURITY.md since it doesn't belong in this repo.

* Address PR feedback.
2020-08-10 11:35:29 -07:00
Ahson Khan 5faba13f72
Add support for reading JSON in non-contiguous buffers (#1023)
* Add support for reading JSON in non-contiguous buffers, partial.

* Fix up parameter names and add MIN macro.

* Update all az_json_token APIs to account for discontiguous buffers.

* Fix issue with get_boolean by using token slice when possible.

* Update token while reading, and add text equal and get string tests.

* Add tests, update scratch to 99, and fix bugs.

* Add fix for whitespace, sample test, and use less stack space in test.

* Update sample test and make it static.

* Reduce some double test cases and fix up JSON text in comment.
2020-08-10 11:17:45 -07:00
Ahson Khan 7ce1847d92
Change occurrences of white space, white_space, and white-space to be a single word (whitespace) in APIs and docs. (#1013)
* Change occurrences of white space and white_space to be single word
(whitespace) in APIs and docs.

* Fix more instances that use hyphen as white-space to be single word.

* Change plural whitespaces to whitespace characters.
2020-08-06 17:41:04 -07:00
Ahson Khan 1374578fcb
Rename _az_is_finite to _az_isfinite to match STL and update call sites. (#1011) 2020-08-06 17:29:46 -07:00
Victor Vazquez 5a0939bb78
remove url encoding from url request (#1002)
* remove url encoding from url request and make transport adapter to encode
2020-08-06 17:16:45 -07:00