Changeset 934


Ignore:
Timestamp:
01/29/12 18:38:29 (17 months ago)
Author:
rudi_de
Message:

Aktualisierung auf Rev. 1622 internationaler Branch: Release-1.0
http://trac.assembla.com/chdk/changeset/1622/branches/release-1_0

Betrifft alle DryOS Kameras

  • Korrektur der Reihenfolge von Änderungs- und Zugriffszeit in DryOS utime()
  • Testskript llibtst.lua aktualisiert
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CHDK/SCRIPTS/TEST/llibtst.lua

    r5 r934  
    366366end 
    367367 
    368 function tstat(name) 
     368function tstat(name,expect) 
    369369        log('os.stat("',tostring(name),'"): ') 
    370370        local r,msg = os.stat(name) 
    371371        if r then 
     372                local fail 
     373                if type(expect) == 'table' then 
     374                        for k,v in pairs(expect) do 
     375                                -- special case, dryos >= R39 doesn't set atime 
     376                                if r[k] ~= v and not (k == 'atime' and r[k] == nil) then 
     377                                        logfail("expected "..tostring(k).."="..tostring(v).." not "..tostring(r[k])) 
     378                                        fail = true 
     379                                end 
     380                        end 
     381                end 
     382                if not fail then 
     383                        logok() 
     384                end 
    372385--              local keys={ "dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime", "blksize", "blocks", "attrib", "reserved1", "reserved2", "reserved3", "reserved4", "reserved5", "reserved6",} 
    373386                local keys={ "dev", "mode", "size", "atime", "mtime", "ctime", "blksize", "blocks", "attrib","is_dir","is_file",} 
    374                 logok() 
    375387                log("{\n") 
    376388                for _,v in ipairs(keys) do 
     
    443455                tf:close() 
    444456                local fn=tdir0..tdat0 
    445                 tstat(fn) 
     457                tstat(fn,{is_file=true,is_dir=false}) 
    446458                tutime(fn) -- utime, current 
    447459                tstat(fn) 
    448                 tutime(fn,os.time({year=1984,month=1,day=1}),os.time({year=1984,month=12,day=25})) 
    449                 tstat(fn) 
    450                 tstat(tdir0) 
     460                tutime(fn,os.time({year=1984,month=1,day=1,hour=0}),os.time({year=1984,month=12,day=25,hour=0})) 
     461                tstat(fn,{mtime=os.time({year=1984,month=1,day=1,hour=0}),atime=os.time({year=1984,month=12,day=25,hour=0})}) 
     462                tstat(tdir0,{is_file=false,is_dir=true}) 
    451463                tren(tdir0..tdat0,tdir0..tdat1) 
    452464                tlistdir(tdir0) 
  • trunk/platform/generic/wrappers.c

    r933 r934  
    577577 
    578578#ifdef CAM_DRYOS_2_3_R39 
    579    if (fd>=0) { 
    580        _close(fd); 
    581        res=_SetFileTimeStamp(file, ((int*)newTimes)[0] , ((int*)newTimes)[1]); 
    582    } 
    583 #else 
    584      if (fd>=0) { 
    585       res=_SetFileTimeStamp(fd, ((int*)newTimes)[0] , ((int*)newTimes)[1]); 
    586       _close(fd); 
    587      } 
    588      // return value compatibe with utime: ok=0 fail=-1 
     579    if (fd>=0) { 
     580        _close(fd); 
     581        res=_SetFileTimeStamp(file, newTimes->modtime, newTimes->actime); 
     582    } 
     583#else 
     584    if (fd>=0) { 
     585        res=_SetFileTimeStamp(fd, newTimes->modtime, newTimes->actime); 
     586        _close(fd); 
     587    } 
     588    // return value compatibe with utime: ok=0 fail=-1 
    589589#endif 
    590590  return (res)?0:-1; 
Note: See TracChangeset for help on using the changeset viewer.