mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
Endianness fixes for inlined egcs #906
This commit is contained in:
parent
d11d8175d0
commit
c66d8f52d5
@ -13,6 +13,7 @@
|
||||
#include <signal.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <netinet/in.h>
|
||||
#include <notcurses/nckeys.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -580,8 +581,8 @@ typedef struct cell {
|
||||
} cell;
|
||||
|
||||
#define CELL_TRIVIAL_INITIALIZER { }
|
||||
#define CELL_SIMPLE_INITIALIZER(c) { .gcluster = (c), .gcluster_backstop = 0, .reserved = 0, .stylemask = 0, .channels = 0, }
|
||||
#define CELL_INITIALIZER(c, s, chan) { .gcluster = (c), .gcluster_backstop = 0, .reserved = 0, .stylemask = (s), .channels = (chan), }
|
||||
#define CELL_SIMPLE_INITIALIZER(c) { .gcluster = (htonl(c)), .gcluster_backstop = 0, .reserved = 0, .stylemask = 0, .channels = 0, }
|
||||
#define CELL_INITIALIZER(c, s, chan) { .gcluster = (htonl(c)), .gcluster_backstop = 0, .reserved = 0, .stylemask = (s), .channels = (chan), }
|
||||
|
||||
static inline void
|
||||
cell_init(cell* c){
|
||||
|
@ -35,6 +35,7 @@ const char* oiio_version(void);
|
||||
#include <stdbool.h>
|
||||
#include <unictype.h>
|
||||
#include <langinfo.h>
|
||||
#include <netinet/in.h>
|
||||
#include "notcurses/notcurses.h"
|
||||
#include "egcpool.h"
|
||||
|
||||
@ -593,6 +594,12 @@ pool_release(egcpool* pool, cell* c){
|
||||
}
|
||||
}
|
||||
|
||||
// set the cell 'c' to point into the egcpool at location 'eoffset'
|
||||
static inline void
|
||||
set_gcluster_egc(cell* c, int eoffset){
|
||||
c->gcluster = htonl(0x01ul) + eoffset;
|
||||
}
|
||||
|
||||
// Duplicate one cell onto another, possibly crossing ncplanes.
|
||||
static inline int
|
||||
cell_duplicate_far(egcpool* tpool, cell* targ, const ncplane* splane, const cell* c){
|
||||
@ -612,7 +619,7 @@ cell_duplicate_far(egcpool* tpool, cell* targ, const ncplane* splane, const cell
|
||||
if(eoffset < 0){
|
||||
return -1;
|
||||
}
|
||||
targ->gcluster = 0x01000000ul + eoffset;
|
||||
set_gcluster_egc(targ, eoffset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -892,7 +899,8 @@ pool_load_direct(egcpool* pool, cell* c, const char* gcluster, int bytes, int co
|
||||
assert(cols < 2);
|
||||
pool_release(pool, c);
|
||||
c->channels &= ~(CELL_WIDEASIAN_MASK | CELL_NOBACKGROUND_MASK);
|
||||
c->gcluster = *gcluster;
|
||||
((unsigned char*)&c->gcluster)[0] = *gcluster;
|
||||
((unsigned char*)&c->gcluster)[1] = 0;
|
||||
return bytes;
|
||||
}
|
||||
// FIXME also shaded blocks! ░ etc. are there combined EGCs involving these?
|
||||
@ -920,7 +928,7 @@ pool_load_direct(egcpool* pool, cell* c, const char* gcluster, int bytes, int co
|
||||
return -1;
|
||||
}
|
||||
pool_release(pool, c);
|
||||
c->gcluster = 0x01000000ul + eoffset;
|
||||
set_gcluster_egc(c, eoffset);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user