void VHTTPServerProjectSettings::SetLogFormat (const XBOX::VString& inLogFormatName, const XBOX::VectorOfVString& inLogTokensNames) { VectorOfLogToken logTokens; for (VectorOfVString::const_iterator iter = inLogTokensNames.begin() ; iter != inLogTokensNames.end() ; ++iter) { EHTTPServerLogToken token = HTTPServerTools::GetLogTokenFromName( *iter); if (token != LOG_TOKEN_NONE) AppendUniqueValueToVector( logTokens, token); } SetLogFormat( HTTPServerTools::GetLogFormatFromName (inLogFormatName), &logTokens); }
void VHTTPServerProjectSettings::ResetToFactorySettings() { SetListeningAddress (DEFAULT_LISTENING_ADDRESS); SetListeningPort (DEFAULT_LISTENING_PORT); SetAllowSSL (DEFAULT_ALLOW_SSL); SetSSLMandatory (DEFAULT_SSL_MANDATORY); SetListeningSSLPort (DEFAULT_LISTENING_SSL_PORT); SetSSLCertificatesFolderPath (DEFAULT_SSL_CERTIFICATE_FOLDER_PATH); SetWebFolderPath (DEFAULT_WEB_FOLDER_PATH); SetIndexPageName (DEFAULT_INDEX_PAGE_NAME); SetDefaultCharSet (DEFAULT_WEB_CHARSET); SetLogFormat (DEFAULT_LOG_FORMAT); SetLogFolderPath (VFilePath(DEFAULT_LOG_FILE_FOLDER_PATH)); SetLogFileName (DEFAULT_LOG_FILE_NAME); fLogBackupFolderName.Clear(); fLogBackupSettings.ResetToFactorySettings(); fHostName.Clear(); #if HTTP_SERVER_USE_PROJECT_PATTERNS fProjectPattern.Clear(); #endif fRealm.Clear(); fAuthType = AUTH_NONE; fResourcesVector.clear(); fVirtualFoldersVector.clear(); fLogTokensVector.clear(); fProjectFolderPath.Clear(); SetUseWALibVirtualFolder (true); SetEnableCache (DEFAULT_ENABLE_CACHE); SetCacheMaxSize (DEFAULT_CACHE_MAX_SIZE); SetCachedObjectMaxSize (DEFAULT_CACHED_OBJECT_MAX_SIZE); SetEnableCompression (DEFAULT_COMPRESSION_ENABLED); SetCompressionMinThreshold (DEFAULT_COMPRESSION_MIN_THRESHOLD); SetCompressionMaxThreshold (DEFAULT_COMPRESSION_MAX_THRESHOLD); SetEnableKeepAlive (DEFAULT_KEEP_ALIVE_ENABLED); SetKeepAliveTimeout (DEFAULT_KEEP_ALIVE_TIMEOUT); SetKeepAliveMaxConnections (DEFAULT_KEEP_ALIVE_MAX_CONNECTIONS); SetMaxIncomingDataSize (XBOX::MaxLongInt); Tell_SettingsChanged(); }
WandExport MagickBooleanType ConjureImageCommand(ImageInfo *image_info, int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception) { #define DestroyConjure() \ { \ image=DestroyImageList(image); \ for (i=0; i < (ssize_t) argc; i++) \ argv[i]=DestroyString(argv[i]); \ argv=(char **) RelinquishMagickMemory(argv); \ } #define ThrowConjureException(asperity,tag,option) \ { \ (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"'%s'", \ option); \ DestroyConjure(); \ return(MagickFalse); \ } #define ThrowConjureInvalidArgumentException(option,argument) \ { \ (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \ "InvalidArgument","'%s': %s",option,argument); \ DestroyConjure(); \ return(MagickFalse); \ } char filename[MaxTextExtent], *option; Image *image; MagickStatusType status; register ssize_t i; ssize_t number_images; /* Set defaults. */ assert(image_info != (ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); assert(exception != (ExceptionInfo *) NULL); if (argc < 2) return(ConjureUsage()); image=NewImageList(); number_images=0; option=(char *) NULL; /* Conjure an image. */ ReadCommandlLine(argc,&argv); status=ExpandFilenames(&argc,&argv); if (status == MagickFalse) ThrowConjureException(ResourceLimitError,"MemoryAllocationFailed", GetExceptionMessage(errno)); for (i=1; i < (ssize_t) argc; i++) { option=argv[i]; if (IsCommandOption(option) != MagickFalse) { if (LocaleCompare("concurrent",option+1) == 0) break; if (LocaleCompare("debug",option+1) == 0) { ssize_t event; if (*option == '+') break; i++; if (i == (ssize_t) argc) ThrowConjureException(OptionError,"MissingArgument",option); event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]); if (event < 0) ThrowConjureException(OptionError,"UnrecognizedEventType", argv[i]); (void) SetLogEventMask(argv[i]); continue; } if (LocaleCompare("duration",option+1) == 0) { if (*option == '+') break; i++; if (i == (ssize_t) (argc-1)) ThrowConjureException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowConjureInvalidArgumentException(option,argv[i]); continue; } if ((LocaleCompare("help",option+1) == 0) || (LocaleCompare("-help",option+1) == 0)) { if (*option == '-') return(ConjureUsage()); continue; } if (LocaleCompare("log",option+1) == 0) { if (*option == '-') { i++; if (i == (ssize_t) argc) ThrowConjureException(OptionError,"MissingLogFormat",option); (void) SetLogFormat(argv[i]); } continue; } if (LocaleCompare("monitor",option+1) == 0) continue; if (LocaleCompare("quiet",option+1) == 0) continue; if (LocaleCompare("regard-warnings",option+1) == 0) break; if (LocaleCompare("seed",option+1) == 0) { if (*option == '+') break; i++; if (i == (ssize_t) (argc-1)) ThrowConjureException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowConjureInvalidArgumentException(option,argv[i]); break; } if (LocaleCompare("verbose",option+1) == 0) { image_info->verbose=(*option == '-') ? MagickTrue : MagickFalse; continue; } if ((LocaleCompare("version",option+1) == 0) || (LocaleCompare("-version",option+1) == 0)) { (void) FormatLocaleFile(stdout,"Version: %s\n", GetMagickVersion((size_t *) NULL)); (void) FormatLocaleFile(stdout,"Copyright: %s\n", GetMagickCopyright()); (void) FormatLocaleFile(stdout,"Features: %s\n\n", GetMagickFeatures()); return(MagickFalse); } /* Persist key/value pair. */ (void) DeleteImageOption(image_info,option+1); status=SetImageOption(image_info,option+1,argv[i+1]); if (status == MagickFalse) ThrowConjureException(ImageError,"UnableToPersistKey",option); i++; continue; } /* Interpret MSL script. */ (void) DeleteImageOption(image_info,"filename"); status=SetImageOption(image_info,"filename",argv[i]); if (status == MagickFalse) ThrowConjureException(ImageError,"UnableToPersistKey",argv[i]); (void) FormatLocaleString(filename,MaxTextExtent,"msl:%s",argv[i]); image=ReadImages(image_info,filename,exception); CatchException(exception); if (image != (Image *) NULL) image=DestroyImageList(image); status=image != (Image *) NULL ? MagickTrue : MagickFalse; number_images++; } if (i != (ssize_t) argc) ThrowConjureException(OptionError,"MissingAnImageFilename",argv[i]); if (number_images == 0) ThrowConjureException(OptionError,"MissingAnImageFilename",argv[argc-1]); if (image != (Image *) NULL) image=DestroyImageList(image); for (i=0; i < (ssize_t) argc; i++) argv[i]=DestroyString(argv[i]); argv=(char **) RelinquishMagickMemory(argv); return(status != 0 ? MagickTrue : MagickFalse); }
void VHTTPServerProjectSettings::SetLogFormat (const XBOX::VString& inLogFormatName, VectorOfLogToken *inLogTokens) { SetLogFormat (HTTPServerTools::GetLogFormatFromName (inLogFormatName), inLogTokens); }
int main(int argc,char **argv) { #define DestroyValidate() \ { \ timer=DestroyTimerInfo(timer); \ image_info=DestroyImageInfo(image_info); \ exception=DestroyExceptionInfo(exception); \ } #define ThrowValidateException(asperity,tag,option) \ { \ (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \ option); \ CatchException(exception); \ DestroyValidate(); \ return(MagickFalse); \ } char output_filename[MaxTextExtent], reference_filename[MaxTextExtent], *option; double elapsed_time, user_time; ExceptionInfo *exception; Image *reference_image; ImageInfo *image_info; MagickBooleanType regard_warnings, status; register long i; TimerInfo *timer; unsigned long fail, iterations, tests; ValidateType type; /* Validate the ImageMagick image processing suite. */ MagickCoreGenesis(*argv,MagickFalse); iterations=1; status=MagickFalse; type=AllValidate; regard_warnings=MagickFalse; exception=AcquireExceptionInfo(); image_info=AcquireImageInfo(); (void) CopyMagickString(image_info->filename,ReferenceFilename,MaxTextExtent); timer=AcquireTimerInfo(); GetTimerInfo(timer); for (i=1; i < (long) argc; i++) { option=argv[i]; if (IsMagickOption(option) == MagickFalse) { (void) CopyMagickString(image_info->filename,option,MaxTextExtent); continue; } switch (*(option+1)) { case 'b': { if (LocaleCompare("bench",option+1) == 0) { iterations=(unsigned long) atol(argv[++i]); break; } ThrowValidateException(OptionError,"UnrecognizedOption",option) } case 'd': { if (LocaleCompare("debug",option+1) == 0) { (void) SetLogEventMask(argv[++i]); break; } ThrowValidateException(OptionError,"UnrecognizedOption",option) } case 'h': { if (LocaleCompare("help",option+1) == 0) { (void) ValidateUsage(); return(0); } ThrowValidateException(OptionError,"UnrecognizedOption",option) } case 'l': { if (LocaleCompare("log",option+1) == 0) { if (*option != '+') (void) SetLogFormat(argv[i+1]); break; } ThrowValidateException(OptionError,"UnrecognizedOption",option) } case 'r': { if (LocaleCompare("regard-warnings",option+1) == 0) { regard_warnings=MagickTrue; break; } ThrowValidateException(OptionError,"UnrecognizedOption",option) } case 'v': { if (LocaleCompare("validate",option+1) == 0) { long validate; if (*option == '+') break; i++; if (i == (long) argc) ThrowValidateException(OptionError,"MissingArgument",option); validate=ParseMagickOption(MagickValidateOptions,MagickFalse, argv[i]); if (validate < 0) ThrowValidateException(OptionError,"UnrecognizedValidateType", argv[i]); type=(ValidateType) validate; break; } if ((LocaleCompare("version",option+1) == 0) || (LocaleCompare("-version",option+1) == 0)) { (void) fprintf(stdout,"Version: %s\n", GetMagickVersion((unsigned long *) NULL)); (void) fprintf(stdout,"Copyright: %s\n\n",GetMagickCopyright()); return(0); } ThrowValidateException(OptionError,"UnrecognizedOption",option) } default: ThrowValidateException(OptionError,"UnrecognizedOption",option) } } reference_image=ReadImage(image_info,exception); tests=0; fail=0; if (reference_image == (Image *) NULL) fail++; else { if (LocaleCompare(image_info->filename,ReferenceFilename) == 0) (void) CopyMagickString(reference_image->magick,ReferenceImageFormat, MaxTextExtent); (void) AcquireUniqueFilename(reference_filename); (void) AcquireUniqueFilename(output_filename); (void) CopyMagickString(reference_image->filename,reference_filename, MaxTextExtent); status=WriteImage(image_info,reference_image); InheritException(exception,&reference_image->exception); reference_image=DestroyImage(reference_image); if (status == MagickFalse) fail++; else { (void) fprintf(stdout,"Version: %s\n", GetMagickVersion((unsigned long *) NULL)); (void) fprintf(stdout,"Copyright: %s\n\n", GetMagickCopyright()); (void) fprintf(stdout,"ImageMagick Validation Suite (%s)\n\n", MagickOptionToMnemonic(MagickValidateOptions,(long) type)); if ((type & CompareValidate) != 0) tests+=ValidateCompareCommand(image_info,reference_filename, output_filename,&fail,exception); if ((type & CompositeValidate) != 0) tests+=ValidateCompositeCommand(image_info,reference_filename, output_filename,&fail,exception); if ((type & ConvertValidate) != 0) tests+=ValidateConvertCommand(image_info,reference_filename, output_filename,&fail,exception); if ((type & FormatsInMemoryValidate) != 0) tests+=ValidateImageFormatsInMemory(image_info,reference_filename, output_filename,&fail,exception); if ((type & FormatsOnDiskValidate) != 0) tests+=ValidateImageFormatsOnDisk(image_info,reference_filename, output_filename,&fail,exception); if ((type & IdentifyValidate) != 0) tests+=ValidateIdentifyCommand(image_info,reference_filename, output_filename,&fail,exception); if ((type & ImportExportValidate) != 0) tests+=ValidateImportExportPixels(image_info,reference_filename, output_filename,&fail,exception); if ((type & MontageValidate) != 0) tests+=ValidateMontageCommand(image_info,reference_filename, output_filename,&fail,exception); if ((type & StreamValidate) != 0) tests+=ValidateStreamCommand(image_info,reference_filename, output_filename,&fail,exception); (void) fprintf(stdout,"validation suite: %lu tests; %lu passed; " "%lu failed.\n",tests,tests-fail,fail); } (void) RelinquishUniqueFileResource(output_filename); (void) RelinquishUniqueFileResource(reference_filename); } if (exception->severity != UndefinedException) CatchException(exception); if (iterations > 1) { elapsed_time=GetElapsedTime(timer); user_time=GetUserTime(timer); (void) fprintf(stderr,"Performance: %lui %gips %0.3fu %ld:%02ld\n", iterations,1.0*iterations/elapsed_time,user_time,(long) (elapsed_time/60.0+0.5),(long) ceil(fmod(elapsed_time,60.0))); } DestroyValidate(); MagickCoreTerminus(); return(fail == 0 ? 0 : 1); }
LoggingFormat::LoggingFormat() : _parsingSchema(), _dateformat(ISO_6801_TIME) { SetLogFormat(DEFAULT_LOGGING_FORMAT); }