Skip to content

Commit 09012ef

Browse files
Copilotluoliwoshang
andcommitted
Fix zlib-static demo package name to be valid Go identifier
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
1 parent 4aad484 commit 09012ef

5 files changed

Lines changed: 29 additions & 29 deletions

File tree

_llcppgtest/zlib-static/conf/linux/llcppg.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "zlib-static",
2+
"name": "zlibstatic",
33
"cflags": "$(pkg-config --cflags zlib)",
44
"libs": "$(pkg-config --libs zlib)",
55
"include": [

_llcppgtest/zlib-static/demo/crc32demo/demo.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ package main
33
import (
44
"fmt"
55
"unsafe"
6-
"zlib-static"
6+
"zlibstatic"
77
)
88

99
func main() {
10-
ul := zlib_static.ULong(0)
10+
ul := zlibstatic.ULong(0)
1111
data := "Hello world"
1212
res := ul.Crc32Z(
13-
(*zlib_static.Bytef)(unsafe.Pointer(unsafe.StringData(data))),
14-
zlib_static.ZSizeT(uintptr(len(data))),
13+
(*zlibstatic.Bytef)(unsafe.Pointer(unsafe.StringData(data))),
14+
zlibstatic.ZSizeT(uintptr(len(data))),
1515
)
1616
fmt.Printf("%08x\n", res)
1717
}

_llcppgtest/zlib-static/demo/efficiency/efficiency.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ package main
22

33
import (
44
"unsafe"
5-
"zlib-static"
5+
"zlibstatic"
66

77
"github.com/goplus/lib/c"
88
)
99

1010
func main() {
1111
txt := []byte("zlib is a software library used for data compression. It was created by Jean-loup Gailly and Mark Adler and first released in 1995. zlib is designed to be a free, legally unencumbered—that is, not covered by any patents—alternative to the proprietary DEFLATE compression algorithm, which is often used in software applications for data compression.The library provides functions to compress and decompress data using the DEFLATE algorithm, which is a combination of the LZ77 algorithm and Huffman coding. zlib is notable for its versatility; it can be used in a wide range of applications, from web servers and web clients compressing HTTP data, to the compression of data for storage or transmission in various file formats, such as PNG, ZIP, and GZIP.")
12-
txtLen := zlib_static.ULong(len(txt))
12+
txtLen := zlibstatic.ULong(len(txt))
1313

1414
for level := 0; level <= 9; level++ {
15-
cmpSize := zlib_static.ULongf(zlib_static.CompressBound(txtLen))
15+
cmpSize := zlibstatic.ULongf(zlibstatic.CompressBound(txtLen))
1616
cmpData := make([]byte, int(cmpSize))
17-
data := (*zlib_static.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData)))
18-
source := (*zlib_static.Bytef)(unsafe.Pointer(unsafe.SliceData(txt)))
19-
res := zlib_static.Compress2(data, &cmpSize, source, txtLen, c.Int(level))
20-
if res != zlib_static.OK {
17+
data := (*zlibstatic.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData)))
18+
source := (*zlibstatic.Bytef)(unsafe.Pointer(unsafe.SliceData(txt)))
19+
res := zlibstatic.Compress2(data, &cmpSize, source, txtLen, c.Int(level))
20+
if res != zlibstatic.OK {
2121
c.Printf(c.Str("\nCompression failed at level %d: %d\n"), level, res)
2222
continue
2323
}
2424

2525
c.Printf(c.Str("Compression level %d: Text length = %d, Compressed size = %d\n"), level, txtLen, cmpSize)
2626

27-
ucmpSize := zlib_static.ULongf(txtLen)
27+
ucmpSize := zlibstatic.ULongf(txtLen)
2828
ucmp := make([]byte, int(ucmpSize))
29-
ucmpData := (*zlib_static.Bytef)(unsafe.Pointer(unsafe.SliceData(ucmp)))
30-
cmpSource := (*zlib_static.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData)))
29+
ucmpData := (*zlibstatic.Bytef)(unsafe.Pointer(unsafe.SliceData(ucmp)))
30+
cmpSource := (*zlibstatic.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData)))
3131

