mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
* Adjustment: Update Assimp version to 5.0.1.
This commit is contained in:
parent
14ebeaf3eb
commit
4758f7bdaf
679 changed files with 50502 additions and 19698 deletions
|
|
@ -1,8 +1,10 @@
|
|||
### A portable (OSX/Linux/Windows), simple zip library written in C
|
||||
This is done by hacking awesome [miniz](https://code.google.com/p/miniz) library and layering functions on top of the miniz v1.15 API.
|
||||
|
||||
[](https://github.com/kuba--/zip/actions?query=workflow%3Abuild)
|
||||
[](https://ci.appveyor.com/project/kuba--/zip)
|
||||
[](https://travis-ci.org/kuba--/zip)
|
||||
[](https://github.com/kuba--/zip/releases)
|
||||
[](https://codecov.io/gh/kuba--/zip)
|
||||
|
||||
|
||||
# The Idea
|
||||
|
|
@ -69,7 +71,7 @@ int arg = 2;
|
|||
zip_extract("foo.zip", "/tmp", on_extract_entry, &arg);
|
||||
```
|
||||
|
||||
* Extract a zip entry into memory.
|
||||
* Extract a zip entry into memory.
|
||||
```c
|
||||
void *buf = NULL;
|
||||
size_t bufsize;
|
||||
|
|
@ -87,7 +89,7 @@ zip_close(zip);
|
|||
free(buf);
|
||||
```
|
||||
|
||||
* Extract a zip entry into memory (no internal allocation).
|
||||
* Extract a zip entry into memory (no internal allocation).
|
||||
```c
|
||||
unsigned char *buf;
|
||||
size_t bufsize;
|
||||
|
|
@ -108,7 +110,7 @@ zip_close(zip);
|
|||
free(buf);
|
||||
```
|
||||
|
||||
* Extract a zip entry into memory using callback.
|
||||
* Extract a zip entry into memory using callback.
|
||||
```c
|
||||
struct buffer_t {
|
||||
char *data;
|
||||
|
|
@ -142,7 +144,7 @@ free(buf.data);
|
|||
```
|
||||
|
||||
|
||||
* Extract a zip entry into a file.
|
||||
* Extract a zip entry into a file.
|
||||
```c
|
||||
struct zip_t *zip = zip_open("foo.zip", 0, 'r');
|
||||
{
|
||||
|
|
@ -155,7 +157,7 @@ struct zip_t *zip = zip_open("foo.zip", 0, 'r');
|
|||
zip_close(zip);
|
||||
```
|
||||
|
||||
* List of all zip entries
|
||||
* List of all zip entries
|
||||
```c
|
||||
struct zip_t *zip = zip_open("foo.zip", 0, 'r');
|
||||
int i, n = zip_total_entries(zip);
|
||||
|
|
@ -172,7 +174,7 @@ for (i = 0; i < n; ++i) {
|
|||
zip_close(zip);
|
||||
```
|
||||
|
||||
# Bindings
|
||||
## Bindings
|
||||
Compile zip library as a dynamic library.
|
||||
```shell
|
||||
$ mkdir build
|
||||
|
|
@ -211,53 +213,6 @@ func main() {
|
|||
}
|
||||
```
|
||||
|
||||
### Rust (ffi)
|
||||
```rust
|
||||
extern crate libc;
|
||||
use std::ffi::CString;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Zip {
|
||||
_private: [u8; 0],
|
||||
}
|
||||
|
||||
#[link(name = "zip")]
|
||||
extern "C" {
|
||||
fn zip_open(path: *const libc::c_char, level: libc::c_int, mode: libc::c_char) -> *mut Zip;
|
||||
fn zip_close(zip: *mut Zip) -> libc::c_void;
|
||||
|
||||
fn zip_entry_open(zip: *mut Zip, entryname: *const libc::c_char) -> libc::c_int;
|
||||
fn zip_entry_close(zip: *mut Zip) -> libc::c_int;
|
||||
fn zip_entry_write(
|
||||
zip: *mut Zip,
|
||||
buf: *const libc::c_void,
|
||||
bufsize: libc::size_t,
|
||||
) -> libc::c_int;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let path = CString::new("/tmp/test.zip").unwrap();
|
||||
let mode: libc::c_char = 'w' as libc::c_char;
|
||||
|
||||
let entryname = CString::new("test.txt").unwrap();
|
||||
let content = "test content\0";
|
||||
|
||||
unsafe {
|
||||
let zip: *mut Zip = zip_open(path.as_ptr(), 5, mode);
|
||||
{
|
||||
zip_entry_open(zip, entryname.as_ptr());
|
||||
{
|
||||
let buf = content.as_ptr() as *const libc::c_void;
|
||||
let bufsize = content.len() as libc::size_t;
|
||||
zip_entry_write(zip, buf, bufsize);
|
||||
}
|
||||
zip_entry_close(zip);
|
||||
}
|
||||
zip_close(zip);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Ruby (ffi)
|
||||
Install _ffi_ gem.
|
||||
```shell
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue