Changeset 37967

Show
Ignore:
Timestamp:
07/19/10 18:20:53 (3 years ago)
Author:
saturday06
Message:

moudamedaimiwakaran

Location:
lang/c/AutoUpdater/trunk
Files:
3 modified

Legend:

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

    r37965 r37967  
    22#include "AutoUpdater.h" 
    33 
     4#include <winuser.h> 
    45#include <stdarg.h> 
    56#include <stdio.h> 
     
    1920#pragma comment(lib, "shlwapi.lib") 
    2021#if defined(_CRT_NONSTDC_DEPRECATE) && !defined(_CRT_NONSTDC_NO_WARNINGS) && !defined(_POSIX_) 
    21 #define wcsdup _wcsdup 
    22 #endif 
    23 #endif 
     22/* #define wcsdup _wcsdup */ 
     23#endif 
     24#endif 
     25 
     26#ifdef strdup 
     27#undef strdup 
     28#endif 
     29#ifdef _strdup 
     30#undef _strdup 
     31#endif 
     32#ifdef wcsdup 
     33#undef wcsdup 
     34#endif 
     35#ifdef _wcsdup 
     36#undef _wcsdup 
     37#endif 
     38 
     39#define strdup AUI_strdup 
     40#define wcsdup AUI_wcsdup 
     41#define _strdup AUI_strdup 
     42#define _wcsdup AUI_wcsdup 
    2443 
    2544#ifdef __CYGWIN__ 
     
    2847#  define GUID_NULL AUI_GUID_NULL 
    2948#  define IID_IDispatch AUI_IID_IDispatch 
    30 #  define strdup AUI_strdup 
    31 #  define wcsdup AUI_wcsdup 
    3249 
    3350const GUID AUI_GUID_NULL = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0 }}; 
     
    102119        va_start(ap,format); 
    103120#if defined(UNICODE) || defined(_UNICODE) 
    104         vswprintf(buffer, count, format, ap); 
     121/*        vswprintf(buffer, count, format, ap);*/ 
     122        vwsprintf(buffer, format, ap); 
    105123#elif __STDC_VERSION__ >= 199901L 
    106124        vsnprintf(buffer, count, format, ap); 
     
    159177} AUI_Context; 
    160178 
    161 const AU_Result AUI_SUCCESS = {1, 0, 0}; 
    162 const AU_Result AUI_IO_PENDING = {0, 1, 0}; 
     179const AU_Result AUI_SUCCESS = {1, 0, AU_NO_ERROR}; 
     180const AU_Result AUI_IO_PENDING = {0, 1, AU_NO_ERROR}; 
    163181 
    164182AU_Result E(AU_Error error) { 
    165         AU_Result result = {0, 0, 0}; 
     183        AU_Result result; 
     184    result.success = 0; 
     185    result.pending = 0; 
    166186        result.error = error; 
    167187    return result; 
    168188} 
     189 
    169190 
    170191int AUI_IsBadReadPointer(const void* pointer, size_t bytes) { 
     
    808829        OLECHAR xpath[500]; 
    809830        memset(xpath, 0, sizeof(xpath)); 
    810         swprintf(xpath, sizeof(xpath) / sizeof(xpath[0]) /* MSVCRT */ -1, 
     831        wsprintf(xpath, /* TODO */ 
    811832            OLESTR("/releases/release[not(@debug) or @debug <= %d][") 
    812833            OLESTR("not(@revision <= preceding-sibling::release[not(@debug) or @debug <= %d]/@revision) and ") 
     
    901922} 
    902923 
     924extern const size_t AUI_UPDATER_BYTES; 
     925extern const char AUI_UPDATER_DATA[]; 
    903926AU_Result AUI_ExtractBy7za(AUI_Context* context); 
    904927 
     
    933956 
    934957    { 
    935         extern const size_t AUI_UPDATER_BYTES; 
    936         extern const char AUI_UPDATER_DATA[]; 
    937958        AU_Result r; 
    938959        FILE* f = NULL; 
  • lang/c/AutoUpdater/trunk/UpdaterProcess.c

    r37966 r37967  
    22 
    33#define _T(x) TEXT(x) 
     4 
     5int AUI_Debug(const TCHAR* format, ...); 
     6TCHAR* AUI_PathAppend(const TCHAR* base, const TCHAR* append); 
    47 
    58int AUI_Debug(const TCHAR* format, ...) { 
     
    1518        char* mb = 0; 
    1619        size_t mb_bytes = 0; 
    17         mb_bytes = WideCharToMultiByte(CP_ACP, 0, output, -1, NULL, 0, NULL, NULL); 
     20        mb_bytes = (size_t)WideCharToMultiByte(CP_ACP, 0, output, -1, NULL, 0, NULL, NULL); 
     21        if (!mb_bytes) { 
     22            return -1; 
     23        } 
    1824        mb = (char*)calloc(mb_bytes, 1); 
    19         WideCharToMultiByte(CP_ACP, 0, output, -1, mb, mb_bytes, NULL, NULL); 
    20  
     25        if (!WideCharToMultiByte(CP_ACP, 0, output, -1, mb, (int)mb_bytes, NULL, NULL)) { 
     26            return -1; 
     27        } 
    2128        /* hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); */ 
    2229        hStdOut = CreateFile(_T("c:\\temp\\up.txt"), GENERIC_WRITE,  
     
    3441TCHAR* AUI_PathAppend(const TCHAR* base, const TCHAR* append) { 
    3542    TCHAR* result = NULL; 
    36     size_t result_len = 0; 
     43    int result_len = 0; 
    3744     
    3845    result_len = lstrlen(base) + 1 + lstrlen(append) + 1; 
  • lang/c/AutoUpdater/trunk/configure.ac

    r37962 r37967  
    101101  -Wc++-compat 
    102102  -Wbad-function-cast  -Wmissing-declarations  
    103   -Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs  
    104   -Wold-style-declaration  -Wold-style-definition  
    105   -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion  
     103  -Wmissing-parameter-type -Wnested-externs  
     104  -Wstrict-prototypes  
    106105  -Wdeclaration-after-statement -Wpointer-sign 
    107106]) 
     107 
     108#-Wmissing-prototypes  
     109#-Wtraditional  -Wtraditional-conversion  
     110#-Wold-style-declaration  -Wold-style-definition  
    108111 
    109112CXX_OPTIONS([ 
     
    126129COMMON_OPTIONS([ 
    127130  -pedantic 
    128   -Waggregate-return  
    129131  -Wextra  -Wall  -Waddress  -Warray-bounds  
    130132  -Wcast-align  -Wcast-qual   
     
    161163]) 
    162164# -Wsystem-headers  
     165# -Waggregate-return  
    163166 
    164167AC_CONFIG_FILES([Makefile])