fix usage of snprintf to use PR_smprintf, notpartofthebuild

git-svn-id: svn://10.0.0.236/trunk@166506 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
vladimir%pobox.com
2004-12-09 21:42:36 +00:00
parent ffc6251142
commit b18b0f330b

View File

@@ -267,25 +267,15 @@ mozStorageConnection::CreateTable(/*const nsID& aID,*/
{
int srv;
char *buf;
int buflen = 0;
buflen = PR_snprintf(nsnull, 0, "CREATE TABLE %s (%s)", aTableName, aTableSchema);
if (buflen <= 0)
return NS_ERROR_FAILURE;
buf = (char *) nsMemory::Alloc(buflen + 1);
buf = PR_smprintf("CREATE TABLE %s (%s)", aTableName, aTableSchema);
if (!buf)
return NS_ERROR_OUT_OF_MEMORY;
buflen = PR_snprintf(buf, buflen+1, "CREATE TABLE %s (%s)", aTableName, aTableSchema);
if (buflen <= 0) {
nsMemory::Free(buf);
return NS_ERROR_FAILURE;
}
srv = sqlite3_exec (mDBConn, buf,
NULL, NULL, NULL);
nsMemory::Free(buf);
PR_smprintf_free(buf);
if (srv != SQLITE_OK) {
return NS_ERROR_FAILURE; // XXX SQL_ERROR_TABLE_EXISTS