Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at mbox-sync-update.c:66

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

mbox_sync_move_buffer

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/mbox/mbox-sync-update.c)expand/collapse
Show more  
 29  void mbox_sync_move_buffer(struct mbox_sync_mail_context *ctx,
 30                             size_t pos, size_t need, size_t have)
 31  {
 32          ssize_t diff = (ssize_t)need - (ssize_t)have;
 33          int i;
 34   
 35          i_assert(have < SSIZE_T_MAX);
 36   
 37          if (diff == 0) {
 38                  if (ctx->header_last_change < pos + have ||
 39                      ctx->header_last_change == (size_t)-1)
 40                          ctx->header_last_change = pos + have;
 41          } else {
 42                  /* FIXME: if (diff < ctx->space && pos < ctx->offset) then 
 43                     move the data only up to space offset and give/take the 
 44                     space from there. update header_last_change accordingly.
 45                     (except pos and offset can't be compared directly) */
 46                  ctx->header_last_change = (size_t)-1;
 47                  for (i = 0; i < MBOX_HDR_COUNT; i++) {
 48                          if (ctx->hdr_pos[i] > pos &&
 49                              ctx->hdr_pos[i] != (size_t)-1)
 50                                  ctx->hdr_pos[i] += diff;
 51                  }
 52   
 53                  if (ctx->mail.space > 0) {
 54                          i_assert(ctx->mail.offset + ctx->mail.space <=
 55                                   ctx->hdr_offset + pos ||
 56                                   ctx->mail.offset > ctx->hdr_offset + pos + have);
 57                          if (ctx->mail.offset > ctx->hdr_offset + pos) {
 58                                  /* free space offset moves */
 59                                  ctx->mail.offset += diff;
 60                          }
 61                  }
 62   
 63                  if (diff < 0)
 64                          str_delete(ctx->header, pos, -diff);
 65                  else {
 66                          ctx->header_last_change = (size_t)-1;
 67                          buffer_copy(ctx->header, pos + diff,
 68                                      ctx->header, pos, (size_t)-1);
 69                  }
 70          }
 71  }
Show more  




Change Warning 7400.24491 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: