Bug 1414737 Comment 33 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I wonder, when this is ever was supposed to work:
```
already_AddRefed<QuotaObject> GetQuotaObjectForFile(sqlite3_file* pFile) {
  MOZ_ASSERT(pFile);

  telemetry_file* p = (telemetry_file*)pFile;
  RefPtr<QuotaObject> result = p->quotaObject;
  return result.forget();
}
```
assumes that `pFile` is of type `telemetry_file`. But in the calling function, we have:
```
  sqlite3_file* file;
  int srv = ::sqlite3_file_control(mDBConn, nullptr, SQLITE_FCNTL_FILE_POINTER,
                                   &file);
  if (srv != SQLITE_OK) {
    return convertResultCode(srv);
  }

  RefPtr<QuotaObject> databaseQuotaObject = GetQuotaObjectForFile(file);
```
so the passed `sqlite3_file* file` can never be of type `telemetry_file*`, right?
I wonder, how this is supposed to work:
```
already_AddRefed<QuotaObject> GetQuotaObjectForFile(sqlite3_file* pFile) {
  MOZ_ASSERT(pFile);

  telemetry_file* p = (telemetry_file*)pFile;
  RefPtr<QuotaObject> result = p->quotaObject;
  return result.forget();
}
```
assumes that `pFile` is of type `telemetry_file`. But in the calling function, we have:
```
  sqlite3_file* file;
  int srv = ::sqlite3_file_control(mDBConn, nullptr, SQLITE_FCNTL_FILE_POINTER,
                                   &file);
  if (srv != SQLITE_OK) {
    return convertResultCode(srv);
  }

  RefPtr<QuotaObject> databaseQuotaObject = GetQuotaObjectForFile(file);
```
Is there any magic callback inside `sqlite3_file_control` that allocates a `telemetry_file` object?

Back to Bug 1414737 Comment 33