title: How can I fix a cast of an indirect pointer (under ARC) in this code?
body: <p>So we're trying to walkthru a SQLite example which implements NSFastEnumeration, provided by Lynda.com. Converting it to ARC has been an issue for me as I have been unable to fix the error</p>
  
  <pre><code>Cast of an indirect pointer to an Objective-C pointer to 'va_list' (aka char *) is      disallowed with ARC.
  </code></pre>
  
  <p>It is pointing to this line and the <code>va_list</code> cast</p>
  
  <pre><code>[self bindSQL:[query UTF8String] arguments:(va_list)values];
  </code></pre>
  
  <p>which is in this function where <code>values</code> is defined (<code>__unsafe_unretained</code> was added to fix some other error)</p>
  
  <pre><code>- (NSNumber *) insertRow:(NSDictionary *) record 
  {
      int dictSize = [record count];
      __unsafe_unretained id values[dictSize];
  </code></pre>
  
  <p>The implementation of bindSQL is</p>
  
  <pre><code>- (void) bindSQL:(const char *) cQuery arguments:(va_list)args
  </code></pre>
  
  <p>How is this corrected?</p>
  
  <p>Thanks for the interest guys. As requested here is the original bindSQL function and the calling insertRow function</p>
  
  <pre><code>- (void) bindSQL:(const char *) cQuery arguments:(va_list)args {
  // NSLog(@"%s: %s", __FUNCTION__, cQuery);
  int param_count;
  
  // preparing the query here allows SQLite to determine
  // the number of required parameters
  if (sqlite3_prepare_v2(database, cQuery, -1, &amp;statement, NULL) != SQLITE_OK) {
      NSLog(@"bindSQL: could not prepare statement (%s)", sqlite3_errmsg(database));
      statement = NULL;
      return;
  }
  
  if ((param_count = sqlite3_bind_parameter_count(statement))) {
      for (int i = 0; i &lt; param_count; i++) {
          id o = va_arg(args, id);
  
          // determine the type of the argument
          if (o == nil) {
              sqlite3_bind_null(statement, i + 1);
          } else if ([o respondsToSelector:@selector(objCType)]) {
              if (strchr("islISLB", *[o objCType])) { // integer
                  sqlite3_bind_int(statement, i + 1, [o intValue]);
              } else if (strchr("fd", *[o objCType])) {   // double
                  sqlite3_bind_double(statement, i + 1, [o doubleValue]);
              } else {    // unhandled types
                  NSLog(@"bindSQL: Unhandled objCType: %s", [o objCType]);
                  statement = NULL;
                  return;
              }
          } else if ([o respondsToSelector:@selector(UTF8String)]) { // string
              sqlite3_bind_text(statement, i + 1, [o UTF8String], -1, SQLITE_TRANSIENT);
          } else {    // unhhandled type
              NSLog(@"bindSQL: Unhandled parameter type: %@", [o class]);
              statement = NULL;
              return;
          }
      }
  }
  
  va_end(args);
  return;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>- (NSNumber *) insertRow:(NSDictionary *) record {
  // NSLog(@"%s", __FUNCTION__);
  int dictSize = [record count];
  
  // the values array is used as the argument list for bindSQL
  id keys[dictSize];  // not used, just a side-effect of getObjects:andKeys
  id values[dictSize];
  [record getObjects:values andKeys:keys];    // convenient for the C array
  
  // construct the query
  NSMutableArray * placeHoldersArray = [NSMutableArray arrayWithCapacity:dictSize];
  for (int i = 0; i &lt; dictSize; i++)  // array of ? markers for placeholders in query
      [placeHoldersArray addObject: [NSString stringWithString:@"?"]];
  
  NSString * query = [NSString stringWithFormat:@"insert into %@ (%@) values (%@)",
                      tableName,
                      [[record allKeys] componentsJoinedByString:@","],
                      [placeHoldersArray componentsJoinedByString:@","]];
  
  [self bindSQL:[query UTF8String] arguments:(va_list)values];
  sqlite3_step(statement);
  if(sqlite3_finalize(statement) == SQLITE_OK) {
      return [self lastInsertId];
  } else {
      NSLog(@"doQuery: sqlite3_finalize failed (%s)", sqlite3_errmsg(database));
      return [NSNumber numberWithInt:0];
  }
  </code></pre>
  
  <p>}</p>