ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtcolor.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtcolor.C (file contents):
Revision 1.9 by pcg, Sun Mar 14 17:33:08 2004 UTC vs.
Revision 1.12 by pcg, Fri Apr 2 20:41:01 2004 UTC

2#include <rxvt.h> 2#include <rxvt.h>
3#include <rxvtcolor.h> 3#include <rxvtcolor.h>
4 4
5#include <unistd.h> 5#include <unistd.h>
6#include <fcntl.h> 6#include <fcntl.h>
7
8class byteorder byteorder;
9
10byteorder::byteorder ()
11{
12 union {
13 uint32_t u;
14 uint8_t b[4];
15 } w;
16
17 w.b[0] = 0x11;
18 w.b[1] = 0x22;
19 w.b[2] = 0x33;
20 w.b[3] = 0x44;
21
22 e = w.u;
23}
7 24
8refcounted::refcounted (const char *id) 25refcounted::refcounted (const char *id)
9{ 26{
10 this->id = STRDUP (id); 27 this->id = STRDUP (id);
11} 28}
237 selection_owner = owner; 254 selection_owner = owner;
238} 255}
239 256
240rxvt_xim *rxvt_display::get_xim (const char *locale, const char *modifiers) 257rxvt_xim *rxvt_display::get_xim (const char *locale, const char *modifiers)
241{ 258{
242 // asprintf is a GNU and *BSD extension.. sorry...
243 char *id; 259 char *id;
260 int l, m;
244 261
245 if (asprintf (&id, "%s\n%s", locale, modifiers) < 0) 262 l = strlen (locale);
263 m = strlen (modifiers);
264
265 if (!(id = (char *)malloc (l + m + 2)))
246 return 0; 266 return 0;
247 267
268 memcpy (id, locale, l); id[l] = '\n';
269 memcpy (id + l + 1, modifiers, m); id[l + m + 1] = 0;
270
248 rxvt_xim *xim = xims.get (id); 271 rxvt_xim *xim = xims.get (id);
249 272
250 free (id); 273 free (id);
251 274
252 return xim; 275 return xim;
253} 276}
254 277
255void rxvt_display::put_xim (rxvt_xim *xim) 278void rxvt_display::put_xim (rxvt_xim *xim)
256{ 279{
257 xims.put (xim); 280 xims.put (xim);
281}
282
283Atom rxvt_display::atom (const char *name)
284{
285 return XInternAtom (display, name, False);
258} 286}
259 287
260///////////////////////////////////////////////////////////////////////////// 288/////////////////////////////////////////////////////////////////////////////
261 289
262template refcache<rxvt_display>; 290template refcache<rxvt_display>;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines