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

Commit

Permalink
add 32 bit architecture support (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
unsuitable001 authored Aug 13, 2021
1 parent fb980ee commit db50ed6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
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
7 changes: 6 additions & 1 deletion 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 @@ -127,8 +128,12 @@ Dart_CObject CallbackArgBuilder(int num, ...) {
void *request_buffer = malloc(sizeof(uint64_t) * num);
uint64_t *buf = reinterpret_cast<uint64_t *>(request_buffer);

// uintptr_r will get implicitly casted to uint64_t. So, when the code is
// executed in 32 bit mode, the upper 32 bit of buf[i] will be 0 extended
// automatically. This is required because, on the Dart side these addresses
// are viewed as 64 bit integers.
for (int i = 0; i < num; i++) {
buf[i] = va_arg(valist, uint64_t);
buf[i] = va_arg(valist, uintptr_t);
}

c_request_data.type = Dart_CObject_kExternalTypedData;
Expand Down

0 comments on commit db50ed6

Please sign in to comment.