-
Notifications
You must be signed in to change notification settings - Fork 33
Updates for macos sequoia to run retroshare-service #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,15 +234,17 @@ list( | |
| pgp/pgpauxutils.cc | ||
| pgp/pgphandler.cc | ||
| pgp/pgpkeyutil.cc | ||
| pgp/rscertificate.cc ) | ||
| pgp/rscertificate.cc | ||
| pgp/rnppgphandler.cc ) | ||
|
|
||
| list( | ||
| APPEND RS_IMPLEMENTATION_HEADERS | ||
| pgp/openpgpsdkhandler.h | ||
| pgp/pgpauxutils.h | ||
| pgp/pgphandler.h | ||
| pgp/pgpkeyutil.h | ||
| pgp/rscertificate.h ) | ||
| pgp/rscertificate.h | ||
| pgp/rnppgphandler.h ) | ||
|
|
||
| #./plugins/dlfcn_win32.cc | ||
| #./plugins/dlfcn_win32.h | ||
|
|
@@ -329,6 +331,7 @@ list( | |
| pqi/pqisslpersongrp.h | ||
| pqi/pqisslproxy.h | ||
| pqi/pqissludp.h | ||
| pqi/pqissl.h | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit surprising, I would expect including |
||
| pqi/pqistore.h | ||
| pqi/pqistreamer.h | ||
| pqi/pqithreadstreamer.h | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1656,7 +1656,7 @@ void RsGxsNetService::locked_checkDelay(uint32_t& time_in_secs) | |
| #include <algorithm> | ||
|
|
||
| template <typename UpdateMap,class ItemClass> | ||
| struct get_second : public std::unary_function<typename UpdateMap::value_type, RsItem*> | ||
| struct get_second | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to fix compatibility with newer compilers, am I wrong? |
||
| { | ||
| get_second(uint16_t serv_type,typename UpdateMap::key_type ItemClass::*member): mServType(serv_type),ID_member(member) {} | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,13 +105,13 @@ def processFile(file): | |
| defFileName = refid.rsplit('_',1)[0] + '.xml' | ||
|
|
||
| print( 'Looking for', typeName, methodName, 'into', defFileName, | ||
| "calculated from refid:", refid ) | ||
| "calculated from refid:", refid ) | ||
|
|
||
| try: | ||
| defDoc = ET.parse(doxPrefix + defFileName).getroot() | ||
| except FileNotFoundError: | ||
| print( 'Can\'t open:', doxPrefix + defFileName, | ||
| "not found between:" ) | ||
| "not found between:" ) | ||
| for mFileName in os.listdir(doxPrefix): | ||
| print(mFileName) | ||
| raise | ||
|
|
@@ -157,40 +157,92 @@ def processFile(file): | |
| callbackParams = '' | ||
|
|
||
| for tmpPE in memberdef.findall('param'): | ||
| mp = MethodParam() | ||
|
|
||
| pName = getText(tmpPE.find('declname')) | ||
| tmpDefval = tmpPE.find('defval') | ||
| mp._defval = getText(tmpDefval) if tmpDefval != None else '' | ||
| pType = getText(tmpPE.find('type')) | ||
|
|
||
| if pType.startswith('const '): pType = pType[6:] | ||
| if pType.startswith('std::function'): | ||
| if pType.endswith('&'): pType = pType[:-1] | ||
| is_likely_output_param = ('&' in pType and 'const' not in pType) | ||
|
|
||
| # --- Robust Parameter Name Extraction (v3) --- | ||
| pName = '' | ||
| # 1. Try finding <parametername> inside <param> | ||
| paramNameNode = tmpPE.find('parametername') | ||
| if paramNameNode is not None and paramNameNode.text: | ||
| pName = paramNameNode.text | ||
|
|
||
| # 2. Fallbacks (prioritize defname for likely output params) | ||
| if not pName: | ||
| declNameNode = tmpPE.find('declname') | ||
| defNameNode = tmpPE.find('defname') | ||
|
|
||
| # Standard order: declname then defname | ||
| if not is_likely_output_param: | ||
| if declNameNode is not None and declNameNode.text: | ||
| pName = declNameNode.text | ||
| elif defNameNode is not None and defNameNode.text: | ||
| pName = defNameNode.text | ||
| # Reversed order for likely output params: defname then declname | ||
| else: | ||
| if defNameNode is not None and defNameNode.text: | ||
| pName = defNameNode.text | ||
| elif declNameNode is not None and declNameNode.text: | ||
| pName = declNameNode.text | ||
| # --- End of Name Extraction --- | ||
|
|
||
| # Skip parameter if no name could be determined | ||
| if not pName: | ||
| print(f"Warning: Could not determine parameter name for param type [{pType}] in {refid}. Skipping.") | ||
| continue | ||
|
|
||
| # Create and populate the MethodParam object | ||
| mp = MethodParam() | ||
| mp._name = pName # Assign the determined name FIRST | ||
| mp._type = pType # Assign the initial type | ||
|
|
||
| tmpDefvalNode = tmpPE.find('defval') | ||
| mp._defval = getText(tmpDefvalNode) if tmpDefvalNode is not None else '' | ||
| mp._defval = ' '.join(mp._defval.split()) # Clean default value whitespace | ||
|
|
||
| # --- Type Cleaning and Callback Detection --- | ||
| cleaned_pType = pType | ||
| if cleaned_pType.startswith('const '): | ||
| cleaned_pType = cleaned_pType[6:] | ||
|
|
||
| if cleaned_pType.startswith('std::function'): | ||
| if cleaned_pType.endswith('&'): | ||
| cleaned_pType = cleaned_pType[:-1] | ||
|
|
||
| if pName.startswith('multiCallback'): | ||
| mp._isMultiCallback = True | ||
| hasMultiCallback = True | ||
| callbackName = pName | ||
| callbackParams = cleaned_pType | ||
| elif pName.startswith('callback'): | ||
| mp._isSingleCallback = True | ||
| hasSingleCallback = True | ||
| callbackName = pName | ||
| callbackParams = pType | ||
| else: | ||
| pType = pType.replace('&', '').replace(' ', '') | ||
|
|
||
| # Apparently some xml declarations include new lines ('\n') and/or multiple spaces | ||
| # Strip them using python magic | ||
| pType = ' '.join(pType.split()) | ||
| mp._defval = ' '.join(mp._defval.split()) | ||
|
|
||
| mp._type = pType | ||
| mp._name = pName | ||
|
|
||
| callbackName = pName | ||
| callbackParams = cleaned_pType | ||
|
|
||
| mp._type = cleaned_pType # Assign cleaned signature for callbacks | ||
|
|
||
| else: # Not a callback, just clean the regular type | ||
| # Don't remove '&' for regular types during cleaning here, | ||
| # it might be needed later for serialization/declaration. | ||
| # Just clean whitespace. | ||
| # cleaned_pType = cleaned_pType.replace('&', '').replace(' ', '') | ||
| cleaned_pType = ' '.join(cleaned_pType.split()) | ||
| mp._type = cleaned_pType # Assign cleaned type | ||
| # --- End of Type Cleaning --- | ||
|
|
||
| # Add the parameter to the map and ordered list | ||
| paramsMap[pName] = mp | ||
| orderedParamNames.append(pName) | ||
|
|
||
| for tmpPN in memberdef.findall('.//parametername'): | ||
| tmpParam = paramsMap[tmpPN.text] | ||
| # Add Try/Except block to handle cases where parameter name from docs doesn't match params from signature | ||
| try: | ||
| tmpParam = paramsMap[tmpPN.text] | ||
| except KeyError: | ||
| print(f"Warning: Parameter '{tmpPN.text}' found in Doxygen description for {refid}, but not in function signature parameters {list(paramsMap.keys())}. Skipping direction assignment.") | ||
| continue # Skip to the next parametername tag | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIR we should fail in this case, in addition to print the error, so compilation fail and developers notice ASAP they screw-up something, am I wrong? |
||
| tmpD = tmpPN.attrib['direction'] if 'direction' in tmpPN.attrib else '' | ||
|
|
||
| if 'in' in tmpD: | ||
|
|
@@ -237,8 +289,27 @@ def processFile(file): | |
| paramsDeclaration = '' | ||
| for pn in orderedParamNames: | ||
| mp = paramsMap[pn] | ||
| paramsDeclaration += '\t\t' + mp._type + ' ' + mp._name | ||
| if mp._defval != '': | ||
| # Determine the type for declaration (remove reference qualifier) | ||
| declaration_type = mp._type | ||
| is_reference = False | ||
| if '&' in declaration_type: | ||
| is_reference = True | ||
| # Be careful not to remove '&' from pointer types like 'Type *&' if that occurs | ||
| # Assuming simple references 'Type&' or 'const Type&' for now | ||
| parts = declaration_type.split('&') | ||
| if len(parts) == 2 and parts[1].strip() == '': # Check it's likely a simple reference | ||
| declaration_type = parts[0].strip() | ||
| else: | ||
| # Handle more complex cases or leave as is if unsure | ||
| # For now, just log a warning if we encounter an unexpected reference type | ||
| print(f"Warning: Encountered potentially complex reference type '{mp._type}' for parameter '{mp._name}'. Declaration might be incorrect.") | ||
| declaration_type = declaration_type.replace('&', '').strip() # Fallback: simple removal | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIR if something unexpected/unhanded is encountered compilation must fail, so developers notice ASAP they screw-up something. |
||
|
|
||
| paramsDeclaration += '\t\t' + declaration_type + ' ' + mp._name | ||
| # Handle default values - skip default assignment for references | ||
| # as it's problematic and likely the source of some errors. | ||
| # The function call will provide the value for output parameters. | ||
| if mp._defval != '' and not is_reference: | ||
| paramsDeclaration += ' = ' + mp._defval | ||
| paramsDeclaration += ';\n' | ||
| if mp._in: | ||
|
|
@@ -281,35 +352,71 @@ def processFile(file): | |
| captureVars = 'this' | ||
|
|
||
| callbackParamsSerialization = '' | ||
| callbackParameterListString = '' # Store just the parameter list e.g. "const Type& name" | ||
|
|
||
| if hasSingleCallback or hasMultiCallback or (callbackParams.find('(') + 2 < callbackParams.find(')')): | ||
| if hasSingleCallback or hasMultiCallback: | ||
| # Ensure callbackParams has the function signature before splitting | ||
| if not callbackParams: | ||
| print(f"ERROR: Callback parameter detected for {refid} but callbackParams string is empty!") | ||
| sys.exit(-1) | ||
|
|
||
| cbs = '' | ||
|
|
||
| # Check if parentheses exist before splitting | ||
| if '(' not in callbackParams or ')' not in callbackParams: | ||
| print(f"ERROR: Could not parse callback parameters from signature '{callbackParams}' for {refid}") | ||
| sys.exit(-1) | ||
|
|
||
| callbackParams = callbackParams.split('(')[1] | ||
| callbackParams = callbackParams.split(')')[0] | ||
| try: | ||
| tmp_params = callbackParams.split('(', 1)[1] # Split only once | ||
| tmp_params = tmp_params.rsplit(')', 1)[0] # Split from right only once | ||
| callbackParameterListString = tmp_params # Store the extracted parameter list | ||
| except IndexError: | ||
| print(f"ERROR: IndexError while parsing callback parameters from signature '{callbackParams}' for {refid}") | ||
| sys.exit(-1) | ||
|
|
||
| cbs += '\t\t\tRsGenericSerializer::SerializeContext ctx;\n' | ||
|
|
||
| for cbPar in callbackParams.split(','): | ||
| isConst = cbPar.startswith('const ') | ||
| pSep = ' ' | ||
| isRef = '&' in cbPar | ||
| if isRef: pSep = '&' | ||
| sepIndex = cbPar.rfind(pSep) + 1 | ||
| cpt = cbPar[0:sepIndex][6:] | ||
| cpn = cbPar[sepIndex:] | ||
|
|
||
| cbs += '\t\t\tRsTypeSerializer::serial_process(' | ||
| cbs += 'RsGenericSerializer::TO_JSON, ctx, ' | ||
| if isConst: | ||
| cbs += 'const_cast<' | ||
| cbs += cpt | ||
| cbs += '>(' | ||
| cbs += cpn | ||
| if isConst: cbs += ')' | ||
| cbs += ', "' | ||
| cbs += cpn | ||
| cbs += '" );\n' | ||
| # Handle case with no parameters inside parentheses | ||
| if tmp_params.strip(): | ||
| for cbPar in tmp_params.split(','): | ||
| cbPar = cbPar.strip() # Clean whitespace | ||
| if not cbPar: continue # Skip if empty after split/strip | ||
| isConst = cbPar.startswith('const ') | ||
| pSep = ' ' | ||
| isRef = '&' in cbPar | ||
| if isRef: pSep = '&' | ||
| # Find the last occurrence of the separator to correctly split type and name | ||
| sepIndex = cbPar.rfind(pSep) | ||
| if sepIndex == -1: # Handle cases like single type without separator (e.g., 'void') | ||
| print(f"Warning: Could not properly parse callback parameter '{cbPar}' in {refid}. Assuming void/no name.") | ||
| continue | ||
|
|
||
| sepIndex += 1 # Move index past the separator | ||
| cpt = cbPar[0:sepIndex].strip() # Type part | ||
| cpn = cbPar[sepIndex:].strip() # Name part | ||
|
|
||
| # Ensure name part is a valid identifier (basic check) | ||
| if not cpn or not (cpn.isidentifier() or cpn.startswith('_')): | ||
| print(f"Warning: Parsed callback parameter name '{cpn}' from '{cbPar}' in {refid} seems invalid. Skipping serialization.") | ||
| continue | ||
|
|
||
| # Adjust type part if it started with const | ||
| if isConst: cpt = cpt[6:].strip() | ||
|
|
||
| cbs += '\t\t\tRsTypeSerializer::serial_process(' | ||
| cbs += 'RsGenericSerializer::TO_JSON, ctx, ' | ||
| if isConst: | ||
| cbs += 'const_cast<' | ||
| cbs += cpt | ||
| cbs += '>(' | ||
| cbs += cpn | ||
| if isConst: cbs += ')' | ||
| else: | ||
| cbs += cpn | ||
| cbs += ', \"' | ||
| cbs += cpn | ||
| cbs += '\" );\n' | ||
|
|
||
| callbackParamsSerialization += cbs | ||
|
|
||
|
|
@@ -324,7 +431,7 @@ def processFile(file): | |
| substitutionsMap['sessionDelayedClose'] = sessionDelayedClose | ||
| substitutionsMap['captureVars'] = captureVars | ||
| substitutionsMap['callbackName'] = callbackName | ||
| substitutionsMap['callbackParams'] = callbackParams | ||
| substitutionsMap['callbackParams'] = callbackParameterListString | ||
| substitutionsMap['callbackParamsSerialization'] = callbackParamsSerialization | ||
| substitutionsMap['requiresAuth'] = 'true' if requiresAuth else 'false' | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,10 +24,12 @@ | |
| #include <string> | ||
| #include <list> | ||
| #include <stdint.h> | ||
| #include <cctype> | ||
|
|
||
| #include "util/rsprint.h" | ||
| #include "retroshare/rstypes.h" | ||
| #include "util/rstime.h" | ||
| #include "util/rsstring.h" | ||
|
|
||
| /****************************************************************************************** | ||
| Enumerations defining the Operators usable in the Boolean search expressions | ||
|
|
@@ -255,8 +257,7 @@ Binary Predicate for Case Insensitive search | |
| /*TODOS: | ||
| *Factor locales in the comparison | ||
| */ | ||
| struct CompareCharIC : | ||
| public std::binary_function< char , char , bool> { | ||
| struct CompareCharIC { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing deprecated stuff looks OK here too. |
||
|
|
||
| bool operator () ( char ch1 , char ch2 ) const { | ||
| return tolower( static_cast < unsigned char > (ch1) ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,18 +63,18 @@ rs_rnplib { | |
| # Windows msys2 | ||
| LIBRNP_LIBS *= -lbotan-3 | ||
| } else { | ||
| LIBRNP_LIBS *= -lbotan-2 | ||
| # This is the case for macOS and other Unix-like systems | ||
| LIBRNP_LIBS *= -lbotan-3 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this works on older non-EOL macOS ? AFAIR we have some qmake functions to check for specific macOS versions if botan-2 is still needed for some of them |
||
| } | ||
|
|
||
| win32-g++|win32-clang-g++ { | ||
| # Use librnp as shared library for Windows | ||
| CONFIG += librnp_shared | ||
| } | ||
|
|
||
| !libretroshare_shared { | ||
| # libretroshare is used as a static library. Link the external libraries to the executable. | ||
| LIBS *= $${LIBRNP_LIBS} | ||
| } | ||
| # Link LIBRNP_LIBS regardless of whether libretroshare is shared or static. | ||
| # This ensures the final executable can find the RNP symbols. | ||
| LIBS *= $${LIBRNP_LIBS} | ||
|
|
||
| #PRE_TARGETDEPS += $$clean_path($${LIBRNP_BUILD_PATH}/src/lib/librnp.a) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes seems good, and I think they are needed for the work @csoler merged a bit of time ago, do you confirm @csoler ?