Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic logic for g_socket #8

Merged
merged 6 commits into from
May 7, 2024
Merged
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
Prev Previous commit
Next Next commit
cr fixes 2
  • Loading branch information
Nikita Vorontsov committed May 2, 2024
commit c609f81e2289a71b0d322ae1901b1fa7dd54d459
4 changes: 2 additions & 2 deletions glib/gsocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)

type Socket struct {
Object
*Object
}

func SocketNew(domain, typ, proto int) (*Socket, error) {
Expand All @@ -17,19 +17,19 @@
if err != nil {
return nil, err
}
return SocketNewFromFd(fd)

Check failure on line 20 in glib/gsocket.go

View workflow job for this annotation

GitHub Actions / matrix (windows-latest)

cannot use fd (variable of type syscall.Handle) as int value in argument to SocketNewFromFd
}

func SocketNewFromFd(fd int) (*Socket, error) {
var gerr *C.GError
var socket *C.GSocket

Check failure on line 25 in glib/gsocket.go

View workflow job for this annotation

GitHub Actions / Tests on codebase

should merge variable declaration with assignment on next line (S1021)
socket = C.g_socket_new_from_fd((C.gint)(fd), (**C.GError)(unsafe.Pointer(&gerr)))
if gerr != nil {
defer C.g_error_free(gerr)
return nil, errors.New(C.GoString(gerr.message))
}

return &Socket{*Take(unsafe.Pointer(socket))}, nil
return &Socket{Take(unsafe.Pointer(socket))}, nil
}

func (s *Socket) ToGValue() (*Value, error) {
Expand Down
Loading