/[LeafOK_CVS]/lbbs/src/file_loader.c
ViewVC logotype

Diff of /lbbs/src/file_loader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.16 by sysadm, Wed Jul 2 03:08:10 2025 UTC Revision 1.17 by sysadm, Sat Oct 18 12:06:10 2025 UTC
# Line 149  int load_file(const char *filename) Line 149  int load_file(const char *filename)
149          ((struct shm_header_t *)p_shm)->shmid = shmid;          ((struct shm_header_t *)p_shm)->shmid = shmid;
150          ((struct shm_header_t *)p_shm)->data_len = data_len;          ((struct shm_header_t *)p_shm)->data_len = data_len;
151          ((struct shm_header_t *)p_shm)->line_total = line_total;          ((struct shm_header_t *)p_shm)->line_total = line_total;
152          memcpy(p_shm + sizeof(struct shm_header_t), p_data, data_len);          memcpy((char *)p_shm + sizeof(struct shm_header_t), p_data, data_len);
153    
154          if (munmap(p_data, data_len) < 0)          if (munmap(p_data, data_len) < 0)
155          {          {
# Line 157  int load_file(const char *filename) Line 157  int load_file(const char *filename)
157                  return -2;                  return -2;
158          }          }
159    
160          p_data = p_shm + sizeof(struct shm_header_t);          p_data = (char *)p_shm + sizeof(struct shm_header_t);
161          p_line_offsets = p_data + data_len + 1;          p_line_offsets = (long *)((char *)p_data + data_len + 1);
162          memcpy(p_line_offsets, line_offsets, sizeof(long) * (size_t)(line_total + 1));          memcpy(p_line_offsets, line_offsets, sizeof(long) * (size_t)(line_total + 1));
163    
164          if (shmdt(p_shm) == -1)          if (shmdt(p_shm) == -1)
# Line 241  const void *get_file_shm_readonly(const Line 241  const void *get_file_shm_readonly(const
241    
242          *p_data_len = ((struct shm_header_t *)p_shm)->data_len;          *p_data_len = ((struct shm_header_t *)p_shm)->data_len;
243          *p_line_total = ((struct shm_header_t *)p_shm)->line_total;          *p_line_total = ((struct shm_header_t *)p_shm)->line_total;
244          *pp_data = p_shm + sizeof(struct shm_header_t);          *pp_data = (char *)p_shm + sizeof(struct shm_header_t);
245          *pp_line_offsets = *pp_data + *p_data_len + 1;          *pp_line_offsets = (const long *)((const char *)(*pp_data) + *p_data_len + 1);
246    
247          return p_shm;          return p_shm;
248  }  }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1