Skip to content

Commit 599ce74

Browse files
committed
Merge branch 'iot' into mqtt_test_app
2 parents e7e603d + cbc4bcb commit 599ce74

File tree

12 files changed

+83
-17
lines changed

12 files changed

+83
-17
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ body:
1212
description: What is the problem? A clear and concise description of the bug.
1313
validations:
1414
required: true
15+
- type: checkboxes
16+
id: regression
17+
attributes:
18+
label: Regression Issue
19+
description: What is a regression? If it worked in a previous version but doesn't in the latest version, it's considered a regression. In this case, please provide specific version number in the report.
20+
options:
21+
- label: Select this option if this issue appears to be a regression.
22+
required: false
1523
- type: textarea
1624
id: expected
1725
attributes:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Apply potential regression label on issues
2+
name: issue-regression-label
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
jobs:
7+
add-regression-label:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
steps:
12+
- name: Fetch template body
13+
id: check_regression
14+
uses: actions/github-script@v7
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
TEMPLATE_BODY: ${{ github.event.issue.body }}
18+
with:
19+
script: |
20+
const regressionPattern = /\[x\] Select this option if this issue appears to be a regression\./i;
21+
const template = `${process.env.TEMPLATE_BODY}`
22+
const match = regressionPattern.test(template);
23+
core.setOutput('is_regression', match);
24+
- name: Manage regression label
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
if [ "${{ steps.check_regression.outputs.is_regression }}" == "true" ]; then
29+
gh issue edit ${{ github.event.issue.number }} --add-label "potential-regression" -R ${{ github.repository }}
30+
else
31+
gh issue edit ${{ github.event.issue.number }} --remove-label "potential-regression" -R ${{ github.repository }}
32+
fi
+25-11
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0.
33

4-
import struct Foundation.Data
54
import AwsCChecksums
65

6+
import struct Foundation.Data
7+
78
extension Data {
8-
9+
910
/// Computes the CRC32 over data.
1011
/// - Parameter previousCrc32: Pass 0 in the previousCrc32 parameter as an initial value unless continuing to update a running crc in a subsequent call.
1112
public func computeCRC32(previousCrc32: UInt32 = 0) -> UInt32 {
1213
self.withUnsafeBytes { bufferPointer in
13-
return aws_checksums_crc32(bufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self),
14-
Int32(count),
15-
previousCrc32)
14+
return aws_checksums_crc32_ex(
15+
bufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self),
16+
count,
17+
previousCrc32)
1618
}
1719
}
18-
20+
1921
/// Computes the crc32c over data.
2022
/// - Parameter previousCrc32c: Pass 0 in the previousCrc32c parameter as an initial value unless continuing to update a running crc in a subsequent call.
2123
public func computeCRC32C(previousCrc32c: UInt32 = 0) -> UInt32 {
2224
self.withUnsafeBytes { bufferPointer in
23-
return aws_checksums_crc32c(bufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self),
24-
Int32(count),
25-
previousCrc32c)
26-
}
25+
return aws_checksums_crc32c_ex(
26+
bufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self),
27+
count,
28+
previousCrc32c)
29+
}
2730
}
28-
31+
32+
/// Computes the CRC64NVME over data.
33+
/// - Parameter previousCrc64Nvme: Pass 0 in the previousCrc64Nvme parameter as an initial value unless continuing to update a running crc in a subsequent call.
34+
public func computeCRC64Nvme(previousCrc64Nvme: UInt64 = 0) -> UInt64 {
35+
self.withUnsafeBytes { bufferPointer in
36+
return aws_checksums_crc64nvme_ex(
37+
bufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self),
38+
count,
39+
previousCrc64Nvme)
40+
}
41+
}
42+
2943
}

Test/AwsCommonRuntimeKitTests/crt/ChecksumsTests.swift

+6
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,11 @@ class ChecksumsTests: XCBaseTestCase {
1717
XCTAssertEqual("Hello".data(using: .utf8)!.computeCRC32C(), 2178485787)
1818
XCTAssertEqual("{\"foo\":\"base64 encoded sha1 checksum\"}".data(using: .utf8)!.computeCRC32C(), 3565301023)
1919
}
20+
21+
func testCRC64Nvme() throws {
22+
XCTAssertEqual("".data(using: .utf8)!.computeCRC64Nvme(), 0)
23+
XCTAssertEqual(Data(count: 32).computeCRC64Nvme(), 0xCF3473434D4ECF3B)
24+
XCTAssertEqual(Data(Array(0..<32)).computeCRC64Nvme(), 0xB9D9D4A8492CBD7F)
25+
}
2026

2127
}

aws-common-runtime/config/README

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Helpers for swift to build the aws-common-runtime packages
2+
3+
It contains:
4+
* a symlink to point s2n/unstable/cleanup.h to api/unstable/cleanup.h for building s2n with the other aws-common-runtime packages.
5+
* `aws/common/config.h`, because cmake will run for swift build. Set the config.h separately.

aws-common-runtime/config/s2n

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../s2n/api

aws-common-runtime/s2n

Submodule s2n updated 121 files

0 commit comments

Comments
 (0)