diff --git a/aegisub/src/gl_wrap.cpp b/aegisub/src/gl_wrap.cpp
index a052138c624ccba6eb9b67c7dd35b3331d54f5fe..f2aa395f852055aad6caa336067fa6d0b37f094d 100644
--- a/aegisub/src/gl_wrap.cpp
+++ b/aegisub/src/gl_wrap.cpp
@@ -123,9 +123,7 @@ static inline Vector2D interp(Vector2D p1, Vector2D p2, float t) {
 }
 
 void OpenGLWrapper::DrawDashedLine(Vector2D p1, Vector2D p2, float step) const {
-	float dist = (p2 - p1).Len();
-	step /= dist;
-	dist -= step;
+	step /= (p2 - p1).Len();
 	for (float t = 0; t < 1.f; t += 2 * step) {
 		DrawLine(interp(p1, p2, t), interp(p1, p2, t + step));
 	}
diff --git a/aegisub/src/video_frame.cpp b/aegisub/src/video_frame.cpp
index 6f9f3ea29ed23094fd38c48def1590f3621b6308..f68f9a3cd807470a63c23271d0d6ffb241f1ac51 100644
--- a/aegisub/src/video_frame.cpp
+++ b/aegisub/src/video_frame.cpp
@@ -125,14 +125,13 @@ void AegiVideoFrame::SetTo(const unsigned char *source, unsigned int width, unsi
 wxImage AegiVideoFrame::GetImage() const {
 	unsigned char *buf = (unsigned char*)malloc(w*h*3);
 	if (!buf) throw std::bad_alloc();
-	const unsigned char *src = data;
-	unsigned char *dst = buf;
 
 	int Bpp = GetBpp();
 
 	// Convert
 	for (unsigned int y=0;y<h;y++) {
-		dst = buf + y*w*3;
+		unsigned char *dst = buf + y*w*3;
+		const unsigned char *src;
 		if (flipped) src = data + (h-y-1)*pitch;
 		else src = data + y*pitch;
 		for (unsigned int x=0;x<w;x++) {
diff --git a/aegisub/src/video_provider_yuv4mpeg.cpp b/aegisub/src/video_provider_yuv4mpeg.cpp
index 4eaa64fbf55f9429ea1aac9ca56a1ea71f654074..ca2f436ad3c68b5773865fb11bd363b6da06ea33 100644
--- a/aegisub/src/video_provider_yuv4mpeg.cpp
+++ b/aegisub/src/video_provider_yuv4mpeg.cpp
@@ -308,12 +308,11 @@ YUV4MPEGVideoProvider::Y4M_FrameFlags YUV4MPEGVideoProvider::ParseFrameHeader(co
 /// can easily be done.
 int YUV4MPEGVideoProvider::IndexFile() {
 	int framecount = 0;
-	int64_t curpos = ftello(sf);
 
 	// the ParseFileHeader() call in LoadVideo() will already have read
 	// the file header for us and set the seek position correctly
 	while (true) {
-		curpos = ftello(sf); // update position
+		int64_t curpos = ftello(sf); // update position
 		// continue reading headers until no more are found
 		std::vector<wxString> tags = ReadHeader(curpos, false);
 		curpos = ftello(sf);