• 0 Posts
  • 35 Comments
Joined 3 years ago
cake
Cake day: June 11th, 2023

help-circle








  • Webp currently the best image file format.

    Out of the widely supported ones, it’s quite good, yeah. Overall, I’d say JPEG XL is the better one. Ironically, only Safari supports it out of the box. Firefox requires a Nightly version with tweaking in about:config. Chrome used to have a feature flag, but has since removed it.












  • I misremembered the whole thing. It was still related to cleaning up after a failure, but there was only one resource I had to deal with. That’s how it looks like:

        sqlite3 *db;
        int r;
    
        r = sqlite3_open("./data.db", &db);
        if (r) {
            std::cerr << "Can't open the database: " << sqlite3_errmsg(db) << std::endl;
            return r;
        }
    
        r = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS foo(...);", nullptr, nullptr, nullptr);
        if (r != SQLITE_OK) {
            std::cerr << "Can't create a table called foo: " << sqlite3_errmsg(db) << std::endl;
            goto out;
        }
    
        // a few more sqlite3_exec calls;
        // some sqlite3_prepare_v2 calls combined with sqlite3_bind_* and sqlite3_step calls
        // for repeated queries.
    
    out:
        sqlite3_close(db);
        return r;