Kaynağa Gözat

Resolve shortening errors

The function takes short but we were doing calculations in the integer
type so that shortening of the result was occuring. This resolves that.
Matt Clarkson 10 yıl önce
ebeveyn
işleme
6f83251b56
1 değiştirilmiş dosya ile 5 ekleme ve 4 silme
  1. 5 4
      src/main.c

+ 5 - 4
src/main.c

@@ -1172,7 +1172,8 @@ static int get_password(const char *user,
 
 
 	unsigned char mem[4096], *p;
 	unsigned char mem[4096], *p;
 	DLGTEMPLATE *dia = (DLGTEMPLATE *)mem;
 	DLGTEMPLATE *dia = (DLGTEMPLATE *)mem;
-	int ok, y;
+	int ok;
+	short y;
 	struct tstring_input_buf dlgprms;
 	struct tstring_input_buf dlgprms;
 	dlgprms.buffer = passwd;
 	dlgprms.buffer = passwd;
 	dlgprms.buflen = passwd_len;
 	dlgprms.buflen = passwd_len;
@@ -1613,7 +1614,7 @@ static void change_password_file()
 	char strbuf[256], u[256], d[256];
 	char strbuf[256], u[256], d[256];
 	HWND hDlg = NULL;
 	HWND hDlg = NULL;
 	FILE *f;
 	FILE *f;
-	int y, nelems;
+	short y, nelems;
 	unsigned char mem[4096], *p;
 	unsigned char mem[4096], *p;
 	DLGTEMPLATE *dia = (DLGTEMPLATE *)mem;
 	DLGTEMPLATE *dia = (DLGTEMPLATE *)mem;
 	const char *domain = mg_get_option(g_ctx, "authentication_domain");
 	const char *domain = mg_get_option(g_ctx, "authentication_domain");
@@ -1734,7 +1735,7 @@ static void change_password_file()
 		}
 		}
 		fclose(f);
 		fclose(f);
 
 
-		y = (WORD)((nelems + 1) * HEIGHT + 10);
+		y = (nelems + 1) * HEIGHT + 10;
 		add_control(&p,
 		add_control(&p,
 		            dia,
 		            dia,
 		            0x80,
 		            0x80,
@@ -1768,7 +1769,7 @@ static void change_password_file()
 		            12,
 		            12,
 		            domain);
 		            domain);
 
 
-		y = (WORD)((nelems + 2) * HEIGHT + 10);
+		y = (nelems + 2) * HEIGHT + 10;
 		add_control(&p,
 		add_control(&p,
 		            dia,
 		            dia,
 		            0x80,
 		            0x80,