Skip to content

Commit

Permalink
Missing disclaimers & clang-format (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland authored Oct 6, 2023
1 parent 1a67d06 commit c4f78b2
Show file tree
Hide file tree
Showing 17 changed files with 166 additions and 18 deletions.
14 changes: 14 additions & 0 deletions examples/unix/c11/z_ping.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
14 changes: 14 additions & 0 deletions examples/unix/c11/z_pong.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include "stdio.h"
#include "zenoh-pico.h"

Expand Down
1 change: 0 additions & 1 deletion examples/unix/c11/z_scout.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

//
// Copyright (c) 2022 ZettaScale Technology
//
Expand Down
14 changes: 14 additions & 0 deletions examples/unix/c99/z_ping.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
14 changes: 14 additions & 0 deletions examples/unix/c99/z_pong.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include "stdio.h"
#include "zenoh-pico.h"
#include "zenoh-pico/api/primitives.h"
Expand Down
14 changes: 14 additions & 0 deletions examples/windows/z_ping.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
14 changes: 14 additions & 0 deletions examples/windows/z_pong.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include "stdio.h"
#include "zenoh-pico.h"

Expand Down
1 change: 0 additions & 1 deletion examples/windows/z_scout.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

//
// Copyright (c) 2022 ZettaScale Technology
//
Expand Down
6 changes: 3 additions & 3 deletions include/zenoh-pico/api/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -1142,9 +1142,9 @@ z_queryable_options_t z_queryable_options_default(void);
* Parameters:
* zs: A loaned instance of the the :c:type:`z_session_t` where to declare the subscriber.
* keyexpr: A loaned instance of :c:type:`z_keyexpr_t` to associate with the subscriber.
* callback: A moved instance of :c:type:`z_owned_closure_query_t` containing the callbacks to be called and the context
* to pass to them. options: The options to apply to the queryable. If ``NULL`` is passed, the default options will be
* applied.
* callback: A moved instance of :c:type:`z_owned_closure_query_t` containing the callbacks to be called and the
* context to pass to them. options: The options to apply to the queryable. If ``NULL`` is passed, the default options
* will be applied.
*
* Returns:
* A :c:type:`z_owned_queryable_t` with either a valid queryable or a failing queryable.
Expand Down
6 changes: 3 additions & 3 deletions include/zenoh-pico/link/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
* Z_LINK_CAPABILITY_MULTICAST: Bitmask to define and check if link is multicast.
*/
typedef enum {
Z_LINK_CAPABILITY_NONE = 0x00, // 0
Z_LINK_CAPABILITY_NONE = 0x00, // 0
Z_LINK_CAPABILITY_RELIABLE = 0x01, // 1 << 0
Z_LINK_CAPABILITY_STREAMED = 0x02, // 1 << 1
Z_LINK_CAPABILITY_MULTICAST = 0x04 // 1 << 2
Z_LINK_CAPABILITY_STREAMED = 0x02, // 1 << 1
Z_LINK_CAPABILITY_MULTICAST = 0x04 // 1 << 2
} _z_link_capabilities_t;

#define _Z_LINK_IS_RELIABLE(X) ((X & Z_LINK_CAPABILITY_RELIABLE) == Z_LINK_CAPABILITY_RELIABLE)
Expand Down
15 changes: 15 additions & 0 deletions src/protocol/codec/core.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include "zenoh-pico/protocol/codec/core.h"

#include "zenoh-pico/protocol/iobuf.h"

int8_t _z_zbuf_read_exact(_z_zbuf_t *zbf, uint8_t *dest, size_t length) {
if (length > _z_zbuf_len(zbf)) {
return _Z_ERR_MESSAGE_DESERIALIZATION_FAILED;
Expand Down
14 changes: 14 additions & 0 deletions src/protocol/core.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include "zenoh-pico/protocol/core.h"

#include "zenoh-pico/api/primitives.h"
Expand Down
Empty file removed src/protocol/definitions/core.c
Empty file.
14 changes: 14 additions & 0 deletions src/protocol/definitions/message.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include "zenoh-pico/protocol/definitions/message.h"

#include "zenoh-pico/collections/bytes.h"
Expand Down
14 changes: 14 additions & 0 deletions src/protocol/definitions/network.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include "zenoh-pico/protocol/definitions/network.h"

#include "zenoh-pico/api/constants.h"
Expand Down
14 changes: 14 additions & 0 deletions src/protocol/definitions/transport.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

#include "zenoh-pico/protocol/definitions/transport.h"

#include "zenoh-pico/collections/bytes.h"
Expand Down
15 changes: 5 additions & 10 deletions tests/z_keyexpr_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#undef NDEBUG
#include <assert.h>

int main(void)
{
int main(void) {
assert(_z_keyexpr_intersects("a", strlen("a"), "a", strlen("a")));
assert(_z_keyexpr_intersects("a/b", strlen("a/b"), "a/b", strlen("a/b")));
assert(_z_keyexpr_intersects("*", strlen("*"), "abc", strlen("abc")));
Expand Down Expand Up @@ -339,8 +338,7 @@ int main(void)

// clang-format on

for (int i = 0; i < N; i++)
{
for (int i = 0; i < N; i++) {
const char *ke = input[i];
char *canon = (char *)malloc(128);
memset(canon, 0, 128);
Expand All @@ -350,15 +348,13 @@ int main(void)
printf("%s ", ke);
printf(" Status: %d : %d\n", status, expected[i]);
assert(status == expected[i]);
if (status == Z_KEYEXPR_CANON_SUCCESS)
{
if (status == Z_KEYEXPR_CANON_SUCCESS) {
printf(" Match: %.*s : %s\n", (int)canon_len, canon, canonized[i]);
assert(strncmp(canonized[i], canon, canon_len) == 0);
}
}

for (int i = 0; i < N; i++)
{
for (int i = 0; i < N; i++) {
const char *ke = input[i];
char *canon = (char *)malloc(128);
memset(canon, 0, 128);
Expand All @@ -368,8 +364,7 @@ int main(void)
printf("%s ", ke);
printf(" Status: %d : %d", status, expected[i]);
assert(status == expected[i]);
if (status == Z_KEYEXPR_CANON_SUCCESS)
{
if (status == Z_KEYEXPR_CANON_SUCCESS) {
printf(" Match: %.*s : %s", (int)canon_len, canon, canonized[i]);
assert(strcmp(canonized[i], canon) == 0);
}
Expand Down

0 comments on commit c4f78b2

Please sign in to comment.