Still segfaults on read from URL.
This commit is contained in:
parent
3470f27585
commit
8334e2bf1f
|
@ -16,6 +16,9 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
/* libcurl, used for io */
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "conspage.h"
|
#include "conspage.h"
|
||||||
#include "consspaceobject.h"
|
#include "consspaceobject.h"
|
||||||
|
@ -84,6 +87,7 @@ int main( int argc, char *argv[] ) {
|
||||||
bool show_prompt = false;
|
bool show_prompt = false;
|
||||||
|
|
||||||
setlocale( LC_ALL, "" );
|
setlocale( LC_ALL, "" );
|
||||||
|
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||||
|
|
||||||
while ( ( option = getopt( argc, argv, "cpdv:" ) ) != -1 ) {
|
while ( ( option = getopt( argc, argv, "cpdv:" ) ) != -1 ) {
|
||||||
switch ( option ) {
|
switch ( option ) {
|
||||||
|
|
|
@ -460,14 +460,11 @@ wint_t url_fgetwc( URL_FILE * input ) {
|
||||||
|
|
||||||
case CFTYPE_CURL:{
|
case CFTYPE_CURL:{
|
||||||
wchar_t *wbuff = calloc( 2, sizeof( wchar_t ) );
|
wchar_t *wbuff = calloc( 2, sizeof( wchar_t ) );
|
||||||
char *cbuff = calloc( 5, sizeof( char ) );
|
|
||||||
|
|
||||||
url_fread( cbuff, sizeof( char ), 4, input );
|
mbstowcs( wbuff, (char *)&input->buffer[input->buffer_pos], 1 );
|
||||||
mbstowcs( wbuff, cbuff, 1 );
|
|
||||||
result = wbuff[0];
|
result = wbuff[0];
|
||||||
use_one_wide( input );
|
use_one_wide( input );
|
||||||
|
|
||||||
free( cbuff );
|
|
||||||
free( wbuff );
|
free( wbuff );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue