[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/krecipes/src/DBBackend [POSSIBLY UNSAFE]
From:       Unai Garro <Unai.Garro () ee ! ed ! ac ! uk>
Date:       2003-11-10 21:30:57
[Download RAW message or body]

CVS commit by uga: 

more encoding stuff. Avoid latin1()


  M +3 -3      literecipedb.cpp   1.62 [POSSIBLY UNSAFE: printf]
  M +3 -3      mysqlrecipedb.cpp   1.41


--- kdenonbeta/krecipes/src/DBBackend/literecipedb.cpp  #1.61:1.62
@@ -1101,5 +1101,5 @@ s_escaped=escape(s.utf8());
 
 // Return encoded
-return s_escaped.latin1(); // Note that the text has already been converted into \
utf8 before escaping. +return s_escaped.data(); // Note that the text has already \
been converted into utf8 before escaping.  }
 
@@ -1109,5 +1109,5 @@ QString s_escaped=s;
 
 // Escape using SQLite's function
-char * escaped= sqlite_mprintf("%q",s.latin1()); // Escape the string(allocates \
memory) +char * escaped= sqlite_mprintf("%q",s.data()); // Escape the \
string(allocates memory)  s_escaped=escaped;
 sqlite_freemem(escaped); // free allocated memory
@@ -1118,5 +1118,5 @@ return(s_escaped);
 QString LiteRecipeDB::unescapeAndDecode(const QString &s)
 {
-QString s_escaped=QString::fromUtf8(s.latin1());
+QString s_escaped=QString::fromUtf8(s.data());
 s_escaped.replace(";@",";");
 return (s_escaped); // Use unicode encoding

--- kdenonbeta/krecipes/src/DBBackend/mysqlrecipedb.cpp  #1.40:1.41
@@ -363,5 +363,5 @@ else		{command=QString("UPDATE recipes S
                 .arg(recipe->recipeID);
                 }
-size = mysql_real_query(mysqlDB, command.latin1() , command.length()+1);
+size = mysql_real_query(mysqlDB, command.data() , command.length()+1);
 
 // If it's a new recipe, identify the ID that was given to the recipe and store in \
the Recipe itself @@ -392,5 +392,5 @@ QFileInfo fi(".krecipe_photo.jpg");
        strcat(to, "'");
        QString st; st=to; st+= " WHERE id="; st+=QString::number(recipeID); // Note, \
                we assume this ID exists (created or existing)!
-         size=mysql_real_query( mysqlDB, st.latin1(), st.length()+1);
+         size=mysql_real_query( mysqlDB, st.data(), st.length()+1);
 
      }
@@ -1053,5 +1053,5 @@ return(s_escaped.utf8());
 QString MySQLRecipeDB::unescapeAndDecode(const QString &s)
 {
-QString s_escaped=QString::fromUtf8(s.latin1());
+QString s_escaped=QString::fromUtf8(s.data());
 s_escaped.replace("\";@",";");
 return (s_escaped); // Use unicode encoding


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic