~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/charset.c

Merged.

Show diffs side-by-side

added added

removed removed

Lines of Context:
360
360
  if (stat(filename, &stat_info) ||
361
361
       ((len= (uint)stat_info.st_size) > MY_MAX_ALLOWED_BUF) ||
362
362
       !(buf= (uchar*) my_malloc(len,myflags)))
363
 
    return TRUE;
 
363
    return true;
364
364
  
365
365
  if ((fd=my_open(filename,O_RDONLY,myflags)) < 0)
366
366
    goto error;
380
380
  }
381
381
  
382
382
  my_free(buf, myflags);
383
 
  return FALSE;
 
383
  return false;
384
384
 
385
385
error:
386
386
  my_free(buf, myflags);
387
 
  return TRUE;
 
387
  return true;
388
388
}
389
389
 
390
390
 
428
428
static bool init_available_charsets(myf myflags)
429
429
{
430
430
  char fname[FN_REFLEN + sizeof(MY_CHARSET_INDEX)];
431
 
  bool error=FALSE;
 
431
  bool error=false;
432
432
  /*
433
433
    We have to use charset_initialized to not lock on THR_LOCK_charset
434
434
    inside get_internal_charset...
617
617
 
618
618
  The function tries to resolve character set by the specified name. If
619
619
  there is character set with the given name, it is assigned to the "cs"
620
 
  parameter and FALSE is returned. If there is no such character set,
621
 
  "default_cs" is assigned to the "cs" and TRUE is returned.
 
620
  parameter and false is returned. If there is no such character set,
 
621
  "default_cs" is assigned to the "cs" and true is returned.
622
622
 
623
623
  @param[in] cs_name    Character set name.
624
624
  @param[in] default_cs Default character set.
625
625
  @param[out] cs        Variable to store character set.
626
626
 
627
 
  @return FALSE if character set was resolved successfully; TRUE if there
 
627
  @return false if character set was resolved successfully; true if there
628
628
  is no character set with given name.
629
629
*/
630
630
 
637
637
  if (*cs == NULL)
638
638
  {
639
639
    *cs= default_cs;
640
 
    return TRUE;
 
640
    return true;
641
641
  }
642
642
 
643
 
  return FALSE;
 
643
  return false;
644
644
}
645
645
 
646
646
 
649
649
 
650
650
  The function tries to resolve collation by the specified name. If there
651
651
  is collation with the given name, it is assigned to the "cl" parameter
652
 
  and FALSE is returned. If there is no such collation, "default_cl" is
653
 
  assigned to the "cl" and TRUE is returned.
 
652
  and false is returned. If there is no such collation, "default_cl" is
 
653
  assigned to the "cl" and true is returned.
654
654
 
655
655
  @param[out] cl        Variable to store collation.
656
656
  @param[in] cl_name    Collation name.
657
657
  @param[in] default_cl Default collation.
658
658
 
659
 
  @return FALSE if collation was resolved successfully; TRUE if there is no
 
659
  @return false if collation was resolved successfully; true if there is no
660
660
  collation with given name.
661
661
*/
662
662
 
669
669
  if (*cl == NULL)
670
670
  {
671
671
    *cl= default_cl;
672
 
    return TRUE;
 
672
    return true;
673
673
  }
674
674
 
675
 
  return FALSE;
 
675
  return false;
676
676
}
677
677
 
678
678
 
707
707
{
708
708
  const char *to_start= to;
709
709
  const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);
710
 
  bool overflow= FALSE;
 
710
  bool overflow= false;
711
711
#ifdef USE_MB
712
712
  bool use_mb_flag= use_mb(charset_info);
713
713
#endif
720
720
    {
721
721
      if (to + tmp_length > to_end)
722
722
      {
723
 
        overflow= TRUE;
 
723
        overflow= true;
724
724
        break;
725
725
      }
726
726
      while (tmp_length--)
770
770
    {
771
771
      if (to + 2 > to_end)
772
772
      {
773
 
        overflow= TRUE;
 
773
        overflow= true;
774
774
        break;
775
775
      }
776
776
      *to++= '\\';
780
780
    {
781
781
      if (to + 1 > to_end)
782
782
      {
783
 
        overflow= TRUE;
 
783
        overflow= true;
784
784
        break;
785
785
      }
786
786
      *to++= *from;
847
847
{
848
848
  const char *to_start= to;
849
849
  const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);
850
 
  bool overflow= FALSE;
 
850
  bool overflow= false;
851
851
#ifdef USE_MB
852
852
  bool use_mb_flag= use_mb(charset_info);
853
853
#endif
859
859
    {
860
860
      if (to + tmp_length > to_end)
861
861
      {
862
 
        overflow= TRUE;
 
862
        overflow= true;
863
863
        break;
864
864
      }
865
865
      while (tmp_length--)
877
877
    {
878
878
      if (to + 2 > to_end)
879
879
      {
880
 
        overflow= TRUE;
 
880
        overflow= true;
881
881
        break;
882
882
      }
883
883
      *to++= '\'';
887
887
    {
888
888
      if (to + 1 > to_end)
889
889
      {
890
 
        overflow= TRUE;
 
890
        overflow= true;
891
891
        break;
892
892
      }
893
893
      *to++= *from;