소스 검색

* Changed way temporary buffer of ansi export was handled. Need to do that for other exporters as well.

tags/v0.99.beta14
Jean-Yves Lamoureux jylam 19 년 전
부모
커밋
a676487863
4개의 변경된 파일18개의 추가작업 그리고 11개의 파일을 삭제
  1. +1
    -5
      caca/driver_network.c
  2. +5
    -0
      cucul/cucul.c
  3. +4
    -0
      cucul/cucul_internals.h
  4. +8
    -6
      cucul/export.c

+ 1
- 5
caca/driver_network.c 파일 보기

@@ -167,7 +167,7 @@ static void network_display(caca_t *kk)
{
int size;
char *to_send = cucul_get_ansi(kk->qq, 0, &size);;
to_send = realloc(to_send, kk->qq->width * kk->qq->height * 15 * 3);
/* ANSI code for move(0,0)*/
if (send(kk->drv.p->new_fd, "\033[1,1H", 6, 0) == -1) {
@@ -179,10 +179,6 @@ static void network_display(caca_t *kk)
perror("send");
return;
}
if(to_send) {
free(to_send);
}

}
static void network_handle_resize(caca_t *kk)


+ 5
- 0
cucul/cucul.c 파일 보기

@@ -72,6 +72,8 @@ cucul_t * cucul_init(void)
return NULL;
}

qq->ansi_buffer = NULL;
return qq;
}

@@ -270,6 +272,9 @@ void cucul_end(cucul_t *qq)
free(qq->chars);
free(qq->attr);

if(qq->ansi_buffer)
free(qq->ansi_buffer);

free(qq);
}



+ 4
- 0
cucul/cucul_internals.h 파일 보기

@@ -45,6 +45,10 @@ struct cucul_context
enum cucul_feature background, antialiasing, dithering;

unsigned int refcount;

/* Exporters facilities */
unsigned char *ansi_buffer;

};

/* Initialisation functions */


+ 8
- 6
cucul/export.c 파일 보기

@@ -275,13 +275,15 @@ char * cucul_get_ansi(cucul_t *qq, int trailing, int *size)
30, 34, 32, 36, 31, 35, 33, 37, /* light colors handling is done later */
};

char *buffer, *cur;
char *cur;
unsigned int x, y;

/* 20 bytes assumed for max length per pixel.
* Add height*9 to that (zeroes color at the end and jump to next line) */
buffer = malloc(((qq->height*9) + (qq->width * qq->height * 20)) * sizeof(char));
cur = buffer;
if(qq->ansi_buffer)
free(qq->ansi_buffer);
qq->ansi_buffer = malloc(((qq->height*9) + (qq->width * qq->height * 20)) * sizeof(char));
cur = qq->ansi_buffer;

// *cur++ = '';

@@ -321,9 +323,9 @@ char * cucul_get_ansi(cucul_t *qq, int trailing, int *size)
}

/* Crop to really used size */
*size = (strlen(buffer) + 1)* sizeof(char);
buffer = realloc(buffer, *size);
*size = (strlen(qq->ansi_buffer) + 1)* sizeof(char);
qq->ansi_buffer = realloc(qq->ansi_buffer, *size);

return buffer;
return qq->ansi_buffer;
}


불러오는 중...
취소
저장