Changeset 38361
- Timestamp:
- 08/26/10 23:17:05 (3 years ago)
- Location:
- lang/c/NetworkUpdater/trunk/Build
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/c/NetworkUpdater/trunk/Build/Common.c
r38354 r38361 53 53 54 54 return error; 55 } 56 57 NU_Error NUI_Cancel(NUI_NetworkUpdater* object) 58 { 59 NU_Option option; 60 NUI_CopyOption(&option, &object->option); 61 NUI_Destroy(object); 62 NUI_Create(object, &option); 63 NUI_DestroyOption(&option); 64 return NU_NO_ERROR; 65 } 66 67 NU_Error NUI_CopyOption(NU_Option* d, const NU_Option* s) { 68 NU_Error result = NU_ERROR_SYSTEM; 69 d->current_version = _tcsdup(s->current_version); 70 if (!d->current_version) { 71 result = NU_ERROR_BAD_ALLOC; 72 goto clean_up; 73 } 74 d->debug = s->debug; 75 d->url = _tcsdup(s->url); 76 if (!d->url) { 77 result = NU_ERROR_BAD_ALLOC; 78 goto clean_up; 79 } 80 81 result = NU_NO_ERROR; 82 clean_up: 83 if (!result) { 84 NUI_DestroyOption(d); 85 } 86 return result; 87 } 88 89 void NUI_DestroyOption(NU_Option* option) { 90 /* 91 free((void*)option->current_version); 92 free((void*)option->url); 93 */ 94 memset(option, 0, sizeof(*option)); 55 95 } 56 96 -
lang/c/NetworkUpdater/trunk/Build/Common.h
r38324 r38361 94 94 95 95 typedef struct NUI_NetworkUpdater_ { 96 NU_Option option; 96 97 NUI_CommonData common; 97 98 NU_NetworkUpdater* user; … … 136 137 void NUI_RemoveDownload(NUI_DownloadContext* download); 137 138 int NUI_SearchDownload(const NUI_DownloadContext* download); 139 void NUI_DestroyOption(NU_Option* option); 140 NU_Error NUI_CopyOption(NU_Option* d, const NU_Option* s); 138 141 139 142 typedef enum { -
lang/c/NetworkUpdater/trunk/Build/MSW.c
r38335 r38361 1555 1555 CloseHandle(object->common.start_update_event); 1556 1556 } 1557 NUI_DestroyOption(&object->option); 1558 1557 1559 1558 1560 memset(object, 0, sizeof(*object)); … … 2110 2112 } 2111 2113 2112 2113 NU_Error NUI_Cancel(NUI_NetworkUpdater* object)2114 {2115 NUI_Lock(object->common.shared);2116 object->common.shared->user.pending = 1;2117 NUI_Unlock(object->common.shared);2118 SetEvent(object->common.exit_thread_event);2119 return NU_NO_ERROR;2120 }2121 2122 2123 2114 NU_Error NUI_Create(NUI_NetworkUpdater* object, const NU_Option* option) 2124 2115 { … … 2131 2122 NUI_IsBadReadPointer(option->url, 2)) { 2132 2123 error = NU_ERROR_INVALID_OPTION; 2124 goto clean_up; 2125 } 2126 2127 error = NUI_CopyOption(&object->option, option); 2128 if (error) { 2133 2129 goto clean_up; 2134 2130 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)