Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmark committed Nov 12, 2024
1 parent 4f7b0ea commit 0e3a442
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions libatalk/cnid/sqlite/cnid_sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@


sqlite3_stmt *stmt = NULL;
// CK static MYSQL_BIND lookup_param[4], lookup_result[5];
// CK static MYSQL_BIND add_param[4], put_param[5];

/*
* Prepared statement parameters
Expand Down Expand Up @@ -248,7 +246,7 @@ void cnid_sqlite_close(struct _cnid_db *cdb)
int cnid_sqlite_update(struct _cnid_db *cdb,
cnid_t id,
const struct stat *st,
const cnid_t did, char *name, size_t len)
cnid_t did, const char *name, size_t len)
{
EC_INIT;
CNID_sqlite_private *db;
Expand Down Expand Up @@ -320,7 +318,7 @@ int cnid_sqlite_update(struct _cnid_db *cdb,

cnid_t cnid_sqlite_lookup(struct _cnid_db *cdb,
const struct stat *st,
const cnid_t did, char *name, const size_t len)
cnid_t did, const char *name, size_t len)
{
EC_INIT;

Expand Down Expand Up @@ -530,7 +528,7 @@ cnid_t cnid_sqlite_add(struct _cnid_db *cdb,

lastid = sqlite3_last_insert_rowid(db->cnid_sqlite_con);

if (lastid > 0xffffffff) { /* CK this is wrong */
if (lastid > 0xffffffff) { /* FIXME: this is wrong */
/* CNID set is depleted, restart from scratch */
EC_NEG1(cnid_sqlite_execute
(db->cnid_sqlite_con,
Expand Down Expand Up @@ -563,15 +561,15 @@ cnid_t cnid_sqlite_add(struct _cnid_db *cdb,
}
} while (id == CNID_INVALID);

EC_CLEANUP:
EC_CLEANUP:
LOG(log_debug, logtype_cnid, "cnid_sqlite_add: id: %" PRIu32,
ntohl(id));

return id;
}

cnid_t cnid_sqlite_get(struct _cnid_db *cdb, const cnid_t did, char *name,
const size_t len)
cnid_t cnid_sqlite_get(struct _cnid_db *cdb, cnid_t did, const char *name,
size_t len)
{
EC_INIT;
CNID_sqlite_private *db;
Expand Down Expand Up @@ -663,7 +661,7 @@ char *cnid_sqlite_resolve(struct _cnid_db *cdb, cnid_t * id, void *buffer,
if (transient_stmt)
sqlite3_finalize(transient_stmt);

#if 0 // handle this CK
#if 0 // FIXME: handle this
if (ret != 0) {
*id = CNID_INVALID;
return NULL;
Expand Down Expand Up @@ -728,7 +726,7 @@ int cnid_sqlite_find(struct _cnid_db *cdb, const char *name, size_t namelen,
}

cnid_t cnid_sqlite_rebuild_add(struct _cnid_db *cdb, const struct stat *st,
const cnid_t did, char *name, const size_t len,
cnid_t did, const char *name, size_t len,
cnid_t hint)
{
LOG(log_error, logtype_cnid,
Expand Down Expand Up @@ -775,7 +773,6 @@ static struct _cnid_db *cnid_sqlite_new(struct vol *vol)

cdb->cnid_db_vol = vol;
cdb->cnid_db_flags = CNID_FLAG_PERSISTENT | CNID_FLAG_LAZY_INIT;

cdb->cnid_add = cnid_sqlite_add;
cdb->cnid_delete = cnid_sqlite_delete;
cdb->cnid_get = cnid_sqlite_get;
Expand Down Expand Up @@ -857,7 +854,7 @@ struct _cnid_db *cnid_sqlite_open(struct cnid_open_args *args)
strlen(stamp), SQLITE_STATIC) );

sqlite3_step(transient_stmt);
#if 0 // CK must figure out how to check for failed insert
#if 0 // FIXME: must figure out how to check for failed insert
if (sqlite3_step(transient_stmt)) {
if (mysql_errno(db->cnid_sqlite_con) != ER_DUP_ENTRY) {
LOG(log_error, logtype_cnid,
Expand All @@ -869,7 +866,7 @@ struct _cnid_db *cnid_sqlite_open(struct cnid_open_args *args)
#endif
sqlite3_finalize(transient_stmt);

#if 0 // CK FIX!
#if 0 // FIXME
/*
* Check whether CNID set overflowed before.
* If that's the case, in cnid_sqlite_add() we'll ignore the CNID
Expand Down

0 comments on commit 0e3a442

Please sign in to comment.