Jelajahi Sumber

Correct typing in memory_map function in lib/cpg.c

Signed-off-by: Steven Dake <sdake@redhat.com>
Steven Dake 14 tahun lalu
induk
melakukan
73a0adf10e
1 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 3 3
      lib/cpg.c

+ 3 - 3
lib/cpg.c

@@ -699,8 +699,8 @@ memory_map (char *path, const char *file, void **buf, size_t bytes)
 	int32_t res;
 	int32_t res;
 	char *buffer;
 	char *buffer;
 	int32_t i;
 	int32_t i;
-	int32_t written;
-	long page_size; 
+	size_t written;
+	size_t page_size; 
 
 
 	snprintf (path, PATH_MAX, "/dev/shm/%s", file);
 	snprintf (path, PATH_MAX, "/dev/shm/%s", file);
 
 
@@ -717,7 +717,7 @@ memory_map (char *path, const char *file, void **buf, size_t bytes)
 	if (res == -1) {
 	if (res == -1) {
 		goto error_close_unlink;
 		goto error_close_unlink;
 	}
 	}
-	page_size = sysconf(_SC_PAGESIZE);
+	page_size = (size_t)sysconf(_SC_PAGESIZE);
 	buffer = malloc (page_size);
 	buffer = malloc (page_size);
 	if (buffer == NULL) {
 	if (buffer == NULL) {
 		goto error_close_unlink;
 		goto error_close_unlink;