소스 검색

Made some more changes, reverted some old ones

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@969 54d463be-8e91-2dee-dedb-b68131a5f0ec
(no author) 20 년 전
부모
커밋
5618dc9edc
6개의 변경된 파일22개의 추가작업 그리고 18개의 파일을 삭제
  1. 6 2
      Changelog.txt
  2. 2 2
      src/common/grfio.h
  3. 5 5
      src/map/map.c
  4. 2 2
      src/map/map.h
  5. 5 5
      src/map/script.c
  6. 2 2
      src/map/script.h

+ 6 - 2
Changelog.txt

@@ -1,11 +1,15 @@
 Date	Added
 
 01/23
+	* Reverted back some of the char* changes [SVN 969] [Ajarn]
+	* Changed parse_script to now return char* [SVN 969] [Ajarn] 
+	* Converted run_script and run_script_main from unsigned char* to char*
+	  [SVN 969] [Ajarn]
 	* Forgot a couple small changes [SVN 35] [Ajarn]
 	* Changed map_data.gat and map_data_other_server.gat from unsigned char*
 	  to char* (this might be needed, because of unicode or something, please
 	  correct me if I'm wrong) [SVN 34] [Ajarn]
-	* Converted decode_zip, enconde_zip, remove_control_chars, mapif_sendall*,
+	* Converted decode_zip, encode_zip, remove_control_chars, mapif_sendall*,
 	  and e_mail_check to use char* instead of unsigned char* (again, please test)
 	  [SVN 34] [Ajarn]
         * Modified skill unit group checking in skill_unit_onplace that might have
@@ -18,7 +22,7 @@ Date	Added
 	* Fixed an error that was in my last commit (optimising g++ build) [SVN 29]
 	  [Ajarn]
 	* Made strlib functions char*, instead of unsigned char*. Strings are meant
-	  to be char. (Shouldn't break anyhting, but might, please test this for me)
+	  to be char. (Shouldn't break anything, but might, please test this for me)
 	  [SVN 26] [Ajarn]
 	* Added cast for TXT version [SVN 25] [Ajarn]
 	* Added cast from allocation calls, from void* to intended type [SVN 24] [Ajarn]

+ 2 - 2
src/common/grfio.h

@@ -8,8 +8,8 @@ void* grfio_read(char*);		// GRFIO data file read
 void* grfio_reads(char*,int*);	// GRFIO data file read & size get
 int grfio_size(char*);			// GRFIO data file size get
 
-int decode_zip(char *dest, unsigned long* destLen, const char* source, unsigned long sourceLen);
-int encode_zip(char *dest, unsigned long* destLen, const char* source, unsigned long sourceLen);
+int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
+int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
 
 // Accessor to GRF filenames
 char *grfio_setdatafile(const char *str);

+ 5 - 5
src/map/map.c

@@ -1652,8 +1652,8 @@ int map_cache_read(struct map_data *m) {
 
 static int map_cache_write(struct map_data *m) {
 	int i;
-	unsigned long len_new , len_old;
-	char *write_buf;
+	unsigned long len_new, len_old;
+	unsigned char *write_buf;
 	if(!map_cache.fp) { return 0; }
 	for(i = 0;i < map_cache.head.nmaps ; i++) {
 		if(!strcmp(m->name,map_cache.map[i].fn)) {
@@ -1669,7 +1669,7 @@ static int map_cache_write(struct map_data *m) {
 			if(map_read_flag >= READ_FROM_BITMAP_COMPRESSED) {
 				// 圧縮保存
 				// さすがに2倍に膨れる事はないという事で
-				write_buf = (char*)aMallocA(m->xs * m->ys * 2);
+				write_buf = (unsigned char*)aMallocA(m->xs * m->ys * 2);
 				len_new = m->xs * m->ys * 2;
 				encode_zip(write_buf,&len_new,m->gat,m->xs * m->ys);
 				map_cache.map[i].compressed     = 1;
@@ -1706,7 +1706,7 @@ static int map_cache_write(struct map_data *m) {
 		if(map_cache.map[i].fn[0] == 0) {
 			// 新しい場所に登録
 			if(map_read_flag >= READ_FROM_BITMAP_COMPRESSED) {
-				write_buf = (char*)aMallocA(m->xs * m->ys * 2);
+				write_buf = (unsigned char*)aMallocA(m->xs * m->ys * 2);
 				len_new = m->xs * m->ys * 2;
 				encode_zip(write_buf,&len_new,m->gat,m->xs * m->ys);
 				map_cache.map[i].compressed     = 1;
@@ -1929,7 +1929,7 @@ static int map_readmap(int m,char *fn, char *alias, int *map_cache, int maxmap)
 		struct gat_1cell {float high[4]; int type;} *p=NULL;
 		// read & convert fn
 		// again, might not need to be unsigned char
-		gat = grfio_read(fn);
+		gat = (char*)grfio_read(fn);
 		if(gat==NULL) {
 			return -1;
 			// さすがにマップが読めないのはまずいので終了する

+ 2 - 2
src/map/map.h

@@ -510,7 +510,7 @@ enum {
 
 struct map_data {
 	char name[24];
-	char *gat;	// NULLなら下のmap_data_other_serverとして扱う
+	unsigned char *gat;	// NULLなら下のmap_data_other_serverとして扱う
 	char *alias; // [MouseJstr]
 	int *gat_fileused[MAX_CELL_TYPE+1+1]; //もしビットマップを使うならこちらを使う、
 						//上のgatはキャストされてgat_fileused[0]に指す
@@ -563,7 +563,7 @@ struct map_data {
 };
 struct map_data_other_server {
 	char name[24];
-	char *gat;	// NULL固定にして判断
+	unsigned char *gat;	// NULL固定にして判断
 	unsigned long ip;
 	unsigned int port;
 };

+ 5 - 5
src/map/script.c

@@ -1148,7 +1148,7 @@ static void read_constdb(void)
  * スクリプトの解析
  *------------------------------------------
  */
-unsigned char* parse_script(unsigned char *src,int line)
+char* parse_script(unsigned char *src,int line)
 {
 	unsigned char *p,*tmpp;
 	int i;
@@ -6875,7 +6875,7 @@ int run_func(struct script_state *st)
  * スクリプトの実行メイン部分
  *------------------------------------------
  */
-int run_script_main(unsigned char *script,int pos,int rid,int oid,struct script_state *st,unsigned char *rootscript)
+int run_script_main(char *script,int pos,int rid,int oid,struct script_state *st,char *rootscript)
 {
 	int c,rerun_pos;
 	int cmdcount=script_config.check_cmdcount;
@@ -7009,17 +7009,17 @@ int run_script_main(unsigned char *script,int pos,int rid,int oid,struct script_
  * スクリプトの実行
  *------------------------------------------
  */
-int run_script(unsigned char *script,int pos,int rid,int oid)
+int run_script(char *script,int pos,int rid,int oid)
 {
 	struct script_stack stack;
 	struct script_state st;
 	struct map_session_data *sd=map_id2sd(rid);
-	unsigned char *rootscript=script;
+	char *rootscript=script;
 
 	if(script==NULL || pos<0)
 		return -1;
 
-	if(sd && sd->npc_stackbuf && sd->npc_scriptroot==(char*)rootscript){
+	if(sd && sd->npc_stackbuf && sd->npc_scriptroot==rootscript){
 		// 前回のスタックを復帰
 		script=sd->npc_script;
 		stack.sp=sd->npc_stack;

+ 2 - 2
src/map/script.h

@@ -32,8 +32,8 @@ struct script_state {
 	int defsp,new_pos,new_defsp;
 };
 
-unsigned char * parse_script(unsigned char *,int);
-int run_script(unsigned char *,int,int,int);
+char * parse_script(unsigned char *,int);
+int run_script(char *,int,int,int);
 
 struct dbt* script_get_label_db();
 struct dbt* script_get_userfunc_db();