Changeset 392 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Feb 11, 2013, 1:52:15 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r387 r392 2 2 * Author : Gérald FENOY 3 3 * 4 * Copyright (c) 2009-201 2GeoLabs SARL4 * Copyright (c) 2009-2013 GeoLabs SARL 5 5 * 6 6 * Permission is hereby granted, free of charge, to any person obtaining a copy … … 2518 2518 fprintf(stderr,"MD5STR : (%s)\n\n",md5str); 2519 2519 #endif 2520 char* fname=(char*)malloc(sizeof(char)*(strlen(tmpM->value)+ 50));2520 char* fname=(char*)malloc(sizeof(char)*(strlen(tmpM->value)+strlen(md5str)+6)); 2521 2521 sprintf(fname,"%s/%s.zca",tmpM->value,md5str); 2522 2522 struct stat f_status; … … 2548 2548 fcontent=(char*)malloc(sizeof(char)*(f_status.st_size+1)); 2549 2549 FILE* f=fopen(cached,"rb"); 2550 fread(fcontent,sizeof(char),f_status.st_size,f);2550 int len=fread(fcontent,f_status.st_size,1,f); 2551 2551 fsize=f_status.st_size; 2552 hasF=1;2552 fcontent[fsize]=0; 2553 2553 } 2554 2554 }else{ … … 2558 2558 return errorException(m, _("Unable to allocate memory."), "InternalError"); 2559 2559 } 2560 hasF=1;2561 2560 size_t dwRead; 2562 2561 InternetReadFile(res, (LPVOID)fcontent, res.nDataLen, &dwRead); … … 2574 2573 if(tmpMap->value==NULL) 2575 2574 fprintf(stderr,"Unable to allocate memory!\n"); 2576 memcpy(tmpMap->value,fcontent,(fsize)*sizeof(char)); 2575 //snprintf(tmpMap->value,(fsize+1)*sizeof(char),fcontent); 2576 memcpy(tmpMap->value,fcontent,(fsize+1)*sizeof(char)); 2577 2577 2578 2578 char ltmp1[256]; … … 2582 2582 addToCache(m,url,fcontent,fsize); 2583 2583 else{ 2584 if(hasF)2585 free(fcontent);2586 2584 free(cached); 2587 2585 }
Note: See TracChangeset
for help on using the changeset viewer.