Skip to content
This repository was archived by the owner on Feb 11, 2024. It is now read-only.

add 32 bit architecture support #24

Merged
merged 3 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.4+4

* Added support for 32 bit architecture.

## 0.0.4+3

* Fixed type casting issue between `Uint8List` and `Uint64List` while passing callback arguments from C side to Dart side.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a [GSoC 2021 project](https://summerofcode.withgoogle.com/projects/#4757

## Supported Platforms

Currently, 64 bit Android and Desktop Platforms (Linux, Windows and MacOS) are supported.
Currently, Android and Desktop Platforms (Linux, Windows and MacOS) are supported.

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.

name: cronet
version: 0.0.4+3
version: 0.0.4+4
homepage: https://github.com/google/cronet.dart
description: Experimental Cronet dart bindings.

Expand Down
8 changes: 6 additions & 2 deletions src/wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "../third_party/dart-sdk/dart_tools_api.h"
#include <iostream>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>

Expand Down Expand Up @@ -124,11 +125,14 @@ Dart_CObject CallbackArgBuilder(int num, ...) {
Dart_CObject c_request_data;
va_list valist;
va_start(valist, num);
void *request_buffer = malloc(sizeof(uint64_t) * num);
// Initializing [request_buffer] with 0 will allow us to ensure padding in
// the higher 32 bits of 64 bit uint in case of systems with word size of 4
// bytes.
void *request_buffer = calloc(num, sizeof(uint64_t));
uint64_t *buf = reinterpret_cast<uint64_t *>(request_buffer);

for (int i = 0; i < num; i++) {
buf[i] = va_arg(valist, uint64_t);
buf[i] = va_arg(valist, intptr_t);
}

c_request_data.type = Dart_CObject_kExternalTypedData;
Expand Down