示例#1
0
void GlobalPlanner::calculate_path(){
	set_current_square(current_location[0], current_location[1]);
	add_to_open_set(current_square[0], current_square[1]);
	do{
		find_lowest_f();
		current_square_closed();
		for_each_adjacent_square();
	} while (check_destination() == 0);
}
示例#2
0
int BLI_copy(const char *file, const char *to)
{
	char *actual_to = check_destination(file, to);
	int ret;

	ret = recursive_operation(file, actual_to, copy_callback_pre, copy_single_file, NULL);

	if (actual_to != to)
		MEM_freeN(actual_to);

	return ret;
}
示例#3
0
int url_check_check_preview(char *preview_data,int preview_data_len, request_t *req){
    ci_headers_list_t* req_header;
    struct url_check_data *uc=ci_service_data(req);
    struct http_info httpinf;
    int allow=1;

    if((req_header=ci_reqmod_headers(req))==NULL) /*It is not possible but who knows .....*/
	return CI_ERROR;

    get_http_info(req,req_header, &httpinf);

    ci_debug_printf(9,"URL  to host %s\n",httpinf.site);
    ci_debug_printf(9,"URL  page %s\n",httpinf.page);

    allow=check_destination(&httpinf);


    if(!allow){
	 /*The URL is not a good one so....*/
	 ci_debug_printf(9,"Oh!!! we are going to deny this site.....\n");

	 uc->body=ci_cached_file_new(strlen(error_message)+10);
	 ci_request_create_respmod(req,1,1); /*Build the responce headers*/

	 ci_respmod_add_header(req,"HTTP/1.1 403 Forbidden");/*Send an 403 Forbidden http responce to web client*/
	 ci_respmod_add_header(req,"Server: C-ICAP");
	 ci_respmod_add_header(req,"Content-Type: text/html");
	 ci_respmod_add_header(req,"Content-Language: en");
	 
	 ci_cached_file_write(uc->body,error_message,strlen(error_message),1);

    }
    else{
	 /*if we are inside preview negotiation or client allow204 responces oudsite of preview then*/
	 if(preview_data || ci_req_allow204(req)) 
	      return CI_MOD_ALLOW204;
	 
	 /*
	   Squid does not support preview of data in reqmod requests neither 204 responces outside preview
	   so we need to read all the body if exists and send it back to squid.
	   Allocate a new body for it 
	 */
	 if(ci_req_hasbody(req)){
	      int clen=ci_content_lenght(req)+100;
	      uc->body=ci_cached_file_new(clen);
	 }

    }

    unlock_data(req);
    return CI_MOD_CONTINUE;
}