Changeset 38013
- Timestamp:
- 07/25/10 13:43:35 (3 years ago)
- Location:
- lang/c/AutoUpdater/trunk/recipes
- Files:
-
- 6 modified
-
AutoUpdater.vcproj (modified) (1 diff)
-
Copy.c (modified) (2 diffs)
-
Copy.vcproj (modified) (1 diff)
-
Makefile.am (modified) (1 diff)
-
Template.c (modified) (49 diffs)
-
configure.ac (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/AutoUpdater/trunk/recipes/AutoUpdater.vcproj
r37982 r38013 199 199 > 200 200 </File> 201 <File 202 RelativePath=".\XDef.h" 203 > 204 </File> 201 205 </Filter> 202 206 <Filter -
lang/c/AutoUpdater/trunk/recipes/Copy.c
r38010 r38013 1 #ifndef _UNICODE 2 #error 3 #endif 4 1 5 #include <windows.h> 2 3 #define _T(x) TEXT(x) 6 #include <tchar.h> 7 #include <commctrl.h> 8 4 9 5 10 /* http://msdn.microsoft.com/en-us/library/bb531404.aspx */ 6 11 /* swap _M_IX86 and _M_X64 */ 7 #ifdef UNICODE8 12 #if defined _M_X64 9 13 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") … … 14 18 #else 15 19 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 16 #endif17 20 #endif 18 21 -
lang/c/AutoUpdater/trunk/recipes/Copy.vcproj
r37991 r38013 63 63 <Tool 64 64 Name="VCLinkerTool" 65 AdditionalDependencies="comctl32.lib" 65 66 LinkIncremental="2" 66 67 GenerateManifest="true" -
lang/c/AutoUpdater/trunk/recipes/Makefile.am
r38010 r38013 3 3 test_SOURCES = Test.cpp Template.c 4 4 test_CPPFLAGS = -I.. -DSTRICT #-DUNICODE -D_UNICODE 5 test_CFLAGS = -O0 -g 6 test_CXXFLAGS = -O0 -g 5 7 test_LDADD = -lole32 -loleaut32 -luuid -lwininet -lshlwapi 6 8 -
lang/c/AutoUpdater/trunk/recipes/Template.c
r38010 r38013 79 79 bytes = strlen(s) + 1; 80 80 buf = (char*)calloc(bytes, 1); 81 if (!buf) {81 if (!buf) { 82 82 return NULL; 83 }83 } 84 84 memcpy(buf, s, bytes); 85 85 return buf; … … 91 91 bytes = (wcslen(s) + 1) * sizeof(wchar_t); 92 92 buf = (wchar_t*)calloc(bytes, 1); 93 if (!buf) {93 if (!buf) { 94 94 return NULL; 95 }95 } 96 96 memcpy(buf, s, bytes); 97 97 return buf; … … 103 103 TCHAR* url; 104 104 FILE* fp; 105 106 105 HINTERNET internet_handle; 107 106 HANDLE request_complete_event; 108 107 int url_handle_requested; 109 108 int wait_request_complete; 110 char buffer[1000]; 111 INTERNET_BUFFERS ib; 112 109 char buffer[1024]; 113 110 HINTERNET url_handle; 114 111 int complete; 112 INTERNET_BUFFERS* ib; /* pointer for -Wpadded */ 115 113 } AUI_DownloadContext; 116 114 … … 151 149 152 150 AU_Result E(AU_Error error) { 153 AU_Result result;151 AU_Result result; 154 152 result.success = 0; 155 153 result.pending = 0; 156 result.error = error;154 result.error = error; 157 155 return result; 158 156 } … … 170 168 TCHAR* result = NULL; 171 169 size_t result_len = 0; 172 170 173 171 result_len = _tcslen(base) + 1 + _tcslen(append) + 1; 174 172 result = (TCHAR*)calloc(result_len * sizeof(TCHAR), 1); … … 206 204 207 205 if (!WideCharToMultiByte( 208 CP_ACP,209 0,210 w,211 -1,212 m,213 bytes,214 NULL,215 NULL216 )) {217 free(m);218 return NULL;206 CP_ACP, 207 0, 208 w, 209 -1, 210 m, 211 bytes, 212 NULL, 213 NULL 214 )) { 215 free(m); 216 return NULL; 219 217 } 220 218 … … 244 242 245 243 if (!MultiByteToWideChar( 246 CP_ACP,247 0,248 m,249 -1,250 w,251 count252 )) {253 free(w);254 return NULL;255 } 256 244 CP_ACP, 245 0, 246 m, 247 -1, 248 w, 249 count 250 )) { 251 free(w); 252 return NULL; 253 } 254 257 255 return w; 258 256 } … … 286 284 287 285 *result = NULL; 288 286 289 287 system_temp_path_chars = GetTempPath(0, NULL); 290 288 system_temp_path = (TCHAR*)calloc(system_temp_path_chars * sizeof(TCHAR), 1); … … 302 300 args[1] = (unsigned int)GetTickCount(); 303 301 if (!FormatMessage( 304 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,305 _T("AutoUpdater.%1!x!.%2!x!"),306 0,307 0,308 (TCHAR*)&allocated,309 0,310 (va_list*)args)) {311 return E(AU_ERROR_BAD_ALLOC);302 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, 303 _T("AutoUpdater.%1!x!.%2!x!"), 304 0, 305 0, 306 (TCHAR*)&allocated, 307 0, 308 (va_list*)args)) { 309 return E(AU_ERROR_BAD_ALLOC); 312 310 } 313 311 dir = (TCHAR*)allocated; … … 335 333 /* http://support.microsoft.com/kb/238393 */ 336 334 HRESULT AUI_AutoWrap(WORD autoType, VARIANT *pvResult, IDispatch *pDisp, 337 const OLECHAR* ptcName, size_t cArgs, VARIANT* rargs)335 const OLECHAR* ptcName, size_t cArgs, VARIANT* rargs) 338 336 { 339 337 DISPPARAMS dp = { NULL, NULL, 0, 0 }; … … 354 352 } 355 353 356 if (pvResult) {357 VariantInit(pvResult);358 }354 if (pvResult) { 355 VariantInit(pvResult); 356 } 359 357 360 358 #ifdef __cplusplus … … 389 387 390 388 #ifdef __cplusplus 391 hr = pDisp->Invoke(dispID, IID_NULL, LOCALE_USER_DEFAULT, autoType,392 &dp, pvResult, NULL, NULL);389 hr = pDisp->Invoke(dispID, IID_NULL, LOCALE_USER_DEFAULT, 390 autoType, &dp, pvResult, NULL, NULL); 393 391 #else 394 hr = pDisp->lpVtbl->Invoke(pDisp, dispID, &IID_NULL, LOCALE_USER_DEFAULT, autoType,395 &dp, pvResult, NULL, NULL);392 hr = pDisp->lpVtbl->Invoke(pDisp, dispID, &IID_NULL, LOCALE_USER_DEFAULT, 393 autoType, &dp, pvResult, NULL, NULL); 396 394 #endif 397 395 … … 418 416 } 419 417 #ifdef __cplusplus 420 pd->AddRef();418 pd->AddRef(); 421 419 #else 422 pd->lpVtbl->AddRef(pd);420 pd->lpVtbl->AddRef(pd); 423 421 #endif 424 422 } … … 429 427 } 430 428 #ifdef __cplusplus 431 pd->Release();429 pd->Release(); 432 430 #else 433 pd->lpVtbl->Release(pd);431 pd->lpVtbl->Release(pd); 434 432 #endif 435 433 } … … 456 454 return E(AU_ERROR_NETWORK); 457 455 } 458 context->wait_request_complete = 1;456 context->wait_request_complete = 1; 459 457 } 460 458 … … 473 471 context->wait_request_complete = 0; 474 472 475 if (!context->url_handle) {476 return E(AU_ERROR_SYSTEM);477 }473 if (!context->url_handle) { 474 return E(AU_ERROR_SYSTEM); 475 } 478 476 479 477 { … … 483 481 memset(&(context->buffer), 0, sizeof(context->buffer)); 484 482 memset(&(context->ib), 0, sizeof(context->ib)); 485 context->ib .dwStructSize = sizeof(context->ib);486 context->ib .lpvBuffer = context->buffer;487 context->ib .dwBufferLength = sizeof(context->buffer);483 context->ib->dwStructSize = sizeof(context->ib); 484 context->ib->lpvBuffer = context->buffer; 485 context->ib->dwBufferLength = sizeof(context->buffer); 488 486 read_result = InternetReadFileEx( 489 context->url_handle,490 &(context->ib),491 IRF_ASYNC | IRF_USE_CONTEXT | IRF_NO_WAIT,492 (DWORD_PTR)context);487 context->url_handle, 488 context->ib, 489 IRF_ASYNC | IRF_USE_CONTEXT | IRF_NO_WAIT, 490 (DWORD_PTR)context); 493 491 e = GetLastError(); 494 492 if (!read_result && e == ERROR_IO_PENDING) { … … 500 498 return E(AU_ERROR_NETWORK); 501 499 } 502 503 } 504 if (context->ib .dwBufferLength == 0) {500 501 } 502 if (context->ib->dwBufferLength == 0) { 505 503 fclose(context->fp); 506 504 context->fp = NULL; … … 509 507 } 510 508 511 if (fwrite(context->buffer, 1, context->ib .dwBufferLength, context->fp) != context->ib.dwBufferLength) {509 if (fwrite(context->buffer, 1, context->ib->dwBufferLength, context->fp) != context->ib->dwBufferLength) { 512 510 return E(AU_ERROR_SYSTEM); 513 511 } … … 515 513 } 516 514 515 /* http://msdn.microsoft.com/en-us/library/aa385121.aspx */ 517 516 void CALLBACK AUI_InternetStatusCallback( 518 517 HINTERNET hInternet, … … 524 523 AUI_DownloadContext* context = (AUI_DownloadContext*)dwContext; 525 524 525 (void)hInternet; 526 (void)dwStatusInformationLength; 527 526 528 switch (dwInternetStatus) { 527 case INTERNET_STATUS_HANDLE_CREATED: 529 case INTERNET_STATUS_CLOSING_CONNECTION: 530 /* Closing the connection to the server. The lpvStatusInformation 531 parameter is NULL. */ 532 { 533 534 } 535 break; 536 case INTERNET_STATUS_CONNECTED_TO_SERVER: 537 /* Successfully connected to the socket address (SOCKADDR) 538 pointed to by lpvStatusInformation. */ 539 { 540 541 } 542 break; 543 case INTERNET_STATUS_CONNECTING_TO_SERVER: 544 /* Connecting to the socket address (SOCKADDR) pointed to by 545 lpvStatusInformation. */ 546 { 547 } 548 break; 549 case INTERNET_STATUS_CONNECTION_CLOSED: 550 /* Successfully closed the connection to the server. The 551 lpvStatusInformation parameter is NULL. */ 552 { 553 } 554 break; 555 #if 0 556 case INTERNET_STATUS_COOKIE_HISTORY: 557 /* Retrieving content from the cache. Contains data about past 558 cookie events for the URL such as if cookies were accepted, 559 rejected, downgraded, or leashed. 560 561 The lpvStatusInformation parameter is a pointer to an 562 InternetCookieHistory structure. */ 563 { 564 } 565 break; 566 case INTERNET_STATUS_COOKIE_RECEIVED: 567 /* Indicates the number of cookies that were accepted, rejected, 568 downgraded (changed from persistent to session cookies), or 569 leashed (will be sent out only in 1st party context). The 570 lpvStatusInformation parameter is a DWORD with the number of 571 cookies received. */ 572 { 573 } 574 break; 575 case INTERNET_STATUS_COOKIE_SENT: 576 /* Indicates the number of cookies that were either sent or 577 suppressed, when a request is sent. The lpvStatusInformation 578 parameter is a DWORD with the number of cookies sent or 579 suppressed. */ 580 { 581 } 582 break; 583 #endif 584 case INTERNET_STATUS_CTL_RESPONSE_RECEIVED: 585 /* Not implemented. */ 586 { 587 } 588 break; 589 #if 0 590 case INTERNET_STATUS_DETECTING_PROXY: 591 /* Notifies the client application that a proxy has been detected. */ 592 { 593 } 594 break; 595 #endif 596 case INTERNET_STATUS_HANDLE_CLOSING: 597 /* This handle value has been terminated. pvStatusInformation 598 contains the address of the handle being closed. The 599 lpvStatusInformation parameter contains the address of the 600 handle being closed. */ 601 { 602 } 603 break; 604 case INTERNET_STATUS_HANDLE_CREATED: 605 /* Used by InternetConnect to indicate it has created the new 606 handle. This lets the application call InternetCloseHandle 607 from another thread, if the connect is taking too long. The 608 lpvStatusInformation parameter contains the address of an 609 HINTERNET handle. */ 528 610 { 529 611 INTERNET_ASYNC_RESULT* async_result = (INTERNET_ASYNC_RESULT*)lpvStatusInformation; … … 531 613 } 532 614 break; 533 case INTERNET_STATUS_CONNECTION_CLOSED: 615 #if 0 616 case INTERNET_STATUS_INTERMEDIATE_RESPONSE: 617 /* Received an intermediate (100 level) status code message 618 from the server. */ 619 { 620 } 621 break; 622 #endif 623 case INTERNET_STATUS_NAME_RESOLVED: 624 /* Successfully found the IP address of the name contained in 625 lpvStatusInformation. The lpvStatusInformation parameter points 626 to a PCTSTR containing the host name. */ 627 { 628 } 629 break; 630 #if 0 631 case INTERNET_STATUS_P3P_HEADER: 632 /* The response has a P3P header in it. */ 633 { 634 } 635 break; 636 case INTERNET_STATUS_P3P_POLICYREF: 637 /* Not implemented. */ 638 { 639 } 640 break; 641 #endif 642 case INTERNET_STATUS_PREFETCH: 643 /* Not implemented. */ 644 { 645 } 646 break; 647 #if 0 648 case INTERNET_STATUS_PRIVACY_IMPACTED: 649 /* Not implemented. */ 650 { 651 } 652 break; 653 #endif 654 case INTERNET_STATUS_RECEIVING_RESPONSE: 655 /* Waiting for the server to respond to a request. The 656 lpvStatusInformation parameter is NULL. */ 657 { 658 } 659 break; 660 case INTERNET_STATUS_REDIRECT: 661 /* An HTTP request is about to automatically redirect the request. 662 The lpvStatusInformation parameter points to the new URL. 663 At this point, the application can read any data returned 664 by the server with the redirect response and can query the 665 response headers. It can also cancel the operation by closing 666 the handle. This callback is not made if the original request 667 specified INTERNET_FLAG_NO_AUTO_REDIRECT. */ 668 { 669 } 534 670 break; 535 671 case INTERNET_STATUS_REQUEST_COMPLETE: 536 SetEvent(context->request_complete_event); 537 break; 672 /* An asynchronous operation has been completed. The 673 lpvStatusInformation parameter contains the address of an 674 INTERNET_ASYNC_RESULT structure. */ 675 { 676 SetEvent(context->request_complete_event); 677 } 678 break; 679 case INTERNET_STATUS_REQUEST_SENT: 680 /* Successfully sent the information request to the server. The 681 lpvStatusInformation parameter points to a DWORD value that 682 contains the number of bytes sent. */ 683 { 684 } 685 break; 686 case INTERNET_STATUS_RESOLVING_NAME: 687 /* Looking up the IP address of the name contained in 688 lpvStatusInformation. The lpvStatusInformation parameter points 689 to a PCTSTR containing the host name. */ 690 { 691 } 692 break; 693 case INTERNET_STATUS_RESPONSE_RECEIVED: 694 /* Successfully received a response from the server. */ 695 { 696 } 697 break; 698 case INTERNET_STATUS_SENDING_REQUEST: 699 /* Sending the information request to the server. The 700 lpvStatusInformation parameter is NULL. */ 701 { 702 } 703 break; 704 #if 0 705 case INTERNET_STATUS_STATE_CHANGE: 706 /* Moved between a secure (HTTPS) and a nonsecure (HTTP) site. 707 The user must be informed of this change; otherwise, the user 708 is at risk of disclosing sensitive information involuntarily. 709 When this flag is set, the lpvStatusInformation parameter points 710 to a status DWORD that contains additional flags. */ 711 { 712 } 713 break; 714 #endif 538 715 default: 539 716 break; … … 550 727 } 551 728 729 context->ib = (INTERNET_BUFFERS*)calloc(sizeof(*context->ib), 1); 730 if (!context->ib) { 731 return E(AU_ERROR_BAD_ALLOC); 732 } 733 552 734 context->url = _tcsdup(url); 553 735 if (!context->url) { … … 562 744 _tfopen_s(&context->fp, context->file_path, _T("wb")); 563 745 564 if (!context->fp) {565 return E(AU_ERROR_SYSTEM);566 }746 if (!context->fp) { 747 return E(AU_ERROR_SYSTEM); 748 } 567 749 568 750 context->request_complete_event = CreateEvent(NULL, FALSE, FALSE, NULL); 569 if (!context->request_complete_event) {570 return E(AU_ERROR_SYSTEM);571 }751 if (!context->request_complete_event) { 752 return E(AU_ERROR_SYSTEM); 753 } 572 754 573 755 context->internet_handle = 574 756 InternetOpen( 575 TEXT("saturday06's AutoUpdater"),576 INTERNET_OPEN_TYPE_PRECONFIG,577 NULL,578 NULL,579 INTERNET_FLAG_ASYNC);757 TEXT("saturday06's AutoUpdater"), 758 INTERNET_OPEN_TYPE_PRECONFIG, 759 NULL, 760 NULL, 761 INTERNET_FLAG_ASYNC); 580 762 581 763 if (!context->internet_handle) { … … 584 766 585 767 if (InternetSetStatusCallback(context->internet_handle, AUI_InternetStatusCallback) 586 == INTERNET_INVALID_STATUS_CALLBACK) {587 return E(AU_ERROR_SYSTEM);768 == INTERNET_INVALID_STATUS_CALLBACK) { 769 return E(AU_ERROR_SYSTEM); 588 770 } 589 771 … … 596 778 if (AUI_IsBadReadPointer(context, sizeof(context)) || 597 779 AUI_IsBadWritePointer(context, sizeof(context))) { 598 return E(AU_ERROR_SYSTEM); 780 return E(AU_ERROR_SYSTEM); 781 } 782 if (context->ib) { 783 free(context->ib); 599 784 } 600 785 if (context->fp) { … … 623 808 /* 624 809 DWORD CALLBACK AUI_WindowsUpdateThread(LPVOID context_) { 625 AUI_UpdaterThread((AUI_Context*)context_);626 return 0;810 AUI_UpdaterThread((AUI_Context*)context_); 811 return 0; 627 812 } 628 813 */ … … 634 819 AUI_IsBadReadPointer(option, sizeof(*option)) || 635 820 AUI_IsBadReadPointer(option->url, 1)) { 636 return E(AU_ERROR_INVALID_OPTION);821 return E(AU_ERROR_INVALID_OPTION); 637 822 } 638 823 … … 693 878 void AUI_DeleteDirectory(const TCHAR* dir) { 694 879 TCHAR* glob = NULL; 695 WIN32_FIND_DATA find_data;880 WIN32_FIND_DATA find_data; 696 881 HANDLE hFind = NULL; 697 882 … … 701 886 702 887 glob = AUI_PathAppendDup(dir, _T("*")); 703 hFind = FindFirstFile(glob, &find_data);704 if( INVALID_HANDLE_VALUE == hFind ) {705 return;706 }707 708 do {888 hFind = FindFirstFile(glob, &find_data); 889 if( INVALID_HANDLE_VALUE == hFind ) { 890 return; 891 } 892 893 do { 709 894 TCHAR* dir2 = NULL; 710 895 … … 719 904 dir2 = AUI_PathAppendDup(dir, find_data.cFileName); 720 905 721 if (FILE_ATTRIBUTE_DIRECTORY & find_data.dwFileAttributes) {906 if (FILE_ATTRIBUTE_DIRECTORY & find_data.dwFileAttributes) { 722 907 AUI_DeleteDirectory(dir2); 723 908 } else { 724 909 DeleteFile(dir2); 725 }910 } 726 911 727 912 free(dir2); … … 729 914 } while(FindNextFile(hFind, &find_data)); 730 915 731 FindClose(hFind);916 FindClose(hFind); 732 917 free(glob); 733 return;918 return; 734 919 } 735 920 … … 788 973 IDispatch* releaseNode = NULL; 789 974 IDispatch* urlNode = NULL; 790 IDispatch* descriptionNode = NULL;975 /* IDispatch* descriptionNode = NULL; */ 791 976 792 977 r = E(AU_ERROR_SYSTEM); … … 831 1016 PVOID cast = 0; 832 1017 result = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, &cast); 833 Microsoft_XMLDOM = (IDispatch*)cast;1018 Microsoft_XMLDOM = (IDispatch*)cast; 834 1019 } 835 1020 #endif … … 862 1047 } 863 1048 864 1049 865 1050 { /* Microsoft_XMLDOM.async = false */ 866 1051 args[0].vt = VT_BOOL; … … 869 1054 } 870 1055 871 1056 872 1057 { /* Microsoft_XMLDOM.load("file.xml") */ 873 1058 args[0].vt = VT_BSTR; 874 1059 /* args[0].bstrVal = SysAllocString(OLESTR("c:/Documents and Settings/saturday06/My Documents/My Dropbox/jsxml.xml")); */ 875 /* args[0].bstrVal = SysAllocString(OLESTR("D:/Documents/My Dropbox/jsxml.xml")); */1060 /* args[0].bstrVal = SysAllocString(OLESTR("D:/Documents/My Dropbox/jsxml.xml")); */ 876 1061 args[0].bstrVal = AUI_TCharToBStrDup(context->releases_file_path); 877 1062 result = AUI_AutoWrap(DISPATCH_METHOD, &returnValue, Microsoft_XMLDOM, OLESTR("load"), 1, args); … … 879 1064 goto clean_up; 880 1065 } 881 if (!returnValue.boolVal) {882 goto clean_up;883 }1066 if (!returnValue.boolVal) { 1067 goto clean_up; 1068 } 884 1069 VariantClear(&returnValue); 885 1070 } … … 888 1073 args[0].vt = VT_BSTR; 889 1074 args[0].bstrVal = SysAllocString(OLESTR("SelectionLanguage")); 890 if (!args[0].bstrVal) {891 goto clean_up;892 }1075 if (!args[0].bstrVal) { 1076 goto clean_up; 1077 } 893 1078 args[1].vt = VT_BSTR; 894 1079 args[1].bstrVal = SysAllocString(OLESTR("XPath")); 895 if (!args[1].bstrVal) {896 goto clean_up;897 }1080 if (!args[1].bstrVal) { 1081 goto clean_up; 1082 } 898 1083 result = AUI_AutoWrap(DISPATCH_METHOD, NULL, Microsoft_XMLDOM, OLESTR("setProperty"), 2, args); 899 1084 if (FAILED(result)) { … … 901 1086 } 902 1087 } 903 1088 904 1089 { /* var documentElement = Microsoft_XMLDOM.documentElement */ 905 1090 result = AUI_AutoWrap(DISPATCH_PROPERTYGET, &returnValue, Microsoft_XMLDOM, OLESTR("documentElement"), 0, NULL); … … 919 1104 memset(xpath, 0, sizeof(xpath)); 920 1105 wsprintf(xpath, /* TODO */ 921 _T("/releases/release[not(@debug) or @debug <= %d][")922 _T("not(@revision <= preceding-sibling::release[not(@debug) or @debug <= %d]/@revision) and ")923 _T("not(@revision <= following-sibling::release[not(@debug) or @debug <= %d]/@revision)]")1106 _T("/releases/release[not(@debug) or @debug <= %d][") 1107 _T("not(@revision <= preceding-sibling::release[not(@debug) or @debug <= %d]/@revision) and ") 1108 _T("not(@revision <= following-sibling::release[not(@debug) or @debug <= %d]/@revision)]") 924 1109 , context->download_debug, context->download_debug, context->download_debug 925 1110 ); … … 941 1126 VariantClear(&returnValue); 942 1127 } 943 1128 944 1129 { /* var urlNode = releaseNode.selectSingleNode("url"); */ 945 1130 args[0].vt = VT_BSTR; … … 984 1169 r = AUI_SUCCESS; 985 1170 clean_up: 986 AUI_IDispatchRelease(urlNode);987 AUI_IDispatchRelease(releaseNode);1171 AUI_IDispatchRelease(urlNode); 1172 AUI_IDispatchRelease(releaseNode); 988 1173 AUI_IDispatchRelease(Microsoft_XMLDOM); 989 1174 … … 1074 1259 1075 1260 _tfopen_s(&f, context->updater_config_file_path, _T("wb")); 1076 if (!f) {1261 if (!f) { 1077 1262 return E(AU_ERROR_SYSTEM); 1078 }1263 } 1079 1264 1080 1265 { … … 1104 1289 0, 1105 1290 (va_list*)args)) { 1106 return E(AU_ERROR_BAD_ALLOC);1291 return E(AU_ERROR_BAD_ALLOC); 1107 1292 } 1108 1293 data = AUI_TCharToWideCharDup((TCHAR*)allocated); … … 1117 1302 } 1118 1303 } 1119 fclose(f);1304 fclose(f); 1120 1305 } 1121 1306 … … 1127 1312 memset(&pi, 0, sizeof(pi)); 1128 1313 CreateProcess(context->updater_file_path, NULL, NULL, NULL, FALSE, 0, NULL, context->temp_dir_path, &si, &pi); 1129 CloseHandle(pi.hThread);1130 CloseHandle(pi.hProcess);1314 CloseHandle(pi.hThread); 1315 CloseHandle(pi.hProcess); 1131 1316 } 1132 1317 … … 1137 1322 1138 1323 AU_Result AUI_Cancel(AUI_Context* context) { 1324 (void)context; 1139 1325 return AUI_SUCCESS; 1140 1326 } … … 1143 1329 AUI_Context* internal_context = (AUI_Context*)context; 1144 1330 *internal_context_output = 0; 1145 1146 if (AUI_IsBadReadPointer(internal_context, sizeof(internal_context))) {1147 return E(AU_ERROR_INVALID_CONTEXT);1148 }1149 1150 if (AUI_IsBadWritePointer(internal_context, sizeof(internal_context))) {1151 return E(AU_ERROR_INVALID_CONTEXT);1152 }1153 1154 if (internal_context->description != NULL && AUI_IsBadWritePointer(internal_context->description, 1)) {1155 return E(AU_ERROR_INVALID_CONTEXT);1156 }1157 1158 if (internal_context->releases_file_path != NULL && AUI_IsBadWritePointer(internal_context->releases_file_path, 1)) {1159 return E(AU_ERROR_INVALID_CONTEXT);1160 }1161 1162 if (internal_context->created_signature != AUI_CONTEXT_CREATED_SIGNATURE) {1163 return E(AU_ERROR_INVALID_CONTEXT);1164 }1331 1332 if (AUI_IsBadReadPointer(internal_context, sizeof(internal_context))) { 1333 return E(AU_ERROR_INVALID_CONTEXT); 1334 } 1335 1336 if (AUI_IsBadWritePointer(internal_context, sizeof(internal_context))) { 1337 return E(AU_ERROR_INVALID_CONTEXT); 1338 } 1339 1340 if (internal_context->description != NULL && AUI_IsBadWritePointer(internal_context->description, 1)) { 1341 return E(AU_ERROR_INVALID_CONTEXT); 1342 } 1343 1344 if (internal_context->releases_file_path != NULL && AUI_IsBadWritePointer(internal_context->releases_file_path, 1)) { 1345 return E(AU_ERROR_INVALID_CONTEXT); 1346 } 1347 1348 if (internal_context->created_signature != AUI_CONTEXT_CREATED_SIGNATURE) { 1349 return E(AU_ERROR_INVALID_CONTEXT); 1350 } 1165 1351 1166 1352 *internal_context_output = internal_context; … … 1169 1355 1170 1356 /* ----------------------------------------------------------------------- 1171 Interfaces1172 ----------------------------------------------------------------------- */1357 Interfaces 1358 ----------------------------------------------------------------------- */ 1173 1359 1174 1360 #define AUI_API_PRECONDITION \ 1175 AUI_Context* internal_context = NULL; \1176 { \1177 AU_Result convert_result = AUI_ContextToInternalContext(&internal_context, context); \1178 if (convert_result.error) { \1179 return convert_result; \1180 } \1181 }1361 AUI_Context* internal_context = NULL; \ 1362 { \ 1363 AU_Result convert_result = AUI_ContextToInternalContext(&internal_context, context); \ 1364 if (convert_result.error) { \ 1365 return convert_result; \ 1366 } \ 1367 } 1182 1368 1183 1369 AU_Result AU_CreateContext(AU_Context* pcontext, const AU_Option* option) { 1184 1370 AU_Context context = NULL; 1185 1371 1186 1372 if (AUI_IsBadWritePointer(pcontext, sizeof(*pcontext))) { 1187 1373 return E(AU_ERROR_INVALID_CONTEXT); -
lang/c/AutoUpdater/trunk/recipes/configure.ac
r38010 r38013 8 8 AC_CONFIG_SRCDIR([XDef.h]) 9 9 10 CFLAGS="-O0 -g"11 CXXFLAGS="-O0 -g"10 CFLAGS="-O0" 11 CXXFLAGS="-O0" 12 12 13 13 AC_PROG_CC … … 39 39 40 40 cat >common_options.txt <<OPTIONS 41 -g42 41 -ansi 43 -pedantic44 42 -pedantic 45 43 -Wextra -Wall -Waddress -Warray-bounds … … 49 47 -Wdisabled-optimization 50 48 -Wempty-body -Wenum-compare 51 -Wfloat-equal -Wformat-Wformat=249 -Wfloat-equal -Wformat=2 52 50 -Wformat-nonliteral 53 51 -Wformat-security -Wformat-y2k … … 66 64 -Wreturn-type -Wsequence-point -Wshadow 67 65 -Wsign-compare -Wsign-conversion -Wstack-protector 68 -Wstrict-aliasing -Wstrict-aliasing=269 -Wstrict-overflow -Wstrict-overflow=266 -Wstrict-aliasing=2 67 -Wstrict-overflow=2 70 68 -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand 71 69 -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized … … 77 75 OPTIONS 78 76 # -Wsystem-headers 79 # -Waggregate-return 77 # -Waggregate-return <---- TODO 80 78 81 79 cat >c_options.txt <<OPTIONS … … 88 86 -Wstrict-prototypes 89 87 -Wdeclaration-after-statement -Wpointer-sign 88 -Wold-style-declaration -Wold-style-definition 90 89 OPTIONS 90 # -Wmissing-prototypes <---- TODO 91 91 # -Wmissing-declarations <---- TODO 92 #-Wmissing-prototypes 93 #-Wtraditional -Wtraditional-conversion 94 #-Wold-style-declaration -Wold-style-definition 92 # -Wtraditional-conversion 93 # -Wtraditional 95 94 96 95 cat >cxx_options.txt <<OPTIONS … … 111 110 -Wundeclared-selector 112 111 OPTIONS 112 113 113 114 114 for option in `cat common_options.txt`; do
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)