Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. first, strip '.UTF-8' is needed for almost all apps using gettext, i found this: http://www.openwall.com/lists/musl/2016/05/11/81, but it seems nothing was added in musl.
  2. --- musl-1.1.16/src/locale/dcngettext.c 2017-01-01 03:27:17.000000000 +0000
  3. +++ musl-1.1.16/src/locale/dcngettext.c 2017-01-01 03:27:17.000000000 +0000
  4. @@ -121,6 +121,7 @@
  5. struct __locale_struct *loc = CURRENT_LOCALE;
  6. const struct __locale_map *lm;
  7. const char *dirname, *locname, *catname;
  8. + char *posu;
  9. size_t dirlen, loclen, catlen, domlen;
  10.  
  11. if ((unsigned)category >= LC_ALL) goto notrans;
  12. @@ -144,7 +143,10 @@
  13.  
  14. catname = catnames[category];
  15. catlen = catlens[category];
  16. - loclen = strlen(locname);
  17. + if( posu = strstr(locname, ".UTF-8") )
  18. + loclen = posu - locname;
  19. + else
  20. + loclen = strlen(locname);
  21.  
  22. size_t namelen = dirlen+1 + loclen+1 + catlen+1 + domlen+3;
  23. char name[namelen+1], *s = name;
  24.  
  25. second, i compiled fcitx with musl's intl, parts of text is translated but other parts. I gone through the whole progranm, finally found this mistake. p refers to the list to add, so the return value of strcmp() is always 0, when bindtextdomain executes more than onetime, active flag is set to 0 wrongly.
  26. --- musl-1.1.16/src/locale/dcngettext.c 2017-01-20 10:43:48.054441176 +0000
  27. +++ musl-1.1.16/src/locale/dcngettext.c 2017-01-20 10:43:48.054441176 +0000
  28. @@ -74,7 +74,7 @@
  29. a_store(&p->active, 1);
  30.  
  31. for (q=bindings; q; q=q->next) {
  32. - if (!strcmp(p->domainname, domainname) && q != p)
  33. + if (!strcmp(q->domainname, domainname) && q != p)
  34. a_store(&q->active, 0);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement