diff libpurple/plugins/log_reader.c @ 20910:54d232b52607

Since we are looking at the return value of fread, it actually matters that we use the correct values for the size of a single data item and the number of items to read.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 12 Oct 2007 22:26:44 +0000
parents feca1fd51b57
children b2b16843851b
line wrap: on
line diff
--- a/libpurple/plugins/log_reader.c	Fri Oct 12 22:12:29 2007 +0000
+++ b/libpurple/plugins/log_reader.c	Fri Oct 12 22:26:44 2007 +0000
@@ -127,7 +127,7 @@
 						continue;
 					}
 
-					rd = fread(contents, 56, 1, handle) == 0;
+					rd = fread(contents, 1, 56, handle) == 0;
 					fclose(handle);
 					contents[rd] = '\0';
 
@@ -189,7 +189,7 @@
 						continue;
 					}
 
-					rd = fread(contents, 13, 1, handle);
+					rd = fread(contents, 1, 13, handle);
 					fclose(handle);
 					contents[rd] = '\0';
 
@@ -1423,7 +1423,7 @@
 
 	file = g_fopen(data->path, "rb");
 	fseek(file, data->offset, SEEK_SET);
-	data->length = fread(read, data->length, 1, file);
+	data->length = fread(read, 1, data->length, file);
 	fclose(file);
 
 	if (read[data->length-1] == '\n') {
@@ -1922,7 +1922,7 @@
 	contents = g_malloc(data->length + 2);
 
 	fseek(file, data->offset, SEEK_SET);
-	data->length = fread(contents, data->length, 1, file);
+	data->length = fread(contents, 1, data->length, file);
 	fclose(file);
 
 	contents[data->length] = '\n';
@@ -2306,7 +2306,7 @@
 	g_return_val_if_fail(file != NULL, g_strdup(""));
 	
 	fseek(file, data->offset, SEEK_SET);
-	data->length = fread(contents, data->length, 1, file);
+	data->length = fread(contents, 1, data->length, file);
 	fclose(file);
 
 	contents[data->length] = '\n';