这篇教程C++ DestroyString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DestroyString函数的典型用法代码示例。如果您正苦于以下问题:C++ DestroyString函数的具体用法?C++ DestroyString怎么用?C++ DestroyString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DestroyString函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: IdentifyImageCommandWandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info, int argc,char **argv,char **metadata,ExceptionInfo *exception){#define DestroyIdentify() /{ / DestroyImageStack(); / for (i=0; i < (ssize_t) argc; i++) / argv[i]=DestroyString(argv[i]); / argv=(char **) RelinquishMagickMemory(argv); /}#define ThrowIdentifyException(asperity,tag,option) /{ / (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", / option); / DestroyIdentify(); / return(MagickFalse); /}#define ThrowIdentifyInvalidArgumentException(option,argument) /{ / (void) ThrowMagickException(exception,GetMagickModule(),OptionError, / "InvalidArgument","`%s': %s",option,argument); / DestroyIdentify(); / return(MagickFalse); /} const char *format, *option; Image *image; ImageStack image_stack[MaxImageStackDepth+1]; MagickBooleanType fire, pend, respect_parenthesis; MagickStatusType status; register ssize_t i; size_t count; ssize_t j, k; /* 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) { option=argv[1]; 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); } } if (argc < 2) return(IdentifyUsage()); count=0; format=NULL; j=1; k=0; NewImageStack(); option=(char *) NULL; pend=MagickFalse; respect_parenthesis=MagickFalse; status=MagickTrue; /* Identify an image. */ ReadCommandlLine(argc,&argv); status=ExpandFilenames(&argc,&argv); if (status == MagickFalse) ThrowIdentifyException(ResourceLimitError,"MemoryAllocationFailed", GetExceptionMessage(errno)); image_info->ping=MagickTrue; for (i=1; i < (ssize_t) argc; i++) { option=argv[i]; if (LocaleCompare(option,"(") == 0)//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,
示例2: assert//.........这里部分代码省略......... if ((*p == '}') && (*(p+1) == ';')) break; p+=strlen(p); if ((size_t) (p-xpm_buffer+MaxTextExtent) < length) continue; length<<=1; xpm_buffer=(char *) ResizeQuantumMemory(xpm_buffer,length+MaxTextExtent, sizeof(*xpm_buffer)); if (xpm_buffer == (char *) NULL) break; p=xpm_buffer+strlen(xpm_buffer); } if (xpm_buffer == (char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); /* Remove comments. */ count=0; width=0; for (p=xpm_buffer; *p != '/0'; p++) { if (*p != '"') continue; count=(ssize_t) sscanf(p+1,"%lu %lu %lu %lu",&columns,&rows,&colors,&width); image->columns=columns; image->rows=rows; image->colors=colors; if (count == 4) break; } if ((count != 4) || (width > 10) || (image->columns == 0) || (image->rows == 0) || (image->colors == 0)) { xpm_buffer=DestroyString(xpm_buffer); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } /* Remove unquoted characters. */ active=MagickFalse; q=xpm_buffer; while (*p != '/0') { if (*p++ == '"') { if (active != MagickFalse) *q++='/n'; active=active != MagickFalse ? MagickFalse : MagickTrue; } if (active != MagickFalse) *q++=(*p); } *q='/0'; /* Initialize image structure. */ xpm_colors=NewSplayTree(CompareXPMColor,RelinquishMagickMemory, (void *(*)(void *)) NULL); if (AcquireImageColormap(image,image->colors) == MagickFalse) { xpm_buffer=DestroyString(xpm_buffer); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } /* Read image colormap. */
开发者ID:mhorowitzgelb,项目名称:AprilTags,代码行数:67,
示例3: ReadLABELImage/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% R e a d L A B E L I m a g e %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ReadLABELImage() reads a LABEL image file and returns it. It% allocates the memory necessary for the new Image structure and returns a% pointer to the new image.%% The format of the ReadLABELImage method is:%% Image *ReadLABELImage(const ImageInfo *image_info,% ExceptionInfo *exception)%% A description of each parameter follows:%% o image_info: the image info.%% o exception: return any errors or warnings in this structure.%*/static Image *ReadLABELImage(const ImageInfo *image_info, ExceptionInfo *exception){ char geometry[MaxTextExtent], *property; const char *label; DrawInfo *draw_info; Image *image; MagickBooleanType status; TypeMetric metrics; size_t height, width; /* Initialize Image structure. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info,exception); (void) ResetImagePage(image,"0x0+0+0"); property=InterpretImageProperties((ImageInfo *) image_info,image, image_info->filename,exception); (void) SetImageProperty(image,"label",property,exception); property=DestroyString(property); label=GetImageProperty(image,"label",exception); draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL); draw_info->text=ConstantString(label); status=GetMultilineTypeMetrics(image,draw_info,&metrics,exception); if ((image->columns == 0) && (image->rows == 0)) { image->columns=(size_t) (metrics.width+draw_info->stroke_width+0.5); image->rows=(size_t) floor(metrics.height+draw_info->stroke_width+0.5); } else if (((image->columns == 0) || (image->rows == 0)) || (fabs(image_info->pointsize) < MagickEpsilon)) { double high, low; /* Auto fit text into bounding box. */ for ( ; ; draw_info->pointsize*=2.0) { (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g", -metrics.bounds.x1,metrics.ascent); if (draw_info->gravity == UndefinedGravity) (void) CloneString(&draw_info->geometry,geometry); status=GetMultilineTypeMetrics(image,draw_info,&metrics,exception); width=(size_t) floor(metrics.width+draw_info->stroke_width+0.5); height=(size_t) floor(metrics.height+draw_info->stroke_width+0.5); if ((image->columns != 0) && (image->rows != 0)) {//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:ImageMagick,代码行数:101,
示例4: LoadMimeList/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %+ L o a d M i m e L i s t %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LoadMimeList() loads the magic configuration file which provides a mapping% between magic attributes and a magic name.%% The format of the LoadMimeList method is:%% MagickBooleanType LoadMimeList(const char *xml,const char *filename,% const size_t depth,ExceptionInfo *exception)%% A description of each parameter follows:%% o xml: The mime list in XML format.%% o filename: The mime list filename.%% o depth: depth of <include /> statements.%% o exception: return any errors or warnings in this structure.%*/static MagickBooleanType LoadMimeList(const char *xml,const char *filename, const size_t depth,ExceptionInfo *exception){ const char *attribute; MimeInfo *mime_info = (MimeInfo *) NULL; MagickBooleanType status; XMLTreeInfo *mime, *mime_map, *include; /* Load the mime map file. */ (void) LogMagickEvent(ConfigureEvent,GetMagickModule(), "Loading mime map /"%s/" ...",filename); if (xml == (const char *) NULL) return(MagickFalse); if (mime_list == (LinkedListInfo *) NULL) { mime_list=NewLinkedList(0); if (mime_list == (LinkedListInfo *) NULL) { ThrowFileException(exception,ResourceLimitError, "MemoryAllocationFailed",filename); return(MagickFalse); } } mime_map=NewXMLTree(xml,exception); if (mime_map == (XMLTreeInfo *) NULL) return(MagickFalse); status=MagickTrue; include=GetXMLTreeChild(mime_map,"include"); while (include != (XMLTreeInfo *) NULL) { /* Process include element. */ attribute=GetXMLTreeAttribute(include,"file"); if (attribute != (const char *) NULL) { if (depth > 200) (void) ThrowMagickException(exception,GetMagickModule(), ConfigureError,"IncludeElementNestedTooDeeply","'%s'",filename); else { char path[MaxTextExtent], *xml; GetPathComponent(filename,HeadPath,path); if (*path != '/0') (void) ConcatenateMagickString(path,DirectorySeparator, MaxTextExtent); if (*attribute == *DirectorySeparator) (void) CopyMagickString(path,attribute,MaxTextExtent); else (void) ConcatenateMagickString(path,attribute,MaxTextExtent); xml=FileToString(path,~0,exception); if (xml != (char *) NULL) { status=LoadMimeList(xml,path,depth+1,exception); xml=DestroyString(xml); }//.........这里部分代码省略.........
开发者ID:rickwangtw,项目名称:ImageMagick,代码行数:101,
示例5: ResourceComponentGenesisMagickExport MagickBooleanType ResourceComponentGenesis(void){ char *limit; ssize_t files, pages, pagesize; MagickSizeType memory; /* Set Magick resource limits. */ AcquireSemaphoreInfo(&resource_semaphore); pagesize=GetMagickPageSize(); pages=(-1);#if defined(MAGICKCORE_HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) pages=(ssize_t) sysconf(_SC_PHYS_PAGES);#endif memory=(MagickSizeType) pages*pagesize; if ((pagesize <= 0) || (pages <= 0)) memory=2048UL*1024UL*1024UL;#if defined(PixelCacheThreshold) memory=PixelCacheThreshold;#endif (void) SetMagickResourceLimit(AreaResource,2*memory/sizeof(PixelPacket)); (void) SetMagickResourceLimit(MemoryResource,memory); (void) SetMagickResourceLimit(MapResource,2*memory); limit=GetEnvironmentValue("MAGICK_AREA_LIMIT"); if (limit == (char *) NULL) limit=GetPolicyValue("area"); if (limit != (char *) NULL) { (void) SetMagickResourceLimit(AreaResource,StringToSizeType(limit,100.0)); limit=DestroyString(limit); } limit=GetEnvironmentValue("MAGICK_MEMORY_LIMIT"); if (limit == (char *) NULL) limit=GetPolicyValue("memory"); if (limit != (char *) NULL) { (void) SetMagickResourceLimit(MemoryResource, StringToSizeType(limit,100.0)); limit=DestroyString(limit); } limit=GetEnvironmentValue("MAGICK_MAP_LIMIT"); if (limit == (char *) NULL) limit=GetPolicyValue("map"); if (limit != (char *) NULL) { (void) SetMagickResourceLimit(MapResource,StringToSizeType(limit,100.0)); limit=DestroyString(limit); } limit=GetEnvironmentValue("MAGICK_DISK_LIMIT"); if (limit == (char *) NULL) limit=GetPolicyValue("disk"); if (limit != (char *) NULL) { (void) SetMagickResourceLimit(DiskResource,StringToSizeType(limit,100.0)); limit=DestroyString(limit); } files=(-1);#if defined(MAGICKCORE_HAVE_SYSCONF) && defined(_SC_OPEN_MAX) files=(ssize_t) sysconf(_SC_OPEN_MAX);#endif#if defined(MAGICKCORE_HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) if (files < 0) { struct rlimit resources; if (getrlimit(RLIMIT_NOFILE,&resources) != -1) files=(ssize_t) resources.rlim_cur; }#endif#if defined(MAGICKCORE_HAVE_GETDTABLESIZE) && defined(MAGICKCORE_POSIX_SUPPORT) if (files < 0) files=(ssize_t) getdtablesize();#endif if (files < 0) files=64; (void) SetMagickResourceLimit(FileResource,MagickMax((size_t) (3*files/4),64)); limit=GetEnvironmentValue("MAGICK_FILE_LIMIT"); if (limit == (char *) NULL) limit=GetPolicyValue("file"); if (limit != (char *) NULL) { (void) SetMagickResourceLimit(FileResource,StringToSizeType(limit,100.0)); limit=DestroyString(limit); } (void) SetMagickResourceLimit(ThreadResource,GetOpenMPMaximumThreads()); limit=GetEnvironmentValue("MAGICK_THREAD_LIMIT"); if (limit == (char *) NULL) limit=GetPolicyValue("thread"); if (limit != (char *) NULL) {//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,
示例6: InitTTY//.........这里部分代码省略.........Tempstr=FormatStr(Tempstr,"%d",tty);if (! TTYAttribs) TTYAttribs=ListCreate();Curr=ListFindNamedItem(TTYAttribs,Tempstr);if (! Curr){old_tty_data=(struct termios *) calloc(1,sizeof(struct termios));ListAddNamedItem(TTYAttribs,Tempstr,old_tty_data);}else old_tty_data=(struct termios *) Curr->Item;tcgetattr(tty,old_tty_data);//tcgetattr(tty,&tty_data);memset(&tty_data,0,sizeof(tty_data));//ignore break characters and parity errorstty_data.c_iflag=IGNBRK | IGNPAR;//Enable Special Charactersif (Flags & TTYFLAG_CANON) tty_data.c_iflag|= ICANON;//else tty_data.c_iflag &= ~ICANON;/*if (! (Flags & TTYFLAG_CRLF_KEEP)){ //translate carriage-return to newline if (Flags & TTYFLAG_CRLF) tty_data.c_iflag |= ICRNL; else tty_data.c_iflag &= ~ICRNL; //translate newline to carriage return if (Flags & TTYFLAG_LFCR) { tty_data.c_iflag |= INLCR; } else tty_data.c_iflag &= ~INLCR; //output flags tty_data.c_oflag=0; //postprocess and translate newline to cr-nl if (Flags & TTYFLAG_LFCR) tty_data.c_oflag |= ONLCR | OPOST;}*/tty_data.c_cflag=CREAD | CS8 | HUPCL | CLOCAL;if (Flags & TTYFLAG_SOFTWARE_FLOW) {tty_data.c_iflag |= IXON | IXOFF;}if (Flags & TTYFLAG_HARDWARE_FLOW) tty_data.c_cflag |=CRTSCTS;if (Flags & TTYFLAG_ECHO) tty_data.c_cflag |= ECHO;tty_data.c_lflag=0;if (Flags & TTYFLAG_ISIG) tty_data.c_lflag=ISIG;tty_data.c_cc[VMIN]=1;tty_data.c_cc[VTIME]=0;if (LineSpeed > 0){switch (LineSpeed){case 2400: val=B2400; break;case 4800: val=B4800; break;case 9600: val=B9600; break;case 19200: val=B19200; break;case 38400: val=B38400; break;case 57600: val=B57600; break;case 115200: val=B115200; break;case 230400: val=B230400; break;#ifdef B460800case 460800: val=B460800; break;#endif#ifdef B500000case 500000: val=B500000; break;#endif#ifdef B1000000case 10000000: val=B1000000; break;#endif#ifdef B1152000case 1152000: val=B1152000; break;#endif#ifdef B2000000case 2000000: val=B2000000; break;#endif#ifdef B4000000case 4000000: val=B4000000; break;#endifdefault: val=B115200; break;}cfsetispeed(&tty_data,val);cfsetospeed(&tty_data,val);}tcflush(tty,TCIFLUSH);result=tcsetattr(tty,TCSANOW,&tty_data);DestroyString(Tempstr);}
开发者ID:JackieXie168,项目名称:movgrab,代码行数:101,
示例7: WriteFITSImage//.........这里部分代码省略......... GrayQuantum,pixels,exception); if (image->depth == 16) SetFITSUnsignedPixels(image->columns,image->depth,image->endian, pixels); if (((image->depth == 32) || (image->depth == 64)) && (quantum_info->format != FloatingPointQuantumFormat)) SetFITSUnsignedPixels(image->columns,image->depth,image->endian, pixels); count=WriteBlob(image,length,pixels); if (count != (ssize_t) length) break; status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } else { length=GetQuantumExtent(image,quantum_info,RedQuantum); for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, RedQuantum,pixels,exception); if (image->depth == 16) SetFITSUnsignedPixels(image->columns,image->depth,image->endian, pixels); if (((image->depth == 32) || (image->depth == 64)) && (quantum_info->format != FloatingPointQuantumFormat)) SetFITSUnsignedPixels(image->columns,image->depth,image->endian, pixels); count=WriteBlob(image,length,pixels); if (count != (ssize_t) length) break; status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } length=GetQuantumExtent(image,quantum_info,GreenQuantum); for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, GreenQuantum,pixels,exception); if (image->depth == 16) SetFITSUnsignedPixels(image->columns,image->depth,image->endian, pixels); if (((image->depth == 32) || (image->depth == 64)) && (quantum_info->format != FloatingPointQuantumFormat)) SetFITSUnsignedPixels(image->columns,image->depth,image->endian, pixels); count=WriteBlob(image,length,pixels); if (count != (ssize_t) length) break; status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } length=GetQuantumExtent(image,quantum_info,BlueQuantum); for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, BlueQuantum,pixels,exception); if (image->depth == 16) SetFITSUnsignedPixels(image->columns,image->depth,image->endian, pixels); if (((image->depth == 32) || (image->depth == 64)) && (quantum_info->format != FloatingPointQuantumFormat)) SetFITSUnsignedPixels(image->columns,image->depth,image->endian, pixels); count=WriteBlob(image,length,pixels); if (count != (ssize_t) length) break; status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } quantum_info=DestroyQuantumInfo(quantum_info); length=(size_t) (FITSBlocksize-TellBlob(image) % FITSBlocksize); if (length != 0) { (void) ResetMagickMemory(fits_info,0,length*sizeof(*fits_info)); (void) WriteBlob(image,length,(unsigned char *) fits_info); } fits_info=DestroyString(fits_info); (void) CloseBlob(image); return(MagickTrue);}
开发者ID:riingo,项目名称:ImageMagick,代码行数:101,
示例8: ConjureImageCommandWandExport 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)) {//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,
示例9: LoadTypeList//.........这里部分代码省略......... type_info->format=ConstantString(token); break; } if (LocaleCompare((char *) keyword,"foundry") == 0) { type_info->foundry=ConstantString(token); break; } if (LocaleCompare((char *) keyword,"fullname") == 0) { type_info->description=ConstantString(token); break; } break; } case 'G': case 'g': { if (LocaleCompare((char *) keyword,"glyphs") == 0) { char *path; path=ConstantString(token);#if defined(MAGICKCORE_WINDOWS_SUPPORT) if (strchr(path,'@') != (char *) NULL) SubstituteString(&path,"@[email C++ DestroyTree函数代码示例 C++ DestroyServiceFunction函数代码示例
|