mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
all: fix some issues spotted by static analysis
First, vet was upset by two incorrect fmt verbs. One was an extra %x, when there was just one argument, so remove it. Another was a %p with a non-pointer. It's a struct, so for now simply use %#v. Second, staticcheck found some unused or unnecessary bits of code; remove the obvious ones. Finally, staticcheck also complained about some error strings which were capitalized or had periods. Adjust those, which also makes all error messages more consistent. Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@ func (c *context) Present() error {
|
||||
c.srgbFBO.Blit()
|
||||
}
|
||||
if !eglSwapBuffers(c.eglCtx.disp, c.eglSurf) {
|
||||
return fmt.Errorf("eglSwapBuffers failed (%x%x)", eglGetError())
|
||||
return fmt.Errorf("eglSwapBuffers failed (%x)", eglGetError())
|
||||
}
|
||||
if c.srgbFBO != nil {
|
||||
c.srgbFBO.AfterPresent()
|
||||
|
||||
@@ -81,7 +81,7 @@ func (r *opCache) get(key ops.Key) (resource, bool) {
|
||||
|
||||
func (r *opCache) put(key ops.Key, val resource) {
|
||||
if _, exists := r.newRes[key]; exists {
|
||||
panic(fmt.Errorf("key exists, %p", key))
|
||||
panic(fmt.Errorf("key exists, %#v", key))
|
||||
}
|
||||
r.res[key] = val
|
||||
r.newRes[key] = val
|
||||
|
||||
@@ -349,7 +349,7 @@ func (g *GPU) renderLoop(glctx gl.Context) error {
|
||||
zt, st, covt, cleant := zopsTimer.Elapsed, stencilTimer.Elapsed, coverTimer.Elapsed, cleanupTimer.Elapsed
|
||||
ft := zt + st + covt + cleant
|
||||
q := 100 * time.Microsecond
|
||||
zt, st, covt, cleant = zt.Round(q), st.Round(q), covt.Round(q), cleant.Round(q)
|
||||
zt, st, covt = zt.Round(q), st.Round(q), covt.Round(q)
|
||||
ft = ft.Round(q)
|
||||
res.summary = fmt.Sprintf("f:%7s zt:%7s st:%7s cov:%7s", ft, zt, st, covt)
|
||||
}
|
||||
|
||||
+1
-1
@@ -361,4 +361,4 @@ func WithHeight(h ui.Value) WindowOption {
|
||||
}
|
||||
}
|
||||
|
||||
func (_ driverEvent) ImplementsEvent() {}
|
||||
func (driverEvent) ImplementsEvent() {}
|
||||
|
||||
@@ -33,7 +33,6 @@ type Key struct {
|
||||
|
||||
// Shadow of ui.MacroOp.
|
||||
type macroOp struct {
|
||||
recording bool
|
||||
ops *ui.Ops
|
||||
version int
|
||||
pc pc
|
||||
|
||||
Reference in New Issue
Block a user