32-
unRes := zlib_static.Uncompress(ucmpData, &ucmpSize, cmpSource, zlib_static.ULong(cmpSize))
33-
if unRes != zlib_static.OK {
32+
unRes := zlibstatic.Uncompress(ucmpData, &ucmpSize, cmpSource, zlibstatic.ULong(cmpSize))
33+
if unRes != zlibstatic.OK {
3434
c.Printf(c.Str("\nDecompression failed at level %d: %d\n"), level, unRes)
3535
continue
3636
}

_llcppgtest/zlib-static/demo/normal/normal.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@ package main
22

33
import (
44
"unsafe"
5-
"zlib-static"
5+
"zlibstatic"
66

77
"github.com/goplus/lib/c"
88
)
99

1010
func main() {
1111
txt := []byte("zlib is a software library used for data compression. It was created by Jean-loup Gailly and Mark Adler and first released in 1995. zlib is designed to be a free, legally unencumbered—that is, not covered by any patents—alternative to the proprietary DEFLATE compression algorithm, which is often used in software applications for data compression.The library provides functions to compress and decompress data using the DEFLATE algorithm, which is a combination of the LZ77 algorithm and Huffman coding. zlib is notable for its versatility; it can be used in a wide range of applications, from web servers and web clients compressing HTTP data, to the compression of data for storage or transmission in various file formats, such as PNG, ZIP, and GZIP.")
12-
txtLen := zlib_static.ULong(len(txt))
12+
txtLen := zlibstatic.ULong(len(txt))
1313

14-
cmpSize := zlib_static.ULongf(zlib_static.CompressBound(txtLen))
14+
cmpSize := zlibstatic.ULongf(zlibstatic.CompressBound(txtLen))
1515
cmpData := make([]byte, int(cmpSize))
16-
data := (*zlib_static.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData)))
17-
txtData := (*zlib_static.Bytef)(unsafe.Pointer(unsafe.SliceData(txt)))
16+
data := (*zlibstatic.Bytef)(unsafe.Pointer(unsafe.SliceData(cmpData)))
17+
txtData := (*zlibstatic.Bytef)(unsafe.Pointer(unsafe.SliceData(txt)))
1818

19-
res := zlib_static.Compress(data, &cmpSize, txtData, txtLen)
20-
if res != zlib_static.OK {
19+
res := zlibstatic.Compress(data, &cmpSize, txtData, txtLen)
20+
if res != zlibstatic.OK {
2121
c.Printf(c.Str("\nCompression failed: %d\n"), res)
2222
return
2323
}
2424

2525
c.Printf(c.Str("Text length = %d, Compressed size = %d\n"), txtLen, cmpSize)
2626

27-
ucmpSize := zlib_static.ULongf(txtLen)
27+
ucmpSize := zlibstatic.ULongf(txtLen)
2828
ucmp := make([]byte, int(ucmpSize))
29-
ucmpPtr := (*zlib_static.Bytef)(unsafe.Pointer(unsafe.SliceData(ucmp)))
29+
ucmpPtr := (*zlibstatic.Bytef)(unsafe.Pointer(unsafe.SliceData(ucmp)))
3030

31-
unRes := zlib_static.Uncompress(ucmpPtr, &ucmpSize, data, zlib_static.ULong(cmpSize))
31+
unRes := zlibstatic.Uncompress(ucmpPtr, &ucmpSize, data, zlibstatic.ULong(cmpSize))
3232
c.Printf(c.Str("Decompression result = %d, Decompressed size %d\n"), unRes, ucmpSize)
3333

34-
if unRes != zlib_static.OK {
34+
if unRes != zlibstatic.OK {
3535
c.Printf(c.Str("\nDecompression failed: %d\n"), unRes)
3636
return
3737
}

_llcppgtest/zlib-static/llcppg.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "zlib-static",
2+
"name": "zlibstatic",
33
"cflags": "$(pkg-config --cflags zlib)",
44
"libs": "$(pkg-config --libs zlib)",
55
"include": [

0 commit comments

Comments
 (0)