Skip to content

chore: update windows libfido2 dependencies to 1.16.0 #45

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 74 additions & 68 deletions windows/include/cbor.h
Original file line number Diff line number Diff line change
@@ -1,68 +1,74 @@
/*
* Copyright (c) 2014-2017 Pavel Kalvoda <[email protected]>
*
* libcbor is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/


#ifndef LIBCBOR_H_
#define LIBCBOR_H_

#include "cbor/data.h"
#include "cbor/common.h"

#include "cbor/arrays.h"
#include "cbor/bytestrings.h"
#include "cbor/floats_ctrls.h"
#include "cbor/ints.h"
#include "cbor/maps.h"
#include "cbor/strings.h"
#include "cbor/tags.h"

#include "cbor/encoding.h"
#include "cbor/serialization.h"
#include "cbor/callbacks.h"
#include "cbor/streaming.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
* ============================================================================
* High level decoding
* ============================================================================
*/

/** Loads data item from a buffer
*
* @param source The buffer
* @param source_size
* @param result[out] Result indicator. #CBOR_ERR_NONE on success
* @return **new** CBOR item or `NULL` on failure. In that case, \p result contains location and description of the error.
*/
cbor_item_t * cbor_load(cbor_data source,
size_t source_size,
struct cbor_load_result * result);

/** Deep copy of an item
*
* All the reference counts in the new structure are set to one.
*
* @param item[borrow] item to copy
* @return **new** CBOR deep copy
*/
cbor_item_t * cbor_copy(cbor_item_t * item);

#if CBOR_PRETTY_PRINTER
#include <stdio.h>

void cbor_describe(cbor_item_t * item, FILE * out);
#endif

#ifdef __cplusplus
}
#endif

#endif //LIBCBOR_H_
/*
* Copyright (c) 2014-2020 Pavel Kalvoda <[email protected]>
*
* libcbor is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/

#ifndef LIBCBOR_H_
#define LIBCBOR_H_

#include "cbor/common.h"
#include "cbor/data.h"

#include "cbor/arrays.h"
#include "cbor/bytestrings.h"
#include "cbor/floats_ctrls.h"
#include "cbor/ints.h"
#include "cbor/maps.h"
#include "cbor/strings.h"
#include "cbor/tags.h"

#include "cbor/callbacks.h"
#include "cbor/cbor_export.h"
#include "cbor/encoding.h"
#include "cbor/serialization.h"
#include "cbor/streaming.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
* ============================================================================
* High level decoding
* ============================================================================
*/

/** Loads data item from a buffer
*
* @param source The buffer
* @param source_size
* @param[out] result Result indicator. #CBOR_ERR_NONE on success
* @return Decoded CBOR item. The item's reference count is initialized to one.
* @return `NULL` on failure. In that case, \p result contains the location and
* description of the error.
*/
_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_load(
cbor_data source, size_t source_size, struct cbor_load_result* result);

/** Take a deep copy of an item
*
* All items this item points to (array and map members, string chunks, tagged
* items) will be copied recursively using #cbor_copy. The new item doesn't
* alias or point to any items from the original \p item. All the reference
* counts in the new structure are set to one.
*
* @param item item to copy
* @return Reference to the new item. The item's reference count is initialized
* to one.
* @return `NULL` if memory allocation fails
*/
_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_copy(cbor_item_t* item);

#if CBOR_PRETTY_PRINTER
#include <stdio.h>

CBOR_EXPORT void cbor_describe(cbor_item_t* item, FILE* out);
#endif

#ifdef __cplusplus
}
#endif

#endif // LIBCBOR_H_
249 changes: 137 additions & 112 deletions windows/include/cbor/arrays.h
Original file line number Diff line number Diff line change
@@ -1,112 +1,137 @@
/*
* Copyright (c) 2014-2017 Pavel Kalvoda <[email protected]>
*
* libcbor is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/

#ifndef LIBCBOR_ARRAYS_H
#define LIBCBOR_ARRAYS_H

#include "cbor/common.h"

#ifdef __cplusplus
extern "C" {
#endif

/** Get the number of members
*
* @param item[borrow] An array
* @return The number of members
*/
size_t cbor_array_size(const cbor_item_t * item);

/** Get the size of the allocated storage
*
* @param item[borrow] An array
* @return The size of the allocated storage (number of items)
*/
size_t cbor_array_allocated(const cbor_item_t * item);

/** Get item by index
*
* @param item[borrow] An array
* @param index The index
* @return **incref** The item, or `NULL` in case of boundary violation
*/
cbor_item_t * cbor_array_get(const cbor_item_t * item, size_t index);

/** Set item by index
*
* Creating arrays with holes is not possible
*
* @param item[borrow] An array
* @param value[incref] The item to assign
* @param index The index, first item is 0.
* @return true on success, false on allocation failure.
*/
bool cbor_array_set(cbor_item_t * item, size_t index, cbor_item_t * value);

/** Replace item at an index
*
* The item being replace will be #cbor_decref 'ed.
*
* @param item[borrow] An array
* @param value[incref] The item to assign
* @param index The index, first item is 0.
* @return true on success, false on allocation failure.
*/
bool cbor_array_replace(cbor_item_t * item, size_t index, cbor_item_t * value);

