Jelajahi Sumber

* Resolved random compiler warnings.
- Silenced pointer size mismatch gcc warning for variables passed to script_setarray_pc (bugreport:4661, since r14613).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14615 54d463be-8e91-2dee-dedb-b68131a5f0ec

ai4rei 14 tahun lalu
induk
melakukan
1e81541e66
8 mengubah file dengan 16 tambahan dan 14 penghapusan
  1. 2 0
      Changelog-Trunk.txt
  2. 1 2
      src/ladmin/ladmin.c
  3. 1 1
      src/login/login.c
  4. 3 3
      src/map/atcommand.c
  5. 3 2
      src/map/clif.c
  6. 1 1
      src/map/map.c
  7. 4 4
      src/map/npc.c
  8. 1 1
      src/map/path.c

+ 2 - 0
Changelog-Trunk.txt

@@ -1,6 +1,8 @@
 Date	Added
 
 2010/12/22
+	* Resolved random compiler warnings. [Ai4rei]
+	- Silenced pointer size mismatch gcc warning for variables passed to script_setarray_pc (bugreport:4661, since r14613).
 	* Fixed sql mapreg loading code specifying output buffer size for SqlStmt_BindColumn without zero-terminator, leading to truncations of variable names and/or their values when using the maximum length (bugreport:1939, since r11245). [Ai4rei]
 2010/12/21
 	* Added script_setarray_pc for setting temporary character array variables outside of script.c without requiring them to use script-interal code (add_str and reference_uid). [Ai4rei]

+ 1 - 2
src/ladmin/ladmin.c

@@ -261,7 +261,7 @@ int ladmin_log(char *fmt, ...)
 }
 
 //---------------------------------------------
-// Function to return ordonal text of a number.
+// Function to return ordinal text of a number.
 //---------------------------------------------
 char* makeordinal(int number)
 {
@@ -275,7 +275,6 @@ char* makeordinal(int number)
 	} else {
 		return "th";
 	}
-	return "";
 }
 
 //-----------------------------------------------------------------------------------------

+ 1 - 1
src/login/login.c

@@ -402,7 +402,7 @@ int parse_fromchar(int fd)
 			uint32 login_id1 = RFIFOL(fd,6);
 			uint32 login_id2 = RFIFOL(fd,10);
 			uint8 sex = RFIFOB(fd,14);
-			uint32 ip_ = ntohl(RFIFOL(fd,15));
+			//uint32 ip_ = ntohl(RFIFOL(fd,15));
 			int request_id = RFIFOL(fd,19);
 			RFIFOSKIP(fd,23);
 

+ 3 - 3
src/map/atcommand.c

@@ -6352,7 +6352,7 @@ ACMD_FUNC(mobsearch)
 	clif_displaymessage(fd, atcmd_output);
 
 	it = mapit_geteachmob();
-	while( true )
+	for(;;)
 	{
 		TBL_MOB* md = (TBL_MOB*)mapit_next(it);
 		if( md == NULL )
@@ -6502,7 +6502,7 @@ ACMD_FUNC(users)
 
 	// count users on each map
 	iter = mapit_getallusers();
-	while( true )
+	for(;;)
 	{
 		struct map_session_data* sd2 = (struct map_session_data*)mapit_next(iter);
 		if( sd2 == NULL )
@@ -7081,7 +7081,7 @@ ACMD_FUNC(showmobs)
 	clif_displaymessage(fd, atcmd_output);
 
 	it = mapit_geteachmob();
-	while( true )
+	for(;;)
 	{
 		TBL_MOB* md = (TBL_MOB*)mapit_next(it);
 		if( md == NULL )

+ 3 - 2
src/map/clif.c

@@ -9373,7 +9373,8 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
 {
 	int item_index = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0])-2;
 	int item_amount = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]);
-	do {
+
+	for(;;) {
 		if (pc_isdead(sd))
 			break;
 
@@ -9391,7 +9392,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
 			break;
 
 		return;
-	} while (0);
+	}
 
 	//Because the client does not like being ignored.
 	clif_dropitem(sd, item_index,0);

+ 1 - 1
src/map/map.c

@@ -2906,7 +2906,7 @@ int map_readallmaps (void)
 	int i;
 	FILE* fp=NULL;
 	int maps_removed = 0;
-	unsigned char *map_cache_buffer; // Has the uncompressed gat data of all maps, so just one allocation has to be made
+	unsigned char *map_cache_buffer = NULL; // Has the uncompressed gat data of all maps, so just one allocation has to be made
 	unsigned char map_cache_decode_buffer[MAX_MAP_SIZE];
 
 	if( enable_grf )

+ 4 - 4
src/map/npc.c

@@ -1152,8 +1152,8 @@ static int npc_buylist_sub(struct map_session_data* sd, int n, unsigned short* i
 	// save list of bought items
 	for( i = 0; i < n; i++ )
 	{
-		script_setarray_pc(sd, "@bought_nameid", i, (void*)item_list[i*2+1], &key_nameid);
-		script_setarray_pc(sd, "@bought_quantity", i, (void*)item_list[i*2], &key_amount);
+		script_setarray_pc(sd, "@bought_nameid", i, (void*)(intptr)item_list[i*2+1], &key_nameid);
+		script_setarray_pc(sd, "@bought_quantity", i, (void*)(intptr)item_list[i*2], &key_amount);
 	}
 
 	// invoke event
@@ -1418,8 +1418,8 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
 
 		if( nd )
 		{
-			script_setarray_pc(sd, "@sold_nameid", i, (void*)sd->status.inventory[idx].nameid, &key_nameid);
-			script_setarray_pc(sd, "@sold_quantity", i, (void*)qty, &key_amount);
+			script_setarray_pc(sd, "@sold_nameid", i, (void*)(intptr)sd->status.inventory[idx].nameid, &key_nameid);
+			script_setarray_pc(sd, "@sold_quantity", i, (void*)(intptr)qty, &key_amount);
 		}
 		pc_delitem(sd,idx,qty,0,6);
 	}

+ 1 - 1
src/map/path.c

@@ -345,7 +345,7 @@ bool path_search(struct walkpath_data *wpd,int m,int x0,int y0,int x1,int y1,int
 	xs = md->xs-1; // あらかじめ1減算しておく
 	ys = md->ys-1;
 
-	while(1)
+	for(;;)
 	{
 		int e=0,f=0,dist,cost,dc[4]={0,0,0,0};