diff options
author | marha <marha@users.sourceforge.net> | 2009-10-07 09:21:18 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-10-07 09:21:18 +0000 |
commit | b741086f4b268041e1c171c6dc4bb9182e7666d3 (patch) | |
tree | 02dfe9fd170cddb55b6532de49768133221ef3b6 /libxkbfile/src/cout.c | |
parent | f78ab58911de1fa9a15afffcd4fcdc11ae67c646 (diff) | |
parent | c73dc01b6de45612b24dc2dd34fba24d81ebf46c (diff) | |
download | vcxsrv-b741086f4b268041e1c171c6dc4bb9182e7666d3.tar.gz vcxsrv-b741086f4b268041e1c171c6dc4bb9182e7666d3.tar.bz2 vcxsrv-b741086f4b268041e1c171c6dc4bb9182e7666d3.zip |
svn merge ^/branches/released .
Diffstat (limited to 'libxkbfile/src/cout.c')
-rw-r--r-- | libxkbfile/src/cout.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/libxkbfile/src/cout.c b/libxkbfile/src/cout.c index 161bd0f89..70aa3706a 100644 --- a/libxkbfile/src/cout.c +++ b/libxkbfile/src/cout.c @@ -132,13 +132,17 @@ WriteTypeInitFunc(FILE *file,Display *dpy,XkbDescPtr xkb) register unsigned i,n; XkbKeyTypePtr type; Atom * names; -char prefix[32]; +char * prefix = NULL; fprintf(file,"\n\nstatic void\n"); fprintf(file,"initTypeNames(DPYTYPE dpy)\n"); fprintf(file,"{\n"); for (i=0,type=xkb->map->types;i<xkb->map->num_types;i++,type++) { - strcpy(prefix,XkbAtomText(dpy,type->name,XkbCFile)); + if (!(prefix = strdup(XkbAtomText(dpy,type->name,XkbCFile)))) { + _XkbLibError(_XkbErrBadAlloc,"WriteTypeInitFunc",0); + fprintf(file,"#error XkbErrBadAlloc WriteTypeInitFunc\n"); + break; + } if (type->name!=None) fprintf(file," dflt_types[%d].name= GET_ATOM(dpy,\"%s\");\n",i, XkbAtomText(dpy,type->name,XkbCFile)); @@ -155,6 +159,8 @@ char prefix[32]; fprintf(file,"GET_ATOM(dpy,\"%s\");\n",tmp); } } + free(prefix); + prefix = NULL; } fprintf(file,"}\n"); return; @@ -166,7 +172,7 @@ WriteCHdrKeyTypes(FILE *file,Display *dpy,XkbDescPtr xkb) register unsigned i,n; XkbClientMapPtr map; XkbKeyTypePtr type; -char prefix[32]; +char * prefix = NULL; if ((!xkb)||(!xkb->map)||(!xkb->map->types)) { _XkbLibError(_XkbErrMissingTypes,"WriteCHdrKeyTypes",0); @@ -182,7 +188,10 @@ char prefix[32]; XkbAtomText(dpy,xkb->names->types,XkbCFile)); } for (i=0,type=map->types;i<map->num_types;i++,type++) { - strcpy(prefix,XkbAtomText(dpy,type->name,XkbCFile)); + if (!(prefix = strdup(XkbAtomText(dpy,type->name,XkbCFile)))) { + _XkbLibError(_XkbErrBadAlloc,"WriteCHdrKeyTypes",0); + return False; + } if (type->map_count>0) { XkbKTMapEntryPtr entry; @@ -209,10 +218,15 @@ char prefix[32]; type->num_levels); } fprintf(file,"\n"); + free(prefix); + prefix = NULL; } fprintf(file,"static XkbKeyTypeRec dflt_types[]= {\n"); for (i=0,type=map->types;i<(unsigned)map->num_types;i++,type++) { - strcpy(prefix,XkbAtomText(dpy,type->name,XkbCFile)); + if (!(prefix = strdup(XkbAtomText(dpy,type->name,XkbCFile)))) { + _XkbLibError(_XkbErrBadAlloc,"WriteCHdrKeyTypes",0); + return False; + } if (i!=0) fprintf(file,",\n"); fprintf(file," {\n { %15s, %15s, %15s },\n", XkbModMaskText(type->mods.mask,XkbCFile), @@ -229,6 +243,8 @@ char prefix[32]; if (type->level_names!=NULL) fprintf(file," None, lnames_%s\n }",prefix); else fprintf(file," None, NULL\n }"); + free(prefix); + prefix = NULL; } fprintf(file,"\n};\n"); fprintf(file,"#define num_dflt_types (sizeof(dflt_types)/sizeof(XkbKeyTypeRec))\n"); |