~ubuntu-branches/ubuntu/maverick/perl-tk/maverick

« back to all changes in this revision

Viewing changes to objGlue.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Tuckley
  • Date: 2010-05-30 09:19:40 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100530091940-wbmq9bloo92t9m6x
Tags: 1:804.029-1
* New Upstream Release (Closes: #578814).
* Added debian/watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
403
403
 return MakeReference((SV *) av);
404
404
}
405
405
 
 
406
static char * LangString(SV *sv);
 
407
 
 
408
/*
 
409
 * Workaround for http://rt.cpan.org/Public/Bug/Display.html?id=41436
 
410
 * This seems to be necessary for perl < 5.10.0 and if a magic
 
411
 * readonly variable like $1 is about to be utf8-ified, and only for
 
412
 * bytes >= 0x80 and <= 0xff
 
413
 *
 
414
 */
 
415
static char *
 
416
FixBuggyUTF8String(SV *sv)
 
417
{
 
418
 dTHX;
 
419
 char* s = NULL;
 
420
 if (SvREADONLY(sv))
 
421
  {
 
422
   STRLEN len = 0;
 
423
   SvREADONLY_off(sv);
 
424
   (void) SvPV_force(sv,len);
 
425
   s = LangString(sv);
 
426
   SvREADONLY_on(sv);
 
427
  }
 
428
 else
 
429
  {
 
430
   LangDebug("%s @ %d not utf8 and cannot be fixed\n",__FUNCTION__,__LINE__);
 
431
   sv_dump(sv);
 
432
   abort();
 
433
  }
 
434
 return s;
 
435
}
 
436
 
406
437
static char *
407
438
LangString(SV *sv)
408
439
{
558
589
#ifdef SvUTF8
559
590
     if (!is_utf8_string(s,strlen(s)))
560
591
      {
 
592
       s = FixBuggyUTF8String(objPtr);
 
593
      }
 
594
     if (!is_utf8_string(s,strlen(s)))
 
595
      {
561
596
       LangDebug("%s @ %d not utf8\n",__FUNCTION__,__LINE__);
562
597
       sv_dump(objPtr);
563
598
       abort();