示例#1
0
void test() {
  printf("Start test!\n");

  cloud_init("localhost:8888");
  cloud_print_error();
  cloud_list_service(list_service);
  cloud_print_error();

  printf("Create bucket\n");
  cloud_create_bucket("test");
  cloud_print_error();

  cloud_list_service(list_service);
  cloud_print_error();

  printf("Put object\n");
  infile = fopen("./README", "rb");
  struct stat stat_buf;
  lstat("./README", &stat_buf);
  cloud_put_object("test", "helloworld", stat_buf.st_size, put_buffer);
  fclose(infile);
  cloud_print_error();

  printf("List bucket test:\n");
  cloud_list_bucket("test", list_bucket);

  printf("Get object:\n");
  outfile = fopen("/tmp/README", "wb");
  cloud_get_object("test", "helloworld", get_buffer);
  fclose(outfile);
  cloud_print_error();

  printf("Delete object:\n");
  cloud_delete_object("test", "helloworld");
  cloud_print_error();

  printf("List bucket test:\n");
  cloud_list_bucket("test", list_bucket);
  cloud_print_error();

  printf("Delete bucket test:\n");
  cloud_delete_bucket("test");
  cloud_print_error();

  printf("List service:\n");
  cloud_list_service(list_service);

  printf("End test!\n");

  cloud_destroy();
}
示例#2
0
void pge_deinit() {
  pge_finish();

  text_layer_destroy(s_status_layer);

  // Deallocate
  for(int z = 0; z < GRID_DEPTH; z++) {
    for(int y = 0; y < GRID_HEIGHT; y++) {
      for(int x = 0; x < GRID_WIDTH; x++) {
        block_destroy(s_block_array[vec2i(Vec3(x, y, z))]);
      }
    }
  }
  for(int i = 0; i < MAX_CLOUDS; i++) {
    cloud_destroy(s_cloud_array[i]);
  }
}