Commit 892a6138 authored by unknown's avatar unknown
Browse files

Eliminate warnings noticed by VC7. This includes fixing my_mmap() on

Windows to call CreateFileMapping() with correct arguments, and
propogating the introduction of query_id_t to everywhere query ids are
passed around. (Bug #8826)


libmysql/libmysql.c:
  Make implicit cast explicit
myisam/mi_open.c:
  Make cast of value to smaller data size explicit
myisam/mi_packrec.c:
  Cast file size (my_off_t) to size_t for mmap
mysys/my_mmap.c:
  Fix Windows version of my_mmap() to use the right parameters
  for call to CreateFileMapping()
sql/field.cc:
  Use temporary value of correct type
sql/field.h:
  Use query_id_t for query_id value
sql/ha_berkeley.cc:
  Fix flag check
sql/ha_innodb.h:
  Use query_id_t for query_id value
sql/handler.cc:
  Explain opt_using_transactions calculation, and add cast
sql/handler.h:
  Fix forward declaration of COND
sql/item.cc:
  Fix val_bool() tests of val_int() to avoid implicit cast
sql/item_cmpfunc.cc:
  Fix typo in switch label
sql/item_func.cc:
  Make implicit cast explicit
sql/item_strfunc.cc:
  Now that query_id is a query_id_t, need to cast it to a ulong here
sql/item_subselect.cc:
  Fix test of value
sql/log.cc:
  Cast my_off_t used for file size to size_t for memory allocation
  Also cast my_off_t when using it to calculate the number of pages for TC log
  Cast total_ha_2pc to uchar when saving it
sql/mysql_priv.h:
  Move up query_id definition so it can be used more widely
sql/opt_range.cc:
  Add unused delete operator to prevent compiler warning
sql/set_var.cc:
  Cast value for max_user_connections
sql/sql_cache.cc:
  Remove unused label
sql/sql_class.h:
  Fix query id values to be of type query_id_t
sql/sql_db.cc:
  Move variable only used inside #ifdef within the #ifdef
sql/sql_help.cc:
  Remove unused label
sql/sql_insert.cc:
  Use query_id_t for query id values
sql/sql_lex.h:
  Add unused delete operator to prevent compiler warning
sql/sql_select.cc:
  Remove unused variable
  Make cast of value explicit
sql/sql_select.h:
  Use query_id_t for query id values
sql/sql_table.cc:
  Make comparison to function pointer explicit
sql/sql_update.cc:
  Use query_id_t for query id values
sql/table.h:
  Use query_id_t for query id values
strings/ctype-simple.c:
  Add cast of long value to (char) in expression
strings/ctype-ucs2.c:
  Add cast of long value to (char) in expression
strings/ctype-utf8.c:
  Make cast to smaller size explicit
parent 1cc46f67
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3608,7 +3608,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
    if (is_unsigned)
      data= ulonglong2double(value);
    else
      data= value;
      data= (double)value;
    doublestore(buffer, data);
    *param->error= is_unsigned ?
                   ((ulonglong) value) != ((ulonglong) (*(double*) buffer)) :
+2 −2
Original line number Diff line number Diff line
@@ -1090,10 +1090,10 @@ char *mi_keyseg_read(char *ptr, HA_KEYSEG *keyseg)
   keyseg->null_pos	= mi_uint4korr(ptr);  ptr +=4;
   keyseg->charset=0;				/* Will be filled in later */
   if (keyseg->null_bit)
     keyseg->bit_pos= keyseg->null_pos + (keyseg->null_bit == 7);
     keyseg->bit_pos= (uint16)(keyseg->null_pos + (keyseg->null_bit == 7));
   else
   {
     keyseg->bit_pos= keyseg->null_pos;
     keyseg->bit_pos= (uint16)keyseg->null_pos;
     keyseg->null_pos= 0;
   }
   return ptr;
+1 −1
Original line number Diff line number Diff line
@@ -1212,7 +1212,7 @@ my_bool _mi_memmap_file(MI_INFO *info)
      DBUG_RETURN(0);
    }
    file_map=(byte*)
      my_mmap(0,share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN,PROT_READ,
      my_mmap(0,(size_t)(share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN),PROT_READ,
	   MAP_SHARED | MAP_NORESERVE,info->dfile,0L);
    if (file_map == (byte*) MAP_FAILED)
    {
+5 −2
Original line number Diff line number Diff line
@@ -46,11 +46,14 @@ void *my_mmap(void *addr, size_t len, int prot,
  DWORD flProtect=0;
  HANDLE hFileMap;
  LPVOID ptr;
  HANDLE hFile= (HANDLE)_get_osfhandle(fd);
  if (hFile == INVALID_HANDLE_VALUE)
    return MAP_FAILED;

  flProtect|=SEC_COMMIT;

  hFileMap=CreateFileMapping(fd, NULL, &mmap_security_attributes,
                             PAGE_READWRITE, 0, len, 0);
  hFileMap=CreateFileMapping(hFile, &mmap_security_attributes,
                             PAGE_READWRITE, 0, len, NULL);
  if (hFileMap == 0)
    return MAP_FAILED;

+4 −3
Original line number Diff line number Diff line
@@ -2451,14 +2451,15 @@ static bool test_if_minus(CHARSET_INFO *cs,

int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
{
  ulong tmp_scan;
  longlong tmp;
  long store_tmp;
  int error;
  char *end;
  
  tmp= cs->cset->scan(cs, from, from+len, MY_SEQ_SPACES);
  len-= tmp;
  from+= tmp;
  tmp_scan= cs->cset->scan(cs, from, from+len, MY_SEQ_SPACES);
  len-= tmp_scan;
  from+= tmp_scan;

  end= (char*) from+len;
  tmp= cs->cset->my_strtoll10(cs, from, &end, &error);
Loading