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

List:       klik-devel
Subject:    [klik-devel] [klikclient commit] r1426 -
From:       codesite-noreply () google ! com
Date:       2008-03-23 16:37:21
Message-ID: 0016e645a3d804491d55561d58c27afd () google ! com
[Download RAW message or body]

Author: lionel.tricon
Date: Sun Mar 23 09:37:00 2008
New Revision: 1426

Modified:
   trunk/client/trunk/CIsofsUtl/Makefile
   trunk/client/trunk/CIsofsUtl/lib_CIsoUtl.cpp
   trunk/client/trunk/CIsofsUtl/lib_CIsoUtl.hh
   trunk/client/trunk/CIsofsUtl/main.cpp

Log:
A lot of change to optimize the way we get retrieve the informations 
from the images.
That should fix issue 235


Modified: trunk/client/trunk/CIsofsUtl/Makefile
==============================================================================
--- trunk/client/trunk/CIsofsUtl/Makefile	(original)
+++ trunk/client/trunk/CIsofsUtl/Makefile	Sun Mar 23 09:37:00 2008
@@ -1,5 +1,5 @@
 CPP=g++
-CPFLAGS= -O2 -g -Wall
+CPFLAGS= -O3 -Wall
 LDFLAGS= # nothing

 all : libCIsofsUtl.a cmginfo

Modified: trunk/client/trunk/CIsofsUtl/lib_CIsoUtl.cpp
==============================================================================
--- trunk/client/trunk/CIsofsUtl/lib_CIsoUtl.cpp	(original)
+++ trunk/client/trunk/CIsofsUtl/lib_CIsoUtl.cpp	Sun Mar 23 09:37:00 2008
@@ -108,14 +108,6 @@

 string
 CIsoUtl::GetLinkInfo(
-string p_path
-)
-{
-    return this->GetLinkInfo(p_path, true);
-}
-
-string
-CIsoUtl::GetLinkInfo(
 string p_path,
 bool p_search
 )
