Changeset 131 for abuse/trunk
- Timestamp:
- Mar 22, 2008, 11:03:33 AM (15 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/cache.cpp
r129 r131 15 15 16 16 #include <fcntl.h> 17 #include <string.h> 17 18 18 19 #include "cache.hpp" … … 139 140 CrcedFile::CrcedFile(char const *name) 140 141 { 141 filename =strcpy((char *)malloc(strlen(name)+1),name);142 filename = strdup(name); 142 143 crc_calculated=0; 143 144 } -
abuse/trunk/src/chars.hpp
r129 r131 11 11 #define __CHARACTERZ_HPP_ 12 12 13 #include <string.h> 13 14 14 15 #include "seq.hpp" … … 21 22 22 23 23 enum character_state {dead,24 dieing, 25 stopped,26 start_run_jump,run_jump, run_jump_fall, end_run_jump,27 flinch_up,flinch_down,28 morph_pose,29 running30 } ;31 32 24 enum character_state 25 { 26 dead, 27 dieing, 28 stopped, 29 start_run_jump, run_jump, run_jump_fall, end_run_jump, 30 flinch_up, flinch_down, 31 morph_pose, 32 running 33 }; 33 34 34 35 #define MAX_STATE (running+1) … … 41 42 char *descript_name; 42 43 named_field(char *real, char *fake) 43 { real_name =strcpy((char *)malloc(strlen(real) + 1),real);44 descript_name =strcpy((char *)malloc(strlen(fake) + 1),fake);44 { real_name = strdup(real); 45 descript_name = strdup(fake); 45 46 } 46 47 ~named_field() { free(real_name); free(descript_name); } -
abuse/trunk/src/clisp.cpp
r129 r131 9 9 10 10 #include "config.h" 11 12 #include <string.h> 11 13 12 14 #include "sdlport/joy.hpp" … … 779 781 } 780 782 781 object_names[total_objects]=strcpy( 782 (char *)malloc(strlen(lstring_value(symbol_name(sym)))+1), 783 lstring_value(symbol_name(sym))); 783 object_names[total_objects] = strdup(lstring_value(symbol_name(sym))); 784 784 figures[total_objects]=new character_type(CDR(args),sym); 785 785 total_objects++; -
abuse/trunk/src/console.cpp
r129 r131 12 12 #include <ctype.h> 13 13 #include <stdarg.h> 14 #include <string.h> 14 15 15 16 #include "game.hpp" … … 85 86 lastx=xres/2-screen_w()/2; 86 87 lasty=yres/2-screen_h()/2; 87 name =(char *)strcpy((char *)malloc(strlen(Name)+1),Name);88 name = strdup(Name); 88 89 } 89 90 -
abuse/trunk/src/dev.cpp
r129 r131 11 11 12 12 #include <ctype.h> 13 #include <string.h> 13 14 14 15 #include "dev.hpp" … … 2926 2927 Cell *ao=(Cell *)args; 2927 2928 2928 name =strcpy((char *)malloc(strlen(lstring_value(CAR(args)))+1),lstring_value(CAR(args)));2929 name = strdup(lstring_value(CAR(args))); 2929 2930 ao=CDR(ao); 2930 2931 scale=w=h=1; -
abuse/trunk/src/imlib/guistat.cpp
r129 r131 9 9 10 10 #include "config.h" 11 12 #include <string.h> 11 13 12 14 #include "input.hpp" … … 25 27 time_marker last_time; 26 28 gui_status_node(char const *Name, visual_object *Show, gui_status_node *Next) 27 { name =strcpy((char *)malloc(strlen(Name)+1),Name);29 { name = strdup(Name); 28 30 show=Show; 29 31 next=Next; -
abuse/trunk/src/imlib/input.cpp
r129 r131 9 9 10 10 #include "config.h" 11 12 #include <string.h> 11 13 12 14 #include "input.hpp" … … 221 223 x=X; y=Y; id=ID; 222 224 act_id=-1; 223 text =strcpy((char *)malloc(strlen(Text)+1),Text);225 text = strdup(Text); 224 226 up=1; next=Next; act=0; 225 227 visual=NULL; … … 334 336 335 337 x=X; y=Y; id=ID; 336 prompt =strcpy((char *)malloc(strlen(Prompt)+1),Prompt);338 prompt = strdup(Prompt); 337 339 format=strcpy((char *)malloc(slen+1),Format); 338 340 data=strcpy((char *)malloc(slen+1),Data); … … 349 351 int slen=(strlen(Format)>strlen(num) ? strlen(Format) : strlen(num)); 350 352 x=X; y=Y; id=ID; 351 prompt =strcpy((char *)malloc(strlen(Prompt)+1),Prompt);353 prompt = strdup(Prompt); 352 354 format=strcpy((char *)malloc(slen+1),Format); 353 355 data=strcpy((char *)malloc(slen+1),num); … … 460 462 { 461 463 x = X; y = Y; id = ID; next = Next; 462 text = str cpy((char *)malloc(strlen(info)+1),info);464 text = strdup(info); 463 465 w = -1; 464 466 } -
abuse/trunk/src/imlib/jwindow.cpp
r129 r131 9 9 10 10 #include "config.h" 11 12 #include <string.h> 11 13 12 14 #include "video.hpp" … … 394 396 _name = NULL; 395 397 if(name) 396 _name = str cpy((char *)malloc(strlen(name) + 1),name);398 _name = strdup(name); 397 399 wm->add_window(this); 398 400 } … … 440 442 _name = NULL; 441 443 if(name) 442 _name = str cpy((char *)malloc(strlen(name) + 1),name);444 _name = strdup(name); 443 445 444 446 wm->add_window(this); -
abuse/trunk/src/imlib/pmenu.cpp
r129 r131 10 10 #include "config.h" 11 11 12 #include <string.h> 13 12 14 #include "pmenu.hpp" 13 15 … … 60 62 on_off=on_off_flag; 61 63 if (Name) 62 n =strcpy((char *)malloc(strlen(Name)+1),Name);64 n = strdup(Name); 63 65 else n=NULL; 64 66 next=Next; … … 73 75 on_off=NULL; 74 76 CONDITION(Name,"Sub menu cannot have a NULL name"); 75 n =strcpy((char *)malloc(strlen(Name)+1),Name);77 n = strdup(Name); 76 78 sub=Sub; 77 79 } -
abuse/trunk/src/imlib/specs.hpp
r129 r131 10 10 #ifndef __SPECS_HPP_ 11 11 #define __SPECS_HPP_ 12 12 13 #include <stdio.h> 13 14 #include <fcntl.h> 14 15 #include <stdlib.h> 15 16 #include <stdint.h> 17 #include <string.h> 16 18 17 19 #include "linked.hpp" … … 156 158 unsigned long data_size, 157 159 unsigned long data_offset) 158 { type=spec_type; 159 name=strcpy((char *)malloc(strlen(object_name) + 1),object_name); 160 size=data_size; offset=data_offset; 160 { type = spec_type; 161 name = strdup(object_name); 162 size = data_size; 163 offset = data_offset; 161 164 } 162 165 void print(); -
abuse/trunk/src/imlib/status.cpp
r129 r131 9 9 10 10 #include "config.h" 11 12 #include <string.h> 11 13 12 14 #include "macs.hpp" … … 24 26 int last_update; 25 27 text_status_node(char const *Name, visual_object *Show, text_status_node *Next) 26 { name =strcpy((char *)malloc(strlen(Name)+1),Name);27 show =Show;28 next =Next;29 last_update =0;28 { name = strdup(Name); 29 show = Show; 30 next = Next; 31 last_update = 0; 30 32 } 31 33 ~text_status_node() { free(name); if (show) delete show; } -
abuse/trunk/src/imlib/visobj.cpp
r129 r131 9 9 10 10 #include "config.h" 11 12 #include <string.h> 11 13 12 14 #include "input.hpp" … … 25 27 string_visual::string_visual(char *string, int Color) 26 28 { 27 st=strcpy((char *)malloc(strlen(string)+1),string);28 color=Color;29 w=-1;29 st = strdup(string); 30 color = Color; 31 w = -1; 30 32 } 31 33 -
abuse/trunk/src/level.cpp
r129 r131 14 14 #endif 15 15 16 #include <string.h> 16 17 #include <limits.h> 17 18 #include <time.h> … … 1296 1297 sprintf(cmd,symbol_str("loading"),lev_name); 1297 1298 stack_stat stat(cmd); 1298 Name =strcpy((char *)malloc(strlen(lev_name)+1),lev_name);1299 Name = strdup(lev_name); 1299 1300 1300 1301 e=sd->find("first name"); … … 1307 1308 } else 1308 1309 { 1309 first_name=(char *)malloc(strlen(Name)+1); 1310 strcpy(first_name,Name); 1310 first_name = strdup(Name); 1311 1311 } 1312 1312 … … 2239 2239 if( first_name ) 2240 2240 free(first_name); 2241 first_name = (char *)malloc( strlen( name ) + 1 ); 2242 strcpy( first_name, name ); 2241 first_name = strdup(name); 2243 2242 } 2244 2243 -
abuse/trunk/src/oldhelp.cpp
r129 r131 10 10 #include "config.h" 11 11 12 #include <string.h> 13 12 14 #include "help.hpp" 13 15 #include "game.hpp" … … 44 46 if (line[0]=='.') 45 47 { 46 fclose(fp);47 return str cpy((char *)malloc(strlen(tmp)+1),tmp);48 fclose(fp); 49 return strdup(tmp); 48 50 } 49 51 else strcat(tmp,line); -
abuse/trunk/src/property.cpp
r129 r131 24 24 int def_num; 25 25 property(char const *Name, int Def) 26 { name =strcpy((char *)malloc(strlen(Name)+1),Name);27 def_num =Def;28 def_str =NULL;29 next =NULL;26 { name = strdup(Name); 27 def_num = Def; 28 def_str = NULL; 29 next = NULL; 30 30 } 31 31 32 32 property(char const *Name, char const *Def) 33 { name =strcpy((char *)malloc(strlen(Name)+1),Name);34 def_str =strcpy((char *)malloc(strlen(Def)+1),Def);35 next =NULL;33 { name = strdup(Name); 34 def_str = strdup(Def); 35 next = NULL; 36 36 } 37 37 … … 52 52 def_str=NULL; 53 53 } 54 def_str =strcpy((char *)malloc(strlen(x)+1),x);54 def_str = strdup(x); 55 55 } 56 56 -
abuse/trunk/src/scene.cpp
r129 r131 12 12 #include <stdio.h> 13 13 #include <stdlib.h> 14 #include <string.h> 14 15 #include <ctype.h> 15 16 #include <fcntl.h> … … 32 33 public : 33 34 string_node(char *Name, string_node *Left=NULL, string_node *Right=NULL) 34 { l =Left;35 r =Right;36 n =strcpy((char *)malloc(strlen(Name)+1),Name);35 { l = Left; 36 r = Right; 37 n = strdup(Name); 37 38 } 38 39 ~string_node() { free(n); } … … 132 133 133 134 expect(get_token(s,tmp_name),sWORD,s); 134 n =strcpy((char *)malloc(strlen(tmp_name)+1),tmp_name);135 cur =first=new scene_frame(s);135 n = strdup(tmp_name); 136 cur = first=new scene_frame(s); 136 137 137 138 while (token_type(s)!=sRIGHT_PAREN) … … 271 272 expect(get_token(s,tmp),sLEFT_PAREN,s); 272 273 expect(get_token(s,tmp),sWORD,s); 273 n =strcpy((char *)malloc(strlen(tmp)+1),tmp);274 n = strdup(tmp); 274 275 expect(get_token(s,tmp),sNUMBER,s); 275 276 -
abuse/trunk/src/sdlport/jdir.cpp
r129 r131 20 20 #include "config.h" 21 21 22 #include <sys/types.h>23 22 #include <stdio.h> 24 #include <dirent.h>25 23 #include <stdlib.h> 26 24 #include <string.h> 25 26 #include <sys/types.h> 27 #include <dirent.h> 27 28 #include <unistd.h> 28 29 … … 52 53 t++; 53 54 tlist = (char **)realloc(tlist,sizeof(char *)*t); 54 tlist[t-1] = str cpy((char *)malloc(strlen(de->d_name)+1),de->d_name);55 tlist[t-1] = strdup(de->d_name); 55 56 } 56 57 } while( de ); … … 64 65 tdirs++; 65 66 dirs = (char **)realloc(dirs,sizeof(char *)*tdirs); 66 dirs[tdirs-1] = str cpy((char *)malloc(strlen(tlist[i])+1),tlist[i]);67 dirs[tdirs-1] = strdup(tlist[i]); 67 68 closedir( d ); 68 69 } … … 71 72 tfiles++; 72 73 files = (char **)realloc(files,sizeof(char *)*tfiles); 73 files[tfiles-1] = str cpy((char *)malloc(strlen(tlist[i])+1),tlist[i]);74 files[tfiles-1] = strdup(tlist[i]); 74 75 } 75 76 free( tlist[i] ); -
abuse/trunk/src/sdlport/sound.cpp
r129 r131 19 19 20 20 #include "config.h" 21 22 #include <string.h> 21 23 22 24 #include <SDL.h> … … 295 297 { 296 298 data = NULL; 297 Name = str cpy((char *)malloc( strlen( filename ) + 1 ), filename);299 Name = strdup(filename); 298 300 song_id = 0; 299 301 } -
abuse/trunk/src/specache.hpp
r129 r131 13 13 #include "specs.hpp" 14 14 15 #include <string.h> 15 16 16 17 class spec_directory_cache … … 25 26 filename_node(char const *filename, spec_directory *dir) 26 27 { 27 fn =(char *)memcpy(malloc(strlen(filename) + 1),filename,strlen(filename)+1);28 sd =dir;29 next =left=right=0;28 fn = strdup(filename); 29 sd = dir; 30 next = left = right = 0; 30 31 } 31 32 long size; -
abuse/trunk/src/status.cpp
r129 r131 9 9 10 10 #include "config.h" 11 12 #include <string.h> 11 13 12 14 #include "macs.hpp" … … 39 41 time_marker last_update; 40 42 status_node(char *Name, visual_object *Show, status_node *Next) 41 { name =strcpy((char *)malloc(strlen(Name)+1),Name);42 show =Show;43 next =Next;43 { name = strdup(Name); 44 show = Show; 45 next = Next; 44 46 } 45 47 ~status_node() { free(name); if (show) delete show; }
Note: See TracChangeset
for help on using the changeset viewer.