/** Is the array definite?
*
* @param item[borrow] An array
* @return Is the array definite?
*/
bool cbor_array_is_definite(const cbor_item_t * item);

/** Is the array indefinite?
*
* @param item[borrow] An array
* @return Is the array indefinite?
*/
bool cbor_array_is_indefinite(const cbor_item_t * item);

/** Get the array contents
*
* The items may be reordered and modified as long as references remain consistent.
*
* @param item[borrow] An array
* @return #cbor_array_size items
*/
cbor_item_t ** cbor_array_handle(const cbor_item_t * item);

/** Create new definite array
*
* @param size Number of slots to preallocate
* @return **new** array or `NULL` upon malloc failure
*/
cbor_item_t * cbor_new_definite_array(size_t size);

/** Create new indefinite array
*
* @return **new** array or `NULL` upon malloc failure
*/
cbor_item_t * cbor_new_indefinite_array();

/** Append to the end
*
* For indefinite items, storage may be realloacted. For definite items, only the
* preallocated capacity is available.
*
* @param array[borrow] An array
* @param pushee[incref] The item to push
* @return true on success, false on failure
*/
bool cbor_array_push(cbor_item_t * array, cbor_item_t * pushee);

#ifdef __cplusplus
}
#endif

#endif //LIBCBOR_ARRAYS_H
/*
* Copyright (c) 2014-2020 Pavel Kalvoda <[email protected]>
*
* libcbor is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/

#ifndef LIBCBOR_ARRAYS_H
#define LIBCBOR_ARRAYS_H

#include "cbor/cbor_export.h"
#include "cbor/common.h"

#ifdef __cplusplus
extern "C" {
#endif

/** Get the number of members
*
* @param item An array
* @return The number of members
*/
_CBOR_NODISCARD
CBOR_EXPORT size_t cbor_array_size(const cbor_item_t* item);

/** Get the size of the allocated storage
*
* @param item An array
* @return The size of the allocated storage (number of items)
*/
_CBOR_NODISCARD
CBOR_EXPORT size_t cbor_array_allocated(const cbor_item_t* item);

/** Get item by index
*
* @param item An array
* @param index The index (zero-based)
* @return Reference to the item, or `NULL` in case of boundary violation.
*
* Increases the reference count of the underlying item. The returned reference
* must be released using #cbor_decref.
*/
_CBOR_NODISCARD
CBOR_EXPORT cbor_item_t* cbor_array_get(const cbor_item_t* item, size_t index);

/** Set item by index
*
* If the index is out of bounds, the array is not modified and false is
* returned. Creating arrays with holes is not possible.
*
* @param item An array
* @param value The item to assign
* @param index The index (zero-based)
* @return `true` on success, `false` on allocation failure.
*/
_CBOR_NODISCARD
CBOR_EXPORT bool cbor_array_set(cbor_item_t* item, size_t index,
cbor_item_t* value);

/** Replace item at an index
*
* The reference to the item being replaced will be released using #cbor_decref.
*
* @param item An array
* @param value The item to assign. Its reference count will be increased by
* one.
* @param index The index (zero-based)
* @return true on success, false on allocation failure.
*/
_CBOR_NODISCARD
CBOR_EXPORT bool cbor_array_replace(cbor_item_t* item, size_t index,
cbor_item_t* value);

/** Is the array definite?
*
* @param item An array
* @return Is the array definite?
*/
_CBOR_NODISCARD
CBOR_EXPORT bool cbor_array_is_definite(const cbor_item_t* item);

/** Is the array indefinite?
*
* @param item An array
* @return Is the array indefinite?
*/
_CBOR_NODISCARD
CBOR_EXPORT bool cbor_array_is_indefinite(const cbor_item_t* item);

/** Get the array contents
*
* The items may be reordered and modified as long as references remain
* consistent.
*
* @param item An array item
* @return An array of #cbor_item_t pointers of size #cbor_array_size.
*/
_CBOR_NODISCARD
CBOR_EXPORT cbor_item_t** cbor_array_handle(const cbor_item_t* item);

/** Create new definite array
*
* @param size Number of slots to preallocate
* @return Reference to the new array item. The item's reference count is
* initialized to one.
* @return `NULL` if memory allocation fails
*/
_CBOR_NODISCARD
CBOR_EXPORT cbor_item_t* cbor_new_definite_array(size_t size);

/** Create new indefinite array
*
* @return Reference to the new array item. The item's reference count is
* initialized to one.
* @return `NULL` if memory allocation fails
*/
_CBOR_NODISCARD
CBOR_EXPORT cbor_item_t* cbor_new_indefinite_array(void);

/** Append to the end
*
* For indefinite items, storage may be reallocated. For definite items, only
* the preallocated capacity is available.
*
* @param array An array
* @param pushee The item to push. Its reference count will be increased by
* one.
* @return `true` on success, `false` on failure
*/
_CBOR_NODISCARD
CBOR_EXPORT bool cbor_array_push(cbor_item_t* array, cbor_item_t* pushee);

#ifdef __cplusplus
}
#endif

#endif // LIBCBOR_ARRAYS_H
Loading