Changeset 24665 for lang/c/AutoUpdater

Show
Ignore:
Timestamp:
11/23/08 02:20:50 (7 weeks ago)
Author:
saturday06
Message:

io

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/c/AutoUpdater/AutoUpdater.c

    r24023 r24665  
    3434      #pragma comment(lib, "wininet.lib") 
    3535    #endif 
     36    static unsigned int sleep(unsigned int seconds) { 
     37        Sleep(1000 * seconds); 
     38        return 0; 
     39    } 
    3640  #endif 
     41#endif 
     42 
     43#ifndef _countof 
     44  #define _countof(array) (sizeof(array) / sizeof(array[0])) 
    3745#endif 
    3846 
     
    177185     
    178186    { 
    179         //size_t url_bytes = 0; 
    180187        AU_Source* source = *new_source; 
    181188        AU_API_PRECONDITION; 
     
    260267        free(source->url_list); 
    261268    } 
     269    if (source->update_information.file) { 
     270        fclose(source->update_information.file); 
     271    } 
    262272 
    263273    // clear memory 
     
    276286AU_Result AU_GetUpdateInformation(AU_Source* source) { 
    277287    AU_API_PRECONDITION; 
    278  
     288    { 
     289        if (!source->update_information.file) { 
     290            source->update_information.file = tmpfile(); 
     291            if (!source->update_information.file) { 
     292                sleep(1); 
     293                source->update_information.file = tmpfile(); 
     294                if (!source->update_information.file) { 
     295                    return AU_ERROR_NETWORK; 
     296                } 
     297            } 
     298        } 
     299    } 
    279300#ifdef AU_WINDOWS 
    280301    {