From 84943dbed912f26482a0d2bdc1a5586a8828e4bc Mon Sep 17 00:00:00 2001 From: munna0908 Date: Thu, 22 May 2025 16:39:37 +0530 Subject: [PATCH] update license info --- serde/cbor/deserializer.nim | 13 +++---------- serde/cbor/errors.nim | 4 +++- serde/cbor/helpers.nim | 13 +++++++++++++ serde/cbor/jsonhook.nim | 3 +++ serde/cbor/serializer.nim | 5 ++++- serde/cbor/types.nim | 3 +++ tests/cbor/testprimitives.nim | 6 ++++-- 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/serde/cbor/deserializer.nim b/serde/cbor/deserializer.nim index 3d08e41..714f97b 100644 --- a/serde/cbor/deserializer.nim +++ b/serde/cbor/deserializer.nim @@ -1,3 +1,6 @@ +# This file is a modified version of Emery Hemingway’s CBOR library for Nim, +# originally available at https://github.com/ehmry/cbor-nim and released under The Unlicense. + import std/[math, streams, options, tables, strutils, times, typetraits] import ./types import ./helpers @@ -134,16 +137,6 @@ func bytesLen*(c: CborParser): ?!int = return failure(newCborError("Expected bytes, got " & $c.kind)) return success(c.intVal.int) -template tryNext(c: var CborParser) = - let nextRes = c.next() - if nextRes.isFailure: - return failure(nextRes.error) - -template trySkip(c: var CborParser) = - let skipRes = c.skipNode() - if skipRes.isFailure: - return failure(skipRes.error) - proc nextBytes*(c: var CborParser; buf: var openArray[byte]): ?!void = ## Read the bytes that the parser is positioned on and advance. try: diff --git a/serde/cbor/errors.nim b/serde/cbor/errors.nim index f375a1a..db6cdc5 100644 --- a/serde/cbor/errors.nim +++ b/serde/cbor/errors.nim @@ -1,8 +1,10 @@ +# This file is a modified version of Emery Hemingway’s CBOR library for Nim, +# originally available at https://github.com/ehmry/cbor-nim and released under The Unlicense. + import ../utils/types import ./types import std/sets - proc newUnexpectedKindError*( expectedType: type, expectedKinds: string, cbor: CborNode ): ref UnexpectedKindError = diff --git a/serde/cbor/helpers.nim b/serde/cbor/helpers.nim index 8450534..4e32ee5 100644 --- a/serde/cbor/helpers.nim +++ b/serde/cbor/helpers.nim @@ -1,8 +1,21 @@ +# This file is a modified version of Emery Hemingway’s CBOR library for Nim, +# originally available at https://github.com/ehmry/cbor-nim and released under The Unlicense. import ./types import ./errors from macros import newDotExpr, newIdentNode, strVal + +template tryNext*(c: var CborParser) = + let nextRes = c.next() + if nextRes.isFailure: + return failure(nextRes.error) + +template trySkip*(c: var CborParser) = + let skipRes = c.skipNode() + if skipRes.isFailure: + return failure(skipRes.error) + template exceptCborKind*(expectedType: type, expectedKinds: set[CborNodeKind], cbor: CborNode) = if cbor.kind notin expectedKinds: diff --git a/serde/cbor/jsonhook.nim b/serde/cbor/jsonhook.nim index 21e7a7a..6486225 100644 --- a/serde/cbor/jsonhook.nim +++ b/serde/cbor/jsonhook.nim @@ -1,3 +1,6 @@ +# This file is a modified version of Emery Hemingway’s CBOR library for Nim, +# originally available at https://github.com/ehmry/cbor-nim and released under The Unlicense. + import std/[base64, tables] import ../json/stdjson import ./types diff --git a/serde/cbor/serializer.nim b/serde/cbor/serializer.nim index 294b2ce..d605b85 100644 --- a/serde/cbor/serializer.nim +++ b/serde/cbor/serializer.nim @@ -1,4 +1,7 @@ -import std/[streams, options, tables, typetraits, math, endians, times, base64] +# This file is a modified version of Emery Hemingway’s CBOR library for Nim, +# originally available at https://github.com/ehmry/cbor-nim and released under The Unlicense. + +import std/[streams, options, tables, typetraits, math, endians, times] import pkg/questionable import pkg/questionable/results import ../utils/errors diff --git a/serde/cbor/types.nim b/serde/cbor/types.nim index 8da53d5..560cefa 100644 --- a/serde/cbor/types.nim +++ b/serde/cbor/types.nim @@ -1,3 +1,6 @@ +# This file is a modified version of Emery Hemingway’s CBOR library for Nim, +# originally available at https://github.com/ehmry/cbor-nim and released under The Unlicense. + import std/[streams, tables, options, hashes, times] const timeFormat* = initTimeFormat "yyyy-MM-dd'T'HH:mm:sszzz" diff --git a/tests/cbor/testprimitives.nim b/tests/cbor/testprimitives.nim index a3e4ae7..b555d37 100644 --- a/tests/cbor/testprimitives.nim +++ b/tests/cbor/testprimitives.nim @@ -1,5 +1,7 @@ -import - std/[base64, os, random, times, json, unittest] +# This file is a modified version of Emery Hemingway’s CBOR library for Nim, +# originally available at https://github.com/ehmry/cbor-nim and released under The Unlicense. + +import std/[base64, os, random, times, json, unittest] import pkg/serde/cbor import pkg/questionable import pkg/questionable/results