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

List:       kde-commits
Subject:    kdepim/kmail [POSSIBLY UNSAFE]
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2004-10-13 11:13:49
Message-ID: 20041013111349.6D9A916CC0 () office ! kde ! org
[Download RAW message or body]

CVS commit by mutz: 

From KDE_3_3_BRANCH:
- config.h must be first
- rename IDS_HEADER, IDS_VERSION to IDS_SEARCH_* to avoid confusion with IDS_* from kmmsgdict.cpp


  M +11 -8     kmfoldersearch.cpp   1.59 [POSSIBLY UNSAFE: printf,scanf]


--- kdepim/kmail/kmfoldersearch.cpp  #1.58:1.59
@@ -4,4 +4,6 @@
 //Factor byteswap stuff into one header file
 
+#include <config.h>
+
 #include "kmfoldersearch.h"
 #include "kmfolderimap.h"
@@ -27,5 +29,4 @@
 #include <sys/file.h>
 #include <utime.h>
-#include <config.h>
 
 #ifdef HAVE_BYTESWAP_H
@@ -37,4 +38,5 @@
 
 /* Swap bytes in 32 bit value.  */
+#ifndef kmail_swap_32
 #ifdef bswap_32
 #define kmail_swap_32(x) bswap_32(x)
@@ -44,10 +46,11 @@
       (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
 #endif
+#endif // kmail_swap_32
 
 // Current version of the .index.search files
-#define IDS_VERSION 1000
+#define IDS_SEARCH_VERSION 1000
 // The asterisk at the end is important
-#define IDS_HEADER "# KMail-Search-IDs V%d\n*"
-#define IDS_HEADER_LEN 30
+#define IDS_SEARCH_HEADER "# KMail-Search-IDs V%d\n*"
+#define IDS_SEARCH_HEADER_LEN 30
 
 
@@ -705,5 +708,5 @@ int KMFolderSearch::writeIndex( bool )
         return -1;
     }
-    fprintf(tmpIndexStream, IDS_HEADER, IDS_VERSION);
+    fprintf(tmpIndexStream, IDS_SEARCH_HEADER, IDS_SEARCH_VERSION);
     Q_UINT32 byteOrder = 0x12345678;
     fwrite(&byteOrder, sizeof(byteOrder), 1, tmpIndexStream);
@@ -757,6 +760,6 @@ bool KMFolderSearch::readIndex()
 
     int version = 0;
-    fscanf(mIdsStream, IDS_HEADER, &version);
-    if (version != IDS_VERSION) {
+    fscanf(mIdsStream, IDS_SEARCH_HEADER, &version);
+    if (version != IDS_SEARCH_VERSION) {
         fclose(mIdsStream);
         mIdsStream = 0;
@@ -875,5 +878,5 @@ void KMFolderSearch::fillDictFromIndex(K
 void KMFolderSearch::truncateIndex()
 {
-    truncate(QFile::encodeName(indexLocation()), IDS_HEADER_LEN);
+    truncate(QFile::encodeName(indexLocation()), IDS_SEARCH_HEADER_LEN);
 }
 


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

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