@@ -199,7 +191,7 @@
     for (int i=0;;i++)
     {
         memset(v_buffer,'\0',ISOFS_BLOCK_SIZE+1);
-        if (isLink) 
retval=this->ReadFile(this->GetRealPath(p_path,this->GetLinkInfo(p_path)), 
v_buffer, ISOFS_BLOCK_SIZE, i*ISOFS_BLOCK_SIZE);
+        if (isLink) 
retval=this->ReadFile(this->GetRealPath(p_path,this->GetLinkInfo(p_path,true)), 
v_buffer, ISOFS_BLOCK_SIZE, i*ISOFS_BLOCK_SIZE);
         else retval=this->ReadFile(p_path, v_buffer, ISOFS_BLOCK_SIZE, i*ISOFS_BLOCK_SIZE);
         if (retval < 0) return retval;
         size += retval;
@@ -218,7 +210,6 @@
 size_t p_offset
 )
 {
-    this->searchFileIsoImage((char*)p_path.c_str());
     isofs_inode *inode = (isofs_inode*)this->findLookupTable(p_path.c_str());
     if (inode == NULL)
     {
@@ -305,7 +296,13 @@
 {
     char path_src[PATH_MAX];
     strcpy(path_src, (char*)p_path.c_str());
-    this->searchFileIsoImage(path_src);
+
+    isofs_inode *inode = (isofs_inode*)this->findLookupTable(p_path.c_str());
+    if (inode == NULL)
+    {
+      this->searchFileIsoImage(path_src);
+      inode = (isofs_inode*)this->findLookupTable(p_path.c_str());
+    }
     if (this->readDirIsoImage(path_src,p_list) == 0) return true;
     return false;
 }
@@ -315,15 +312,14 @@
 string p_path
 )
 {
-    this->searchFileIsoImage((char*)p_path.c_str());
     isofs_inode *inode = (isofs_inode*)this->findLookupTable(p_path.c_str());
     if (inode == NULL)
     {
-        if (this->_debug) fprintf(stderr, "read: know nothing about 
[%s]\n", p_path.c_str());
-        return -ENOENT;
+      this->searchFileIsoImage((char*)p_path.c_str());
+      inode = (isofs_inode*)this->findLookupTable(p_path.c_str());
     }

-    if (ISO_FLAGS_DIR(inode->record->flags)) return true;
+    if (inode!=NULL && ISO_FLAGS_DIR(inode->record->flags)) return true;
     return false;
 }

@@ -332,12 +328,11 @@
 string p_path
 )
 {
-    this->searchFileIsoImage((char*)p_path.c_str());
     isofs_inode *inode = (isofs_inode*)this->findLookupTable(p_path.c_str());
     if (inode == NULL)
     {
          if (this->_debug) fprintf(stderr, "read: know nothing about 
[%s]\n", p_path.c_str());
-        return -ENOENT;
+        return false;
     }

      if (!ISO_FLAGS_DIR(inode->record->flags) && inode->sl_len!=0) 
return true;
@@ -452,7 +447,7 @@

     if (!ISO_FLAGS_DIR(current_inode->record->flags) && current_inode->sl_len!=0)
     {
-        string newpath = 
this->GetRealPath(p_path ,this->GetLinkInfo(p_path, false));
+        string newpath = this->GetRealPath(p_path ,this->GetLinkInfo(p_path));
         this->searchFileIsoImage((char*)newpath.c_str());
         strcpy(p_path, (char*)newpath.c_str());
         return this->readDirIsoImage(p_path, p_retlist, p_list);
@@ -1077,9 +1072,9 @@
     size_t len = read(_context.fd, buf, _context.data_size);
     if (len != _context.data_size)
     {
-        fprintf(stderr, "isofs_read_raw_block: can`t read full block, 
read only %d bytes from offset %d, %d required; errno %d, message %s\n",
+        /*fprintf(stderr, "isofs_read_raw_block: can`t read full 
block, read only %d bytes from offset %d, %d required; errno %d, message %s\n",
             len, (int) off, _context.data_size, errno, strerror(errno));
-        fprintf(stderr, "isofs_read_raw_block: huh? reading zeros 
beyond file end? someone want to save a penny?\n");
+        fprintf(stderr, "isofs_read_raw_block: huh? reading zeros 
beyond file end? someone want to save a penny?\n");*/
         memset(buf + len, 0, _context.data_size - len);
         // pthread_mutex_unlock(&this->_fd_mutex);
         // return -EIO;
@@ -1850,6 +1845,7 @@
                         perror("Can`t malloc: ");
                         return -ENOMEM;
                     }
+
                     int rc = isofs_read_raw_block(inode->cl_block, buf);
                     if (rc < 0)
                     {

Modified: trunk/client/trunk/CIsofsUtl/lib_CIsoUtl.hh
==============================================================================
--- trunk/client/trunk/CIsofsUtl/lib_CIsoUtl.hh	(original)
+++ trunk/client/trunk/CIsofsUtl/lib_CIsoUtl.hh	Sun Mar 23 09:37:00 2008
@@ -40,8 +40,7 @@

         CIsoUtl(string, bool=false, string = "UTF-8//IGNORE");
         ~CIsoUtl(void);
-        string GetLinkInfo(string);
-        string GetLinkInfo(string, bool);
+        string GetLinkInfo(string, bool=false);
         bool GetFileInfo(string&, mode_t&, long&);
         int ExtractFile(string, FILE*);
         int ReadFile(string, char*, size_t, size_t);

Modified: trunk/client/trunk/CIsofsUtl/main.cpp
==============================================================================
--- trunk/client/trunk/CIsofsUtl/main.cpp	(original)
+++ trunk/client/trunk/CIsofsUtl/main.cpp	Sun Mar 23 09:37:00 2008
@@ -31,7 +31,7 @@

 #include<lib_CIsoUtl.hh>

-#define RELEASE "20080127"
+#define RELEASE "20080323"
 #define BUFFER_SIZE 2048

 CIsoUtl *IsoUtl;
@@ -57,6 +57,7 @@
     if (IsoUtl->IsLink(pathdir))
     {
         string followLink = IsoUtl->GetRealPath(pathdir,IsoUtl->GetLinkInfo(pathdir));
+        if (pathdir == followLink) return;
         if (!IsoUtl->IsDir(followLink)) return;
         pathdir = followLink;
     }
_______________________________________________
klik-devel mailing list
klik-devel@kde.org
https://mail.kde.org/mailman/listinfo/klik-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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