Beispiel #1
0
func (ar *Archive) ExtractWithPassword(index int, w Writer, s string) error {
	u16s, err := _UTF16FromString(s)
	if err != nil {
		return err
	}
	ws := make([]C.wchar_t, len(u16s)+1)
	for i := range u16s {
		ws[i] = C.wchar_t(u16s[i])
	}

	if getBool(C.lib7zip_archive_extract_password(ar.a, C.uint(index), unsafe.Pointer(&w), &ws[0])) == false {
		return ar.lib.lastError()
	}
	return nil
}
Beispiel #2
0
// Initialize GoTypes in NumTypeMap
func initTypeMap() {
	cgoNumMap["C.char"] = GetNumInfo(C.char(0))
	cgoNumMap["C.schar"] = GetNumInfo(C.schar(0))
	cgoNumMap["C.uchar"] = GetNumInfo(C.uchar(0))
	cgoNumMap["C.short"] = GetNumInfo(C.short(0))
	cgoNumMap["C.ushort"] = GetNumInfo(C.ushort(0))
	cgoNumMap["C.wchar_t"] = GetNumInfo(C.wchar_t(0))
	cgoNumMap["C.int"] = GetNumInfo(C.int(0))
	cgoNumMap["C.uint"] = GetNumInfo(C.uint(0))
	cgoNumMap["C.long"] = GetNumInfo(C.long(0))
	cgoNumMap["C.ulong"] = GetNumInfo(C.ulong(0))
	cgoNumMap["C.longlong"] = GetNumInfo(C.longlong(0))
	cgoNumMap["C.ulonglong"] = GetNumInfo(C.ulonglong(0))
	cgoNumMap["C.float"] = GetNumInfo(C.float(0))
	cgoNumMap["C.double"] = GetNumInfo(C.double(0))
	cgoNumMap["complex64"] = GetNumInfo(complex64(0))
	cgoNumMap["complex128"] = GetNumInfo(complex128(0))
}