fix gcc-4.2 errors, warnings, add -D_FILE_OFFSET_BITS=64 and -O3
authorMichael Andres <ma@suse.de>
Mon, 18 Jun 2007 21:57:39 +0000 (21:57 +0000)
committerMichael Andres <ma@suse.de>
Mon, 18 Jun 2007 21:57:39 +0000 (21:57 +0000)
CMakeLists.txt
devel/devel.ma/AOUT.cc
zypp/cache/CacheStore.cc
zypp/cache/schema/mkarray.c
zypp/cache/sqlite3x/sqlite3x_command.cpp
zypp/repo/RepoType.cc
zypp/repo/yum/ResourceType.cc

index 4aca39a..ad0f64d 100644 (file)
@@ -1,8 +1,5 @@
 PROJECT(libzypp)
 
-SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Woverloaded-virtual" )
-SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g  -Wall " )
-
 # Library
 IF ( DEFINED LIB )
   SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB}" )
@@ -30,7 +27,9 @@ MATH( EXPR LIBZYPP_SO_FIRST  "${LIBZYPP_CURRENT}-${LIBZYPP_AGE}" )
 SET( PACKAGE "libzypp" )
 SET( VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}" )
 
-ADD_DEFINITIONS( -g )
+SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -Wall -Woverloaded-virtual" )
+SET( CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -g -O3 -Wall" )
+ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 )
 ADD_DEFINITIONS( -DVERSION=\\\"${VERSION}\\\" )
 SET( LIBZYPP_VERSION_INFO "${LIBZYPP_SO_FIRST}.${LIBZYPP_AGE}.${LIBZYPP_PATCH}" )
 
index 6eaa8a3..b56ad18 100644 (file)
@@ -1,86 +1,36 @@
-#if 0
-#include "Tools.h"
+#include <iostream>
+#include "zypp/base/Logger.h"
+#include "zypp/base/LogTools.h"
+#include "zypp/base/Function.h"
+#include "zypp/base/IOStream.h"
+#include "zypp/base/InputStream.h"
+#include "zypp/ProgressData.h"
 
-#include "zypp/base/Sysconfig.h"
+#include "zypp/base/Random.h"
+
+#include <boost/thread.hpp>
 
 using std::endl;
 using namespace zypp;
-namespace sysconfig = base::sysconfig;
 
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
 
-  /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+void action( int i_r )
+{
+  unsigned sec = base::random( 3 );
+  sleep( sec );
+  MIL << "Action " << i_r << " (" << sec << ")" << endl;
+}
 
 
-/******************************************************************
-**
-**      FUNCTION NAME : main
-**      FUNCTION TYPE : int
-*/
 int main( int argc, char * argv[] )
 {
-  DBG << "===[START]==========================================" << endl;
+  INT << "===[START]==========================================" << endl;
 
-  Capability f( CapFactory().parse( Resolvable::Kind( "package" ), "filesystem(foo)" ) );
-  Capability e( CapFactory().filesystemEvalCap() );
+  for ( unsigned i = 0; i < 5; ++i )
+  {
+    new boost::thread( bind( action, i ) );
+  }
 
-  MIL << f << endl;
-  MIL << e << endl;
-  MIL << f.matches( e ) << endl;
-  MIL << e.matches( f ) << endl;
-
-  DBG << "===[END]============================================" << endl;
-  zypp::base::LogControl::instance().logNothing();
-  return 0;
+  INT << "===[END]============================================" << endl << endl;
+  return ( 0 );
 }
-#endif
-
-      #include <iostream>
-      #include "zypp/base/Logger.h"
-      #include "zypp/base/IOStream.h"
-      #include "zypp/base/InputStream.h"
-      #include "zypp/ProgressData.h"
-
-      using namespace zypp;
-
-      // Defined in ProgressData.h:
-      // Initialize ProgressData from an InputStream.
-      //
-      // ProgressData makeProgressData( const InputStream & input_r )
-      // {
-      //  ProgressData ret;
-      //  ret.name( input_r.name() );
-      //  if ( input_r.size() > 0 )
-      //    ret.range( input_r.size() );
-      //  return ret;
-      // }
-
-      void simpleParser( const InputStream & input_r,
-                        const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() )
-      {
-       ProgressData ticks( makeProgressData( input_r ) );
-       ticks.sendTo( fnc_r );
-       ticks.toMin(); // start sending min (0)
-
-       iostr::EachLine line( input_r );
-       for( ; line; line.next() )
-       {
-         /* process the line */
-
-         if ( ! ticks.set( input_r.stream().tellg() ) )
-           return; // user requested abort
-       }
-
-       ticks.toMax(); // take care 100% are reported on success
-      }
-
-      int main( int argc, char * argv[] )
-      {
-        simpleParser( "packages" );
-        simpleParser( "packages.gz" );
-        return ( 0 );
-      }
index a5d55bc..5d6c609 100644 (file)
@@ -399,6 +399,7 @@ RecordId CacheStore::consumeChangelog( const data::RecordId & repository_id,
   //! \todo maybe appendChangelog(const data::RecordId & resolvable_id, Changelog changelog) will be needed
   //! for inserting the changelog using in-memory record id of corresponding resolvable.
   //! (first, we'll see how fast is the inserting without remembering those ids)
+  return data::noRecordId;
 }
 
 RecordId CacheStore::consumeFilelist( const data::RecordId & repository_id,
@@ -406,6 +407,7 @@ RecordId CacheStore::consumeFilelist( const data::RecordId & repository_id,
                                   const data::Filenames & filenames )
 {
   //! \todo maybe consumeFilelist(const data::RecordId & resolvable_id, data::Filenames &) will be needed
+  return data::noRecordId;
 }
 
 RecordId CacheStore::appendResolvable( const RecordId &repository_id,
index cea08f6..1e33d5d 100644 (file)
@@ -15,7 +15,7 @@ static char rcsid[]="$Id: mkarray.c,v 1.2 2004/12/11 18:21:51 aisa0 Exp $";
 #include <stdlib.h>
 #include <string.h>
 
-static
+static int
 mkarray(filename, file, ofile, varname)
   char *filename;
   FILE *file;
@@ -23,7 +23,7 @@ mkarray(filename, file, ofile, varname)
   char *varname;
 {
   char buf[BUFSIZ];
-  size_t i, rsize, tsize=0;
+  size_t rsize, tsize=0;
   int done=0, line=8, status=EXIT_SUCCESS;
 
   fprintf(ofile, "/*\n");
@@ -71,7 +71,7 @@ mkarray(filename, file, ofile, varname)
   if(8!=line) fputc('\n', ofile);
   fputs("};\n\n", ofile);
 
-  fprintf(ofile, "size_t _%s_size=%d;\n", varname, tsize);
+  fprintf(ofile, "size_t _%s_size=%d;\n", varname, (int)tsize);
   fprintf(ofile, "size_t *%s_size=&_%s_size;\n", varname, varname);
 
   if(ferror(ofile)) {
@@ -86,11 +86,11 @@ mkarray(filename, file, ofile, varname)
   return status;
 }
 
+int
 main(argc, argv)
   char *argv[];
 {
   char *filename, *ofilename, *varname;
-  FILE *file;
   int status=EXIT_SUCCESS;
 
   --argc;
index 5643296..9e91095 100644 (file)
@@ -41,7 +41,8 @@ sqlite3_command::sqlite3_command(sqlite3_connection &con, const char *sql) : con
 sqlite3_command::sqlite3_command(sqlite3_connection &con, const wchar_t *sql) : con(con),refs(0)\r
 {\r
   const wchar_t *tail=NULL;\r
-  if (sqlite3_prepare16(con.db, sql, -1, &this->stmt, (const void**)&tail)!=SQLITE_OK)\r
+  const wchar_t **tmpptr=&tail;\r
+  if (sqlite3_prepare16(con.db, sql, -1, &this->stmt, (const void**)tmpptr)!=SQLITE_OK)\r
     SQLITE3X_THROW(database_error(con));\r
 \r
   this->argc=sqlite3_column_count(this->stmt);\r
@@ -59,7 +60,8 @@ sqlite3_command::sqlite3_command(sqlite3_connection &con, const std::string &sql
 sqlite3_command::sqlite3_command(sqlite3_connection &con, const std::wstring &sql) : con(con),refs(0)\r
 {\r
   const wchar_t *tail=NULL;\r
-  if (sqlite3_prepare16(con.db, sql.data(), (int)sql.length()*2, &this->stmt, (const void**)&tail)!=SQLITE_OK)\r
+  const wchar_t **tmpptr=&tail;\r
+  if (sqlite3_prepare16(con.db, sql.data(), (int)sql.length()*2, &this->stmt, (const void**)tmpptr)!=SQLITE_OK)\r
     SQLITE3X_THROW(database_error(con));\r
 \r
   this->argc=sqlite3_column_count(this->stmt);\r
index 5df9e99..1861dba 100644 (file)
@@ -7,6 +7,7 @@
 |                                                                      |
 \---------------------------------------------------------------------*/
 
+#include <iostream>
 #include <map>
 #include "zypp/base/Exception.h"
 #include "RepoType.h"
index 3642803..59300c0 100644 (file)
@@ -7,6 +7,7 @@
 |                                                                      |
 \---------------------------------------------------------------------*/
 
+#include <iostream>
 #include <map>
 #include "zypp/base/Exception.h"
 #include "ResourceType.h"