X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b326e313a0ce8ba54f6f0baac517faa80a2b744b..29149a64916d6fdc53e445adca9ef83bc58fb6c3:/src/common/xpmdecod.cpp diff --git a/src/common/xpmdecod.cpp b/src/common/xpmdecod.cpp index f05334ba3f..a4b8c82886 100644 --- a/src/common/xpmdecod.cpp +++ b/src/common/xpmdecod.cpp @@ -105,7 +105,6 @@ license is as follows: # include "wx/defs.h" #endif -#if wxUSE_IMAGE && wxUSE_XPM #include "wx/stream.h" #include "wx/image.h" @@ -136,7 +135,7 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream) char *p, *q; size_t i; - if ( stream.Read(xpm_buffer, length).LastError() != wxSTREAM_NO_ERROR ) + if ( stream.Read(xpm_buffer, length).LastError() == wxSTREAM_READ_ERROR ) return FALSE; /* @@ -222,7 +221,11 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream) wxImage img = ReadData(xpm_lines); delete[] xpm_buffer; +#ifdef __WIN16__ + delete[] (char**) xpm_lines; +#else delete[] xpm_lines; +#endif return img; } #endif // wxUSE_STREAMS @@ -253,240 +256,240 @@ typedef struct static rgbRecord theRGBRecords[] = { - {"aliceblue", myRGB(240, 248, 255)}, - {"antiquewhite", myRGB(250, 235, 215)}, - {"aquamarine", myRGB(50, 191, 193)}, - {"azure", myRGB(240, 255, 255)}, - {"beige", myRGB(245, 245, 220)}, - {"bisque", myRGB(255, 228, 196)}, - {"black", myRGB(0, 0, 0)}, - {"blanchedalmond", myRGB(255, 235, 205)}, - {"blue", myRGB(0, 0, 255)}, - {"blueviolet", myRGB(138, 43, 226)}, - {"brown", myRGB(165, 42, 42)}, + {"AliceBlue", myRGB(240, 248, 255)}, + {"AntiqueWhite", myRGB(250, 235, 215)}, + {"Aquamarine", myRGB(50, 191, 193)}, + {"Azure", myRGB(240, 255, 255)}, + {"Beige", myRGB(245, 245, 220)}, + {"Bisque", myRGB(255, 228, 196)}, + {"Black", myRGB(0, 0, 0)}, + {"BlanchedAlmond", myRGB(255, 235, 205)}, + {"Blue", myRGB(0, 0, 255)}, + {"BlueViolet", myRGB(138, 43, 226)}, + {"Brown", myRGB(165, 42, 42)}, {"burlywood", myRGB(222, 184, 135)}, - {"cadetblue", myRGB(95, 146, 158)}, + {"CadetBlue", myRGB(95, 146, 158)}, {"chartreuse", myRGB(127, 255, 0)}, {"chocolate", myRGB(210, 105, 30)}, - {"coral", myRGB(255, 114, 86)}, - {"cornflowerblue", myRGB(34, 34, 152)}, + {"Coral", myRGB(255, 114, 86)}, + {"CornflowerBlue", myRGB(34, 34, 152)}, {"cornsilk", myRGB(255, 248, 220)}, - {"cyan", myRGB(0, 255, 255)}, - {"darkgoldenrod", myRGB(184, 134, 11)}, - {"darkgreen", myRGB(0, 86, 45)}, - {"darkkhaki", myRGB(189, 183, 107)}, - {"darkolivegreen", myRGB(85, 86, 47)}, - {"darkorange", myRGB(255, 140, 0)}, - {"darkorchid", myRGB(139, 32, 139)}, - {"darksalmon", myRGB(233, 150, 122)}, - {"darkseagreen", myRGB(143, 188, 143)}, - {"darkslateblue", myRGB(56, 75, 102)}, - {"darkslategray", myRGB(47, 79, 79)}, - {"darkturquoise", myRGB(0, 166, 166)}, - {"darkviolet", myRGB(148, 0, 211)}, - {"deeppink", myRGB(255, 20, 147)}, - {"deepskyblue", myRGB(0, 191, 255)}, - {"dimgray", myRGB(84, 84, 84)}, - {"dodgerblue", myRGB(30, 144, 255)}, - {"firebrick", myRGB(142, 35, 35)}, - {"floralwhite", myRGB(255, 250, 240)}, - {"forestgreen", myRGB(80, 159, 105)}, + {"Cyan", myRGB(0, 255, 255)}, + {"DarkGoldenrod", myRGB(184, 134, 11)}, + {"DarkGreen", myRGB(0, 86, 45)}, + {"DarkKhaki", myRGB(189, 183, 107)}, + {"DarkOliveGreen", myRGB(85, 86, 47)}, + {"DarkOrange", myRGB(255, 140, 0)}, + {"DarkOrchid", myRGB(139, 32, 139)}, + {"DarkSalmon", myRGB(233, 150, 122)}, + {"DarkSeaGreen", myRGB(143, 188, 143)}, + {"DarkSlateBlue", myRGB(56, 75, 102)}, + {"DarkSlateGray", myRGB(47, 79, 79)}, + {"DarkTurquoise", myRGB(0, 166, 166)}, + {"DarkViolet", myRGB(148, 0, 211)}, + {"DeepPink", myRGB(255, 20, 147)}, + {"DeepSkyBlue", myRGB(0, 191, 255)}, + {"DimGray", myRGB(84, 84, 84)}, + {"DodgerBlue", myRGB(30, 144, 255)}, + {"Firebrick", myRGB(142, 35, 35)}, + {"FloralWhite", myRGB(255, 250, 240)}, + {"ForestGreen", myRGB(80, 159, 105)}, {"gainsboro", myRGB(220, 220, 220)}, - {"ghostwhite", myRGB(248, 248, 255)}, - {"gold", myRGB(218, 170, 0)}, - {"goldenrod", myRGB(239, 223, 132)}, - {"gray", myRGB(126, 126, 126)}, - {"gray0", myRGB(0, 0, 0)}, - {"gray1", myRGB(3, 3, 3)}, - {"gray10", myRGB(26, 26, 26)}, - {"gray100", myRGB(255, 255, 255)}, - {"gray11", myRGB(28, 28, 28)}, - {"gray12", myRGB(31, 31, 31)}, - {"gray13", myRGB(33, 33, 33)}, - {"gray14", myRGB(36, 36, 36)}, - {"gray15", myRGB(38, 38, 38)}, - {"gray16", myRGB(41, 41, 41)}, - {"gray17", myRGB(43, 43, 43)}, - {"gray18", myRGB(46, 46, 46)}, - {"gray19", myRGB(48, 48, 48)}, - {"gray2", myRGB(5, 5, 5)}, - {"gray20", myRGB(51, 51, 51)}, - {"gray21", myRGB(54, 54, 54)}, - {"gray22", myRGB(56, 56, 56)}, - {"gray23", myRGB(59, 59, 59)}, - {"gray24", myRGB(61, 61, 61)}, - {"gray25", myRGB(64, 64, 64)}, - {"gray26", myRGB(66, 66, 66)}, - {"gray27", myRGB(69, 69, 69)}, - {"gray28", myRGB(71, 71, 71)}, - {"gray29", myRGB(74, 74, 74)}, - {"gray3", myRGB(8, 8, 8)}, - {"gray30", myRGB(77, 77, 77)}, - {"gray31", myRGB(79, 79, 79)}, - {"gray32", myRGB(82, 82, 82)}, - {"gray33", myRGB(84, 84, 84)}, - {"gray34", myRGB(87, 87, 87)}, - {"gray35", myRGB(89, 89, 89)}, - {"gray36", myRGB(92, 92, 92)}, - {"gray37", myRGB(94, 94, 94)}, - {"gray38", myRGB(97, 97, 97)}, - {"gray39", myRGB(99, 99, 99)}, - {"gray4", myRGB(10, 10, 10)}, - {"gray40", myRGB(102, 102, 102)}, - {"gray41", myRGB(105, 105, 105)}, - {"gray42", myRGB(107, 107, 107)}, - {"gray43", myRGB(110, 110, 110)}, - {"gray44", myRGB(112, 112, 112)}, - {"gray45", myRGB(115, 115, 115)}, - {"gray46", myRGB(117, 117, 117)}, - {"gray47", myRGB(120, 120, 120)}, - {"gray48", myRGB(122, 122, 122)}, - {"gray49", myRGB(125, 125, 125)}, - {"gray5", myRGB(13, 13, 13)}, - {"gray50", myRGB(127, 127, 127)}, - {"gray51", myRGB(130, 130, 130)}, - {"gray52", myRGB(133, 133, 133)}, - {"gray53", myRGB(135, 135, 135)}, - {"gray54", myRGB(138, 138, 138)}, - {"gray55", myRGB(140, 140, 140)}, - {"gray56", myRGB(143, 143, 143)}, - {"gray57", myRGB(145, 145, 145)}, - {"gray58", myRGB(148, 148, 148)}, - {"gray59", myRGB(150, 150, 150)}, - {"gray6", myRGB(15, 15, 15)}, - {"gray60", myRGB(153, 153, 153)}, - {"gray61", myRGB(156, 156, 156)}, - {"gray62", myRGB(158, 158, 158)}, - {"gray63", myRGB(161, 161, 161)}, - {"gray64", myRGB(163, 163, 163)}, - {"gray65", myRGB(166, 166, 166)}, - {"gray66", myRGB(168, 168, 168)}, - {"gray67", myRGB(171, 171, 171)}, - {"gray68", myRGB(173, 173, 173)}, - {"gray69", myRGB(176, 176, 176)}, - {"gray7", myRGB(18, 18, 18)}, - {"gray70", myRGB(179, 179, 179)}, - {"gray71", myRGB(181, 181, 181)}, - {"gray72", myRGB(184, 184, 184)}, - {"gray73", myRGB(186, 186, 186)}, - {"gray74", myRGB(189, 189, 189)}, - {"gray75", myRGB(191, 191, 191)}, - {"gray76", myRGB(194, 194, 194)}, - {"gray77", myRGB(196, 196, 196)}, - {"gray78", myRGB(199, 199, 199)}, - {"gray79", myRGB(201, 201, 201)}, - {"gray8", myRGB(20, 20, 20)}, - {"gray80", myRGB(204, 204, 204)}, - {"gray81", myRGB(207, 207, 207)}, - {"gray82", myRGB(209, 209, 209)}, - {"gray83", myRGB(212, 212, 212)}, - {"gray84", myRGB(214, 214, 214)}, - {"gray85", myRGB(217, 217, 217)}, - {"gray86", myRGB(219, 219, 219)}, - {"gray87", myRGB(222, 222, 222)}, - {"gray88", myRGB(224, 224, 224)}, - {"gray89", myRGB(227, 227, 227)}, - {"gray9", myRGB(23, 23, 23)}, - {"gray90", myRGB(229, 229, 229)}, - {"gray91", myRGB(232, 232, 232)}, - {"gray92", myRGB(235, 235, 235)}, - {"gray93", myRGB(237, 237, 237)}, - {"gray94", myRGB(240, 240, 240)}, - {"gray95", myRGB(242, 242, 242)}, - {"gray96", myRGB(245, 245, 245)}, - {"gray97", myRGB(247, 247, 247)}, - {"gray98", myRGB(250, 250, 250)}, - {"gray99", myRGB(252, 252, 252)}, - {"green", myRGB(0, 255, 0)}, - {"greenyellow", myRGB(173, 255, 47)}, + {"GhostWhite", myRGB(248, 248, 255)}, + {"Gold", myRGB(218, 170, 0)}, + {"Goldenrod", myRGB(239, 223, 132)}, + {"Gray", myRGB(126, 126, 126)}, + {"Gray0", myRGB(0, 0, 0)}, + {"Gray1", myRGB(3, 3, 3)}, + {"Gray10", myRGB(26, 26, 26)}, + {"Gray100", myRGB(255, 255, 255)}, + {"Gray11", myRGB(28, 28, 28)}, + {"Gray12", myRGB(31, 31, 31)}, + {"Gray13", myRGB(33, 33, 33)}, + {"Gray14", myRGB(36, 36, 36)}, + {"Gray15", myRGB(38, 38, 38)}, + {"Gray16", myRGB(41, 41, 41)}, + {"Gray17", myRGB(43, 43, 43)}, + {"Gray18", myRGB(46, 46, 46)}, + {"Gray19", myRGB(48, 48, 48)}, + {"Gray2", myRGB(5, 5, 5)}, + {"Gray20", myRGB(51, 51, 51)}, + {"Gray21", myRGB(54, 54, 54)}, + {"Gray22", myRGB(56, 56, 56)}, + {"Gray23", myRGB(59, 59, 59)}, + {"Gray24", myRGB(61, 61, 61)}, + {"Gray25", myRGB(64, 64, 64)}, + {"Gray26", myRGB(66, 66, 66)}, + {"Gray27", myRGB(69, 69, 69)}, + {"Gray28", myRGB(71, 71, 71)}, + {"Gray29", myRGB(74, 74, 74)}, + {"Gray3", myRGB(8, 8, 8)}, + {"Gray30", myRGB(77, 77, 77)}, + {"Gray31", myRGB(79, 79, 79)}, + {"Gray32", myRGB(82, 82, 82)}, + {"Gray33", myRGB(84, 84, 84)}, + {"Gray34", myRGB(87, 87, 87)}, + {"Gray35", myRGB(89, 89, 89)}, + {"Gray36", myRGB(92, 92, 92)}, + {"Gray37", myRGB(94, 94, 94)}, + {"Gray38", myRGB(97, 97, 97)}, + {"Gray39", myRGB(99, 99, 99)}, + {"Gray4", myRGB(10, 10, 10)}, + {"Gray40", myRGB(102, 102, 102)}, + {"Gray41", myRGB(105, 105, 105)}, + {"Gray42", myRGB(107, 107, 107)}, + {"Gray43", myRGB(110, 110, 110)}, + {"Gray44", myRGB(112, 112, 112)}, + {"Gray45", myRGB(115, 115, 115)}, + {"Gray46", myRGB(117, 117, 117)}, + {"Gray47", myRGB(120, 120, 120)}, + {"Gray48", myRGB(122, 122, 122)}, + {"Gray49", myRGB(125, 125, 125)}, + {"Gray5", myRGB(13, 13, 13)}, + {"Gray50", myRGB(127, 127, 127)}, + {"Gray51", myRGB(130, 130, 130)}, + {"Gray52", myRGB(133, 133, 133)}, + {"Gray53", myRGB(135, 135, 135)}, + {"Gray54", myRGB(138, 138, 138)}, + {"Gray55", myRGB(140, 140, 140)}, + {"Gray56", myRGB(143, 143, 143)}, + {"Gray57", myRGB(145, 145, 145)}, + {"Gray58", myRGB(148, 148, 148)}, + {"Gray59", myRGB(150, 150, 150)}, + {"Gray6", myRGB(15, 15, 15)}, + {"Gray60", myRGB(153, 153, 153)}, + {"Gray61", myRGB(156, 156, 156)}, + {"Gray62", myRGB(158, 158, 158)}, + {"Gray63", myRGB(161, 161, 161)}, + {"Gray64", myRGB(163, 163, 163)}, + {"Gray65", myRGB(166, 166, 166)}, + {"Gray66", myRGB(168, 168, 168)}, + {"Gray67", myRGB(171, 171, 171)}, + {"Gray68", myRGB(173, 173, 173)}, + {"Gray69", myRGB(176, 176, 176)}, + {"Gray7", myRGB(18, 18, 18)}, + {"Gray70", myRGB(179, 179, 179)}, + {"Gray71", myRGB(181, 181, 181)}, + {"Gray72", myRGB(184, 184, 184)}, + {"Gray73", myRGB(186, 186, 186)}, + {"Gray74", myRGB(189, 189, 189)}, + {"Gray75", myRGB(191, 191, 191)}, + {"Gray76", myRGB(194, 194, 194)}, + {"Gray77", myRGB(196, 196, 196)}, + {"Gray78", myRGB(199, 199, 199)}, + {"Gray79", myRGB(201, 201, 201)}, + {"Gray8", myRGB(20, 20, 20)}, + {"Gray80", myRGB(204, 204, 204)}, + {"Gray81", myRGB(207, 207, 207)}, + {"Gray82", myRGB(209, 209, 209)}, + {"Gray83", myRGB(212, 212, 212)}, + {"Gray84", myRGB(214, 214, 214)}, + {"Gray85", myRGB(217, 217, 217)}, + {"Gray86", myRGB(219, 219, 219)}, + {"Gray87", myRGB(222, 222, 222)}, + {"Gray88", myRGB(224, 224, 224)}, + {"Gray89", myRGB(227, 227, 227)}, + {"Gray9", myRGB(23, 23, 23)}, + {"Gray90", myRGB(229, 229, 229)}, + {"Gray91", myRGB(232, 232, 232)}, + {"Gray92", myRGB(235, 235, 235)}, + {"Gray93", myRGB(237, 237, 237)}, + {"Gray94", myRGB(240, 240, 240)}, + {"Gray95", myRGB(242, 242, 242)}, + {"Gray96", myRGB(245, 245, 245)}, + {"Gray97", myRGB(247, 247, 247)}, + {"Gray98", myRGB(250, 250, 250)}, + {"Gray99", myRGB(252, 252, 252)}, + {"Green", myRGB(0, 255, 0)}, + {"GreenYellow", myRGB(173, 255, 47)}, {"honeydew", myRGB(240, 255, 240)}, - {"hotpink", myRGB(255, 105, 180)}, - {"indianred", myRGB(107, 57, 57)}, + {"HotPink", myRGB(255, 105, 180)}, + {"IndianRed", myRGB(107, 57, 57)}, {"ivory", myRGB(255, 255, 240)}, - {"khaki", myRGB(179, 179, 126)}, + {"Khaki", myRGB(179, 179, 126)}, {"lavender", myRGB(230, 230, 250)}, - {"lavenderblush", myRGB(255, 240, 245)}, - {"lawngreen", myRGB(124, 252, 0)}, - {"lemonchiffon", myRGB(255, 250, 205)}, - {"lightblue", myRGB(176, 226, 255)}, - {"lightcoral", myRGB(240, 128, 128)}, - {"lightcyan", myRGB(224, 255, 255)}, - {"lightgoldenrod", myRGB(238, 221, 130)}, - {"lightgoldenrodyellow", myRGB(250, 250, 210)}, - {"lightgray", myRGB(168, 168, 168)}, - {"lightpink", myRGB(255, 182, 193)}, - {"lightsalmon", myRGB(255, 160, 122)}, - {"lightseagreen", myRGB(32, 178, 170)}, - {"lightskyblue", myRGB(135, 206, 250)}, - {"lightslateblue", myRGB(132, 112, 255)}, - {"lightslategray", myRGB(119, 136, 153)}, - {"lightsteelblue", myRGB(124, 152, 211)}, - {"lightyellow", myRGB(255, 255, 224)}, - {"limegreen", myRGB(0, 175, 20)}, + {"LavenderBlush", myRGB(255, 240, 245)}, + {"LawnGreen", myRGB(124, 252, 0)}, + {"LemonChiffon", myRGB(255, 250, 205)}, + {"LightBlue", myRGB(176, 226, 255)}, + {"LightCoral", myRGB(240, 128, 128)}, + {"LightCyan", myRGB(224, 255, 255)}, + {"LightGoldenrod", myRGB(238, 221, 130)}, + {"LightGoldenrodYellow", myRGB(250, 250, 210)}, + {"LightGray", myRGB(168, 168, 168)}, + {"LightPink", myRGB(255, 182, 193)}, + {"LightSalmon", myRGB(255, 160, 122)}, + {"LightSeaGreen", myRGB(32, 178, 170)}, + {"LightSkyBlue", myRGB(135, 206, 250)}, + {"LightSlateBlue", myRGB(132, 112, 255)}, + {"LightSlateGray", myRGB(119, 136, 153)}, + {"LightSteelBlue", myRGB(124, 152, 211)}, + {"LightYellow", myRGB(255, 255, 224)}, + {"LimeGreen", myRGB(0, 175, 20)}, {"linen", myRGB(250, 240, 230)}, - {"magenta", myRGB(255, 0, 255)}, - {"maroon", myRGB(143, 0, 82)}, - {"mediumaquamarine", myRGB(0, 147, 143)}, - {"mediumblue", myRGB(50, 50, 204)}, - {"mediumforestgreen", myRGB(50, 129, 75)}, - {"mediumgoldenrod", myRGB(209, 193, 102)}, - {"mediumorchid", myRGB(189, 82, 189)}, - {"mediumpurple", myRGB(147, 112, 219)}, - {"mediumseagreen", myRGB(52, 119, 102)}, - {"mediumslateblue", myRGB(106, 106, 141)}, - {"mediumspringgreen", myRGB(35, 142, 35)}, - {"mediumturquoise", myRGB(0, 210, 210)}, - {"mediumvioletred", myRGB(213, 32, 121)}, - {"midnightblue", myRGB(47, 47, 100)}, - {"mintcream", myRGB(245, 255, 250)}, - {"mistyrose", myRGB(255, 228, 225)}, + {"Magenta", myRGB(255, 0, 255)}, + {"Maroon", myRGB(143, 0, 82)}, + {"MediumAquamarine", myRGB(0, 147, 143)}, + {"MediumBlue", myRGB(50, 50, 204)}, + {"MediumForestGreen", myRGB(50, 129, 75)}, + {"MediumGoldenrod", myRGB(209, 193, 102)}, + {"MediumOrchid", myRGB(189, 82, 189)}, + {"MediumPurple", myRGB(147, 112, 219)}, + {"MediumSeaGreen", myRGB(52, 119, 102)}, + {"MediumSlateBlue", myRGB(106, 106, 141)}, + {"MediumSpringGreen", myRGB(35, 142, 35)}, + {"MediumTurquoise", myRGB(0, 210, 210)}, + {"MediumVioletRed", myRGB(213, 32, 121)}, + {"MidnightBlue", myRGB(47, 47, 100)}, + {"MintCream", myRGB(245, 255, 250)}, + {"MistyRose", myRGB(255, 228, 225)}, {"moccasin", myRGB(255, 228, 181)}, - {"navajowhite", myRGB(255, 222, 173)}, - {"navy", myRGB(35, 35, 117)}, - {"navyblue", myRGB(35, 35, 117)}, - {"oldlace", myRGB(253, 245, 230)}, - {"olivedrab", myRGB(107, 142, 35)}, - {"orange", myRGB(255, 135, 0)}, - {"orangered", myRGB(255, 69, 0)}, - {"orchid", myRGB(239, 132, 239)}, - {"palegoldenrod", myRGB(238, 232, 170)}, - {"palegreen", myRGB(115, 222, 120)}, - {"paleturquoise", myRGB(175, 238, 238)}, - {"palevioletred", myRGB(219, 112, 147)}, - {"papayawhip", myRGB(255, 239, 213)}, - {"peachpuff", myRGB(255, 218, 185)}, + {"NavajoWhite", myRGB(255, 222, 173)}, + {"Navy", myRGB(35, 35, 117)}, + {"NavyBlue", myRGB(35, 35, 117)}, + {"OldLace", myRGB(253, 245, 230)}, + {"OliveDrab", myRGB(107, 142, 35)}, + {"Orange", myRGB(255, 135, 0)}, + {"OrangeRed", myRGB(255, 69, 0)}, + {"Orchid", myRGB(239, 132, 239)}, + {"PaleGoldenrod", myRGB(238, 232, 170)}, + {"PaleGreen", myRGB(115, 222, 120)}, + {"PaleTurquoise", myRGB(175, 238, 238)}, + {"PaleVioletRed", myRGB(219, 112, 147)}, + {"PapayaWhip", myRGB(255, 239, 213)}, + {"PeachPuff", myRGB(255, 218, 185)}, {"peru", myRGB(205, 133, 63)}, - {"pink", myRGB(255, 181, 197)}, - {"plum", myRGB(197, 72, 155)}, - {"powderblue", myRGB(176, 224, 230)}, + {"Pink", myRGB(255, 181, 197)}, + {"Plum", myRGB(197, 72, 155)}, + {"PowderBlue", myRGB(176, 224, 230)}, {"purple", myRGB(160, 32, 240)}, - {"red", myRGB(255, 0, 0)}, - {"rosybrown", myRGB(188, 143, 143)}, - {"royalblue", myRGB(65, 105, 225)}, - {"saddlebrown", myRGB(139, 69, 19)}, - {"salmon", myRGB(233, 150, 122)}, - {"sandybrown", myRGB(244, 164, 96)}, - {"seagreen", myRGB(82, 149, 132)}, + {"Red", myRGB(255, 0, 0)}, + {"RosyBrown", myRGB(188, 143, 143)}, + {"RoyalBlue", myRGB(65, 105, 225)}, + {"SaddleBrown", myRGB(139, 69, 19)}, + {"Salmon", myRGB(233, 150, 122)}, + {"SandyBrown", myRGB(244, 164, 96)}, + {"SeaGreen", myRGB(82, 149, 132)}, {"seashell", myRGB(255, 245, 238)}, - {"sienna", myRGB(150, 82, 45)}, - {"skyblue", myRGB(114, 159, 255)}, - {"slateblue", myRGB(126, 136, 171)}, - {"slategray", myRGB(112, 128, 144)}, + {"Sienna", myRGB(150, 82, 45)}, + {"SkyBlue", myRGB(114, 159, 255)}, + {"SlateBlue", myRGB(126, 136, 171)}, + {"SlateGray", myRGB(112, 128, 144)}, {"snow", myRGB(255, 250, 250)}, - {"springgreen", myRGB(65, 172, 65)}, - {"steelblue", myRGB(84, 112, 170)}, - {"tan", myRGB(222, 184, 135)}, - {"thistle", myRGB(216, 191, 216)}, + {"SpringGreen", myRGB(65, 172, 65)}, + {"SteelBlue", myRGB(84, 112, 170)}, + {"Tan", myRGB(222, 184, 135)}, + {"Thistle", myRGB(216, 191, 216)}, {"tomato", myRGB(255, 99, 71)}, - {"transparent", myRGB(0, 0, 1)}, - {"turquoise", myRGB(25, 204, 223)}, - {"violet", myRGB(156, 62, 206)}, - {"violetred", myRGB(243, 62, 150)}, - {"wheat", myRGB(245, 222, 179)}, - {"white", myRGB(255, 255, 255)}, - {"whitesmoke", myRGB(245, 245, 245)}, - {"yellow", myRGB(255, 255, 0)}, - {"yellowgreen", myRGB(50, 216, 56)}, + {"Transparent", myRGB(0, 0, 1)}, + {"Turquoise", myRGB(25, 204, 223)}, + {"Violet", myRGB(156, 62, 206)}, + {"VioletRed", myRGB(243, 62, 150)}, + {"Wheat", myRGB(245, 222, 179)}, + {"White", myRGB(255, 255, 255)}, + {"WhiteSmoke", myRGB(245, 245, 245)}, + {"Yellow", myRGB(255, 255, 0)}, + {"YellowGreen", myRGB(50, 216, 56)}, {NULL, myRGB(0, 0, 0)} }; static int numTheRGBRecords = 234; @@ -557,41 +560,47 @@ static bool GetRGBFromName(const char *inname, bool *isNone, grey[2] = 'a'; // check for special 'none' colour: + bool found; if ( strcmp(name, "none") == 0 ) { *isNone = TRUE; - return TRUE; + found = TRUE; } - - // binary search: - left = 0; - right = numTheRGBRecords - 1; - do + else // not "None" { - middle = (left + right) / 2; - cmp = strcmp(name, theRGBRecords[middle].name); - if ( cmp == 0 ) - { - rgbVal = theRGBRecords[middle].rgb; - *r = (unsigned char)((rgbVal >> 16) & 0xFF); - *g = (unsigned char)((rgbVal >> 8) & 0xFF); - *b = (unsigned char)((rgbVal) & 0xFF); - *isNone = FALSE; - free(name); - return TRUE; - } - else if ( cmp < 0 ) + found = FALSE; + + // binary search: + left = 0; + right = numTheRGBRecords - 1; + do { - right = middle - 1; - } - else - { // > 0 - left = middle + 1; - } - } while (left <= right); + middle = (left + right) / 2; + cmp = strcmp(name, theRGBRecords[middle].name); + if ( cmp == 0 ) + { + rgbVal = theRGBRecords[middle].rgb; + *r = (unsigned char)((rgbVal >> 16) & 0xFF); + *g = (unsigned char)((rgbVal >> 8) & 0xFF); + *b = (unsigned char)((rgbVal) & 0xFF); + *isNone = FALSE; + found = TRUE; + break; + } + else if ( cmp < 0 ) + { + right = middle - 1; + } + else // cmp > 0 + { + left = middle + 1; + } + } while (left <= right); + } free(name); - return FALSE; + + return found; } static const char *ParseColor(const char *data) @@ -637,8 +646,8 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data) wxImage img; int count; unsigned width, height, colors_cnt, chars_per_pixel; - unsigned i, j; - char key[64]; + size_t i, j, i_key; + wxChar key[64]; const char *clr_def; bool hasMask; wxXPMColourMapData *clr_data; @@ -665,7 +674,7 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data) if ( !img.Ok() ) return img; img.SetMask(FALSE); - key[chars_per_pixel] = '\0'; + key[chars_per_pixel] = wxT('\0'); hasMask = FALSE; clr_tbl.DeleteContents(TRUE); @@ -674,7 +683,8 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data) */ for (i = 0; i < colors_cnt; i++) { - memcpy(key, xpm_data[1 + i], chars_per_pixel); + for (i_key = 0; i_key < chars_per_pixel; i_key++) + key[i_key] = (wxChar)xpm_data[1 + i][i_key]; clr_def = ParseColor(xpm_data[1 + i]); clr_data = new wxXPMColourMapData; @@ -721,9 +731,9 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data) { for (i = 0; i < width; i++, img_data += 3) { - memcpy(key, - xpm_data[1 + colors_cnt + j] + chars_per_pixel * i, - chars_per_pixel); + for (i_key = 0; i_key < chars_per_pixel; i_key++) + key[i_key] = (wxChar)xpm_data[1 + colors_cnt + j] + [chars_per_pixel * i + i_key]; clr_data = (wxXPMColourMapData*) clr_tbl.Get(key); if ( clr_data == NULL ) { @@ -742,4 +752,3 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data) } -#endif // wxUSE_IMAGE && wxUSE_XPM