More error/TODO reduction.

This commit is contained in:
Pietro Gagliardi 2014-02-15 14:11:54 -05:00
parent c67191094f
commit 355016de05
3 changed files with 6 additions and 11 deletions

View File

@ -24,8 +24,7 @@ func getWinMainhInstance() (err error) {
}
// TODO this is what MinGW-w64's crt (svn revision TODO) does; is it best? is any of this documented anywhere on MSDN?
// TODO I highly doubt Windows API functions ever not fail, so figure out what to do should an error actually occur
func getWinMainnCmdShow() (err error) {
func getWinMainnCmdShow() {
var info struct {
cb uint32
lpReserved *uint16
@ -52,10 +51,9 @@ func getWinMainnCmdShow() (err error) {
kernel32.NewProc("GetStartupInfoW").Call(uintptr(unsafe.Pointer(&info)))
if info.dwFlags & _STARTF_USESHOWWINDOW != 0 {
nCmdShow = int(info.wShowWindow)
return nil
} else {
nCmdShow = _SW_SHOWDEFAULT
}
nCmdShow = _SW_SHOWDEFAULT
return nil
}
func doWindowsInit() (err error) {
@ -63,10 +61,7 @@ func doWindowsInit() (err error) {
if err != nil {
return fmt.Errorf("error getting WinMain hInstance: %v", err)
}
err = getWinMainnCmdShow()
if err != nil {
return fmt.Errorf("error getting WinMain nCmdShow: %v", err)
}
getWinMainnCmdShow()
err = initWndClassInfo()
if err != nil {
return fmt.Errorf("error initializing standard window class auxiliary info: %v", err)

View File

@ -67,7 +67,6 @@ func msgloopstep() (quit bool) {
Pt _POINT
}
// TODO figure out how to handle errors
r1, _, _ := _peekMessage.Call(
uintptr(unsafe.Pointer(&msg)),
uintptr(_NULL),
@ -80,7 +79,6 @@ func msgloopstep() (quit bool) {
if msg.Message == _WM_QUIT {
return true
}
// TODO handle potential errors in TranslateMessage() and DispatchMessage()
_translateMessage.Call(uintptr(unsafe.Pointer(&msg)))
_dispatchMessage.Call(uintptr(unsafe.Pointer(&msg)))
return false

View File

@ -5,3 +5,5 @@
- CB_GETCURSEL/LB_GETCURSEL (sysData.selectedIndex())
- LB_GETSELCOUNT/LB_GETSELITEMS (LB_ERR is returned if this is a single-selection listbox; are there actual errors?) (sysData.selectedIndices())
- LB_GETTEXTLEN/LB_GETTEXT (LB_ERR is returned if the given index is invalid, but since we get indices from LB_GETSELITEMS this shouldn't happen; are there actual errors?) (sysData.selectedTexts())
- PeekMessage(), TranslateMessage(), DispatchMessage() (the first one is odd as GetMessage() can return an error but PeekMessage() doesn't?) (msgloopstep())
- GetStartupInfoW() (MSDN explicitly says this function does not fail... oh really? well I suppose it cannot fail since it returns something all processes must have to begin with) (getWinMainnCmdShow())