MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / map_file

Function map_file

tools/fshtool.c:1135–1148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133}
1134
1135void map_file(char *name,unsigned char **ptr,int *size)
1136{
1137 FILE *f;
1138 f=fopen(name,"rb");
1139 if (f==NULL) { printf("Cannot open file '%s'\n",name); abandon_ship(); }
1140 fseek(f,0,SEEK_END);
1141 *size=ftell(f);
1142 rewind(f);
1143 *ptr=malloc(*size);
1144 if (*ptr==NULL) { printf("Out of memory.\n"); abandon_ship(); }
1145 if (fread(*ptr,1,*size,f)!=(size_t)*size)
1146 { printf("File read error.\n"); abandon_ship(); }
1147 fclose(f);
1148}
1149
1150void alpha8_fix_locpal(char *fname,char *alpha8,int *locpal)
1151{

Callers 3

bmp_get_fileFunction · 0.85
bmp_get_alphaFunction · 0.85
bmp_to_fshFunction · 0.85

Calls 1

abandon_shipFunction · 0.85

Tested by

no test coverage detected