mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 01:01:37 +03:00
u3: improves image-related error messages in events
This commit is contained in:
parent
c9a80338ee
commit
6e9c0033eb
@ -699,7 +699,7 @@ _ce_image_resize(u3e_image* img_u, c3_w pgs_w)
|
||||
{
|
||||
if ( img_u->pgs_w > pgs_w ) {
|
||||
if ( ftruncate(img_u->fid_i, pgs_w << (u3a_page + 2)) ) {
|
||||
fprintf(stderr, "loom: image truncate %s: %s\r\n",
|
||||
fprintf(stderr, "loom: image (%s) truncate: %s\r\n",
|
||||
img_u->nam_c,
|
||||
strerror(errno));
|
||||
c3_assert(0);
|
||||
@ -785,7 +785,8 @@ _ce_image_blit(u3e_image* img_u,
|
||||
lseek(img_u->fid_i, 0, SEEK_SET);
|
||||
for ( i_w = 0; i_w < img_u->pgs_w; i_w++ ) {
|
||||
if ( -1 == read(img_u->fid_i, ptr_w, siz_w) ) {
|
||||
fprintf(stderr, "loom: image blit read: %s\r\n", strerror(errno));
|
||||
fprintf(stderr, "loom: image (%s) blit read: %s\r\n",
|
||||
img_u->nam_c, strerror(errno));
|
||||
c3_assert(0);
|
||||
}
|
||||
|
||||
@ -819,7 +820,9 @@ _ce_image_fine(u3e_image* img_u,
|
||||
c3_w mem_w, fil_w;
|
||||
|
||||
if ( -1 == read(img_u->fid_i, buf_w, pag_siz_i) ) {
|
||||
fprintf(stderr, "loom: image fine read: %s\r\n", strerror(errno));
|
||||
fprintf(stderr, "loom: image (%s) fine read: %s\r\n",
|
||||
img_u->nam_c,
|
||||
strerror(errno));
|
||||
c3_assert(0);
|
||||
}
|
||||
mem_w = u3r_mug_words(ptr_w, pag_wiz_i);
|
||||
@ -828,11 +831,13 @@ _ce_image_fine(u3e_image* img_u,
|
||||
if ( mem_w != fil_w ) {
|
||||
c3_w pag_w = (ptr_w - u3_Loom) >> u3a_page;
|
||||
|
||||
fprintf(stderr, "mismatch: page %d, mem_w %x, fil_w %x, K %x\r\n",
|
||||
pag_w,
|
||||
mem_w,
|
||||
fil_w,
|
||||
u3K.mug_w[pag_w]);
|
||||
fprintf(stderr, "loom: image (%s) mismatch: "
|
||||
"page %d, mem_w %x, fil_w %x, K %x\r\n",
|
||||
img_u->nam_c,
|
||||
pag_w,
|
||||
mem_w,
|
||||
fil_w,
|
||||
u3K.mug_w[pag_w]);
|
||||
abort();
|
||||
}
|
||||
ptr_w += stp_ws;
|
||||
@ -856,7 +861,9 @@ _ce_image_copy(u3e_image* fom_u, u3e_image* tou_u)
|
||||
if ( (-1 == lseek(fom_u->fid_i, 0, SEEK_SET))
|
||||
|| (-1 == lseek(tou_u->fid_i, 0, SEEK_SET)) )
|
||||
{
|
||||
fprintf(stderr, "loom: image copy seek 0: %s\r\n", strerror(errno));
|
||||
fprintf(stderr, "loom: image (%s) copy seek: %s\r\n",
|
||||
fom_u->nam_c,
|
||||
strerror(errno));
|
||||
return c3n;
|
||||
}
|
||||
|
||||
@ -867,16 +874,22 @@ _ce_image_copy(u3e_image* fom_u, u3e_image* tou_u)
|
||||
c3_w off_w = i_w;
|
||||
|
||||
if ( -1 == read(fom_u->fid_i, mem_w, pag_siz_i) ) {
|
||||
fprintf(stderr, "loom: image copy read: %s\r\n", strerror(errno));
|
||||
fprintf(stderr, "loom: image (%s) copy read: %s\r\n",
|
||||
fom_u->nam_c,
|
||||
strerror(errno));
|
||||
return c3n;
|
||||
}
|
||||
else {
|
||||
if ( -1 == lseek(tou_u->fid_i, (off_w << (u3a_page + 2)), SEEK_SET) ) {
|
||||
fprintf(stderr, "loom: image copy seek: %s\r\n", strerror(errno));
|
||||
fprintf(stderr, "loom: image (%s) copy seek: %s\r\n",
|
||||
tou_u->nam_c,
|
||||
strerror(errno));
|
||||
return c3n;
|
||||
}
|
||||
if ( -1 == write(tou_u->fid_i, mem_w, pag_siz_i) ) {
|
||||
fprintf(stderr, "loom: image copy write: %s\r\n", strerror(errno));
|
||||
fprintf(stderr, "loom: image (%s) copy write: %s\r\n",
|
||||
tou_u->nam_c,
|
||||
strerror(errno));
|
||||
return c3n;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user