~ubuntu-branches/ubuntu/precise/xorg-server/precise-updates

« back to all changes in this revision

Viewing changes to xkb/xkmread.c

  • Committer: Package Import Robot
  • Author(s): Christopher James Halse Rogers
  • Date: 2012-01-23 16:09:29 UTC
  • mfrom: (1.1.46) (0.11.34 sid)
  • Revision ID: package-import@ubuntu.com-20120123160929-k4xdb9b7xeesiukp
Tags: 2:1.11.3-0ubuntu8
* debian/patches/224_return_BadWindow_not_BadMatch.diff:
  - Fix the error values of a whole slew of window-related calls.
    Fixes some gnome-settings-daemon aborts in XLib (LP: #903973)

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    return MakeAtom(str,strlen(str),!only_if_exists);
52
52
}
53
53
 
54
 
char *
55
 
_XkbDupString(const char *str)
56
 
{
57
 
char *new;
58
 
   
59
 
   if (str==NULL)
60
 
        return NULL;
61
 
   new= calloc(strlen(str)+1,sizeof(char));
62
 
   if (new)
63
 
        strcpy(new,str);
64
 
   return new;
65
 
}
66
 
 
67
54
/***====================================================================***/
68
55
 
69
56
static void *
438
425
    if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_si)!=Success)
439
426
        return -1;
440
427
    compat= xkb->compat;
441
 
    compat->num_si= num_si;
 
428
    compat->num_si= 0;
442
429
    interp= compat->sym_interpret;
443
 
    for (i=0;i<num_si;i++,interp++) {
 
430
    for (i=0;i<num_si;i++) {
444
431
        tmp= fread(&wire,SIZEOF(xkmSymInterpretDesc),1,file);
445
432
        nRead+= tmp*SIZEOF(xkmSymInterpretDesc);
446
433
        interp->sym= wire.sym;
533
520
            break;
534
521
 
535
522
        case XkbSA_XFree86Private:
 
523
            /*
 
524
             * Bugfix for broken xkbcomp: if we encounter an XFree86Private
 
525
             * action with Any+AnyOfOrNone(All), then we skip the interp as
 
526
             * broken.  Versions of xkbcomp below 1.2.2 had a bug where they
 
527
             * would interpret a symbol that couldn't be found in an interpret
 
528
             * as Any.  So, an XF86LogWindowTree+AnyOfOrNone(All) interp that
 
529
             * triggered the PrWins action would make every key without an
 
530
             * action trigger PrWins if libX11 didn't yet know about the
 
531
             * XF86LogWindowTree keysym.  None too useful.
 
532
             *
 
533
             * We only do this for XFree86 actions, as the current XKB
 
534
             * dataset relies on Any+AnyOfOrNone(All) -> SetMods for Ctrl in
 
535
             * particular.
 
536
             *
 
537
             * See xkbcomp commits 2a473b906943ffd807ad81960c47530ee7ae9a60 and
 
538
             * 3caab5aa37decb7b5dc1642a0452efc3e1f5100e for more details.
 
539
             */
 
540
            if (interp->sym == NoSymbol && interp->match == XkbSI_AnyOfOrNone &&
 
541
                (interp->mods & 0xff) == 0xff) {
 
542
                ErrorF("XKB: Skipping broken Any+AnyOfOrNone(All) -> Private "
 
543
                       "action from compiled keymap\n");
 
544
                continue;
 
545
            }
536
546
            /* copy the kind of action */
537
547
            memcpy(act->any.data, wire.actionData, XkbAnyActionDataSize);
538
548
            break ;
544
554
            /* unsupported. */
545
555
            break;
546
556
        }
 
557
        interp++;
 
558
        compat->num_si++;
547
559
    }
548
560
    if ((num_si>0)&&(changes)) {
549
561
        changes->compat.first_si= 0;
550
 
        changes->compat.num_si= num_si;
 
562
        changes->compat.num_si= compat->num_si;
551
563
    }
552
564
    if (groups) {
553
565
        register unsigned bit;
845
857
            doodad->text.height= doodadWire.text.height;
846
858
            doodad->text.color_ndx= doodadWire.text.color_ndx;
847
859
            nRead+= XkmGetCountedString(file,buf,100);
848
 
            doodad->text.text= _XkbDupString(buf);
 
860
            doodad->text.text= Xstrdup(buf);
849
861
            nRead+= XkmGetCountedString(file,buf,100);
850
 
            doodad->text.font= _XkbDupString(buf);
 
862
            doodad->text.font= Xstrdup(buf);
851
863
            break;
852
864
        case XkbIndicatorDoodad:
853
865
            doodad->indicator.shape_ndx= doodadWire.indicator.shape_ndx;
859
871
            doodad->logo.color_ndx= doodadWire.logo.color_ndx;
860
872
            doodad->logo.shape_ndx= doodadWire.logo.shape_ndx;
861
873
            nRead+= XkmGetCountedString(file,buf,100);
862
 
            doodad->logo.logo_name= _XkbDupString(buf);
 
874
            doodad->logo.logo_name= Xstrdup(buf);
863
875
            break;
864
876
        default:
865
877
            /* report error? */
1021
1033
    geom->width_mm= wireGeom.width_mm;
1022
1034
    geom->height_mm= wireGeom.height_mm;
1023
1035
    nRead+= XkmGetCountedString(file,buf,100);
1024
 
    geom->label_font= _XkbDupString(buf);
 
1036
    geom->label_font= Xstrdup(buf);
1025
1037
    if (wireGeom.num_properties>0) {
1026
1038
        char val[1024];
1027
1039
        for (i=0;i<wireGeom.num_properties;i++) {