Changeset 610


Ignore:
Timestamp:
08/18/14 10:03:36 (5 years ago)
Author:
jls17
Message:
  • moved ARZeroMemory function to Memory.cpp/.h
  • added new ARZeroMemory function which has a size parameter to replace ZeroMemory? (which is only available on windows)
  • replaced all ZeroMemory? calls with ARZeroMemory
  • fixed some gcc compiler warnings
  • now ARQualification throws AppException? instead of exception, because in the standard implementation there is no constructor to pass a message to exception class (this MSVC specific)
Location:
branches/work_311
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/work_311/ARApi.h

    r422 r610  
    2020#include <arstruct.h> 
    2121#include <arextern.h> 
     22#include "util/Memory.h" 
    2223 
    2324// this is just a little workaround for a bug in ar.h version 7.5 
     
    9192#define AR_XML_VERSION_710 10 
    9293#define AR_XML_VERSION_750 11 
    93  
    94 // template for clearing memory of AR structs 
    95 template<class T> 
    96 void ARZeroMemory(T* obj) { memset(obj, 0, sizeof(T)); } 
  • branches/work_311/ARInsideLib.vcproj

    r605 r610  
    21162116                        <File 
    21172117                                RelativePath=".\util\Context.h" 
     2118                                > 
     2119                        </File> 
     2120                        <File 
     2121                                RelativePath=".\util\Memory.cpp" 
     2122                                > 
     2123                        </File> 
     2124                        <File 
     2125                                RelativePath=".\util\Memory.h" 
    21182126                                > 
    21192127                        </File> 
  • branches/work_311/core/ARQualification.cpp

    r592 r610  
    341341 
    342342                        CDocCurrencyField docCurrency(formId, *operand->u.currencyField); 
    343                         char *prefix = getFieldPrefix(operand); 
     343                        const char *prefix = getFieldPrefix(operand); 
    344344                         
    345345                        qText << delimiter; 
     
    394394} 
    395395 
    396 char* CARQualification::getFieldPrefix(ARFieldValueOrArithStruct *operand) 
     396const char* CARQualification::getFieldPrefix(ARFieldValueOrArithStruct *operand) 
    397397{ 
    398398        if (operand == NULL) return NULL; 
     
    429429                return true; 
    430430        } 
    431         throw exception("NotImplementedException"); 
    432 } 
    433  
     431        throw AppException("NotImplementedException", "ARQual"); 
     432} 
     433 
  • branches/work_311/core/ARQualification.h

    r592 r610  
    4949        void CheckOperand(ARFieldValueOrArithStruct *operand, ARFieldValueOrArithStruct *parent, stringstream &qText); 
    5050        int FindCurrentEnumFieldId(); 
    51         char* getFieldPrefix(ARFieldValueOrArithStruct *operand); 
     51        const char* getFieldPrefix(ARFieldValueOrArithStruct *operand); 
    5252        bool getFormIdAndDelimiter(ARFieldValueOrArithStruct *operand, int &formId, char &delimiter); 
    5353 
  • branches/work_311/lists/ARFieldList.cpp

    r549 r610  
    324324{ 
    325325        names.nameList = new ARNameType[amount]; 
    326         ZeroMemory(names.nameList, sizeof(ARNameType) * amount); 
     326        ARZeroMemory(names.nameList, sizeof(ARNameType) * amount); 
    327327 
    328328        fieldIds.internalIdList = new ARInternalId[amount]; 
    329         ZeroMemory(fieldIds.internalIdList, sizeof(ARInternalId) * amount); 
     329        ARZeroMemory(fieldIds.internalIdList, sizeof(ARInternalId) * amount); 
    330330 
    331331        fieldMaps.mappingList = new ARFieldMappingStruct[amount]; 
    332         ZeroMemory(fieldMaps.mappingList, sizeof(ARFieldMappingStruct) * amount); 
     332        ARZeroMemory(fieldMaps.mappingList, sizeof(ARFieldMappingStruct) * amount); 
    333333 
    334334        dataTypes.intList = new unsigned int[amount]; 
    335         ZeroMemory(dataTypes.intList, sizeof(unsigned int) * amount); 
     335        ARZeroMemory(dataTypes.intList, sizeof(unsigned int) * amount); 
    336336 
    337337        options.intList = new unsigned int[amount]; 
    338         ZeroMemory(options.intList, sizeof(unsigned int) * amount); 
     338        ARZeroMemory(options.intList, sizeof(unsigned int) * amount); 
    339339 
    340340        createModes.intList = new unsigned int[amount]; 
    341         ZeroMemory(createModes.intList, sizeof(unsigned int) * amount); 
     341        ARZeroMemory(createModes.intList, sizeof(unsigned int) * amount); 
    342342         
    343343        fieldOptions.intList = new unsigned int[amount]; 
    344         ZeroMemory(fieldOptions.intList, sizeof(unsigned int) * amount); 
     344        ARZeroMemory(fieldOptions.intList, sizeof(unsigned int) * amount); 
    345345 
    346346        defaultValues.valueList = new ARValueStruct[amount]; 
    347         ZeroMemory(defaultValues.valueList, sizeof(ARValueStruct) * amount); 
     347        ARZeroMemory(defaultValues.valueList, sizeof(ARValueStruct) * amount); 
    348348 
    349349        permLists.permissionList = new ARPermissionList[amount]; 
    350         ZeroMemory(permLists.permissionList, sizeof(ARPermissionList) * amount); 
     350        ARZeroMemory(permLists.permissionList, sizeof(ARPermissionList) * amount); 
    351351 
    352352        limits.fieldLimitList = new ARFieldLimitStruct[amount]; 
    353         ZeroMemory(limits.fieldLimitList, sizeof(ARFieldLimitStruct) * amount); 
     353        ARZeroMemory(limits.fieldLimitList, sizeof(ARFieldLimitStruct) * amount); 
    354354 
    355355        dInstanceLists.dInstanceList = new ARDisplayInstanceList[amount]; 
    356         ZeroMemory(dInstanceLists.dInstanceList, sizeof(ARDisplayInstanceList) * amount); 
     356        ARZeroMemory(dInstanceLists.dInstanceList, sizeof(ARDisplayInstanceList) * amount); 
    357357 
    358358        helpTexts.stringList = new char*[amount]; 
    359         ZeroMemory(helpTexts.stringList, sizeof(char*) * amount); 
     359        ARZeroMemory(helpTexts.stringList, sizeof(char*) * amount); 
    360360 
    361361        changedTimes.timestampList = new ARTimestamp[amount]; 
    362         ZeroMemory(changedTimes.timestampList, sizeof(ARTimestamp) * amount); 
     362        ARZeroMemory(changedTimes.timestampList, sizeof(ARTimestamp) * amount); 
    363363 
    364364        owners.nameList = new ARAccessNameType[amount]; 
    365         ZeroMemory(owners.nameList, sizeof(ARAccessNameType) * amount); 
     365        ARZeroMemory(owners.nameList, sizeof(ARAccessNameType) * amount); 
    366366 
    367367        changedUsers.nameList = new ARAccessNameType[amount]; 
    368         ZeroMemory(changedUsers.nameList, sizeof(ARAccessNameType) * amount); 
     368        ARZeroMemory(changedUsers.nameList, sizeof(ARAccessNameType) * amount); 
    369369 
    370370        changeDiary.stringList = new char*[amount]; 
    371         ZeroMemory(changeDiary.stringList, sizeof(char*) * amount); 
     371        ARZeroMemory(changeDiary.stringList, sizeof(char*) * amount); 
    372372 
    373373#if AR_CURRENT_API_VERSION >= AR_API_VERSION_763 
    374374        objProps.propsList = new ARPropList[amount]; 
    375         ZeroMemory(objProps.propsList, sizeof(ARPropList) * amount); 
     375        ARZeroMemory(objProps.propsList, sizeof(ARPropList) * amount); 
    376376#endif 
    377377} 
  • branches/work_311/lists/ARVUIList.cpp

    r549 r610  
    226226{ 
    227227        ids.internalIdList = new ARInternalId[amount]; 
    228         ZeroMemory(ids.internalIdList, sizeof(ARInternalId) * amount); 
     228        ARZeroMemory(ids.internalIdList, sizeof(ARInternalId) * amount); 
    229229 
    230230        names.nameList = new ARNameType[amount]; 
    231         ZeroMemory(names.nameList, sizeof(ARNameType) * amount); 
     231        ARZeroMemory(names.nameList, sizeof(ARNameType) * amount); 
    232232 
    233233        locales.localeList = new ARLocaleType[amount]; 
    234         ZeroMemory(locales.localeList, sizeof(ARLocaleType) * amount); 
     234        ARZeroMemory(locales.localeList, sizeof(ARLocaleType) * amount); 
    235235 
    236236        types.intList = new unsigned int[amount]; 
    237         ZeroMemory(types.intList, sizeof(unsigned int) * amount); 
     237        ARZeroMemory(types.intList, sizeof(unsigned int) * amount); 
    238238 
    239239        dispProps.propsList = new ARPropList[amount]; 
    240         ZeroMemory(dispProps.propsList, sizeof(ARPropList) * amount); 
     240        ARZeroMemory(dispProps.propsList, sizeof(ARPropList) * amount); 
    241241         
    242242        helpTexts.stringList = new char*[amount]; 
    243         ZeroMemory(helpTexts.stringList, sizeof(char*) * amount); 
     243        ARZeroMemory(helpTexts.stringList, sizeof(char*) * amount); 
    244244 
    245245        changedTimes.timestampList = new ARTimestamp[amount]; 
    246         ZeroMemory(changedTimes.timestampList, sizeof(ARTimestamp) * amount); 
     246        ARZeroMemory(changedTimes.timestampList, sizeof(ARTimestamp) * amount); 
    247247         
    248248        owners.nameList = new ARAccessNameType[amount]; 
    249         ZeroMemory(owners.nameList, sizeof(ARAccessNameType) * amount); 
     249        ARZeroMemory(owners.nameList, sizeof(ARAccessNameType) * amount); 
    250250         
    251251        changedUsers.nameList = new ARAccessNameType[amount]; 
    252         ZeroMemory(changedUsers.nameList, sizeof(ARAccessNameType) * amount); 
     252        ARZeroMemory(changedUsers.nameList, sizeof(ARAccessNameType) * amount); 
    253253         
    254254        changeDiary.stringList = new char*[amount]; 
    255         ZeroMemory(changeDiary.stringList, sizeof(char*) * amount); 
     255        ARZeroMemory(changeDiary.stringList, sizeof(char*) * amount); 
    256256 
    257257#if AR_CURRENT_API_VERSION >= AR_API_VERSION_763 
    258258        objProps.propsList = new ARPropList[amount]; 
    259         ZeroMemory(objProps.propsList, sizeof(ARPropList) * amount); 
     259        ARZeroMemory(objProps.propsList, sizeof(ARPropList) * amount); 
    260260#endif 
    261261} 
  • branches/work_311/project.cmake/files.cmake

    r608 r610  
    308308 util/CommandLineValidator.cpp 
    309309 util/Context.cpp 
     310 util/Memory.cpp 
    310311 util/RefItem.cpp  
    311312 util/ResourceFileLocatorAndExtractor.cpp 
     
    318319 util/CommandLineValidator.h 
    319320 util/Context.h 
     321 util/Memory.h 
    320322 util/RefItem.h 
    321323 util/ResourceFileLocatorAndExtractor.h 
Note: See TracChangeset for help on using the changeset viewer.