diff --git a/ColorPicker.cpp b/ColorPicker.cpp index 3278ae3..ef5d272 100644 --- a/ColorPicker.cpp +++ b/ColorPicker.cpp @@ -84,10 +84,10 @@ const qreal f = h - i; const qreal v2 = v * USHRT_MAX; uint8_t components[4] = { - qRound(v2 * (qreal(1.0) - s)) >> 8, - qRound(v2) >> 8, - qRound(v2 * (qreal(1.0) - (s * f))) >> 8, - qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8 + uint8_t(qRound(v2 * (qreal(1.0) - s)) >> 8), + uint8_t(qRound(v2) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * f))) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8) }; const int indexTable[10] = { 1, 2, 0, 0, 3, 1, 1, 2, 0, 0 }; return 0xff000000 | (components[indexTable[i]] << 16) | (components[indexTable[i + 4]] << 8) | components[indexTable[i + 2]]; @@ -109,7 +109,7 @@ img.fill(0xFF000000 | bgColor); uint32_t* bits = (uint32_t*)img.bits(); int pitch = img.bytesPerLine() / sizeof(uint32_t); - double dSat = 1.0 / rad; + //double dSat = 1.0 / rad; for (int i = 0; i < iter; i++) { double hue = double(i) / iter; @@ -123,6 +123,7 @@ bits[int(y)*pitch + int(x)] = rgbFromHsvF(hue, sat, 1.0, 1.0); x -= c; y -= s; + // Enable this if wanting to vary the saturation out from the center //sat -= dSat; } } diff --git a/ColorPicker.cpp b/ColorPicker.cpp index 3278ae3..ef5d272 100644 --- a/ColorPicker.cpp +++ b/ColorPicker.cpp @@ -84,10 +84,10 @@ const qreal f = h - i; const qreal v2 = v * USHRT_MAX; uint8_t components[4] = { - qRound(v2 * (qreal(1.0) - s)) >> 8, - qRound(v2) >> 8, - qRound(v2 * (qreal(1.0) - (s * f))) >> 8, - qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8 + uint8_t(qRound(v2 * (qreal(1.0) - s)) >> 8), + uint8_t(qRound(v2) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * f))) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8) }; const int indexTable[10] = { 1, 2, 0, 0, 3, 1, 1, 2, 0, 0 }; return 0xff000000 | (components[indexTable[i]] << 16) | (components[indexTable[i + 4]] << 8) | components[indexTable[i + 2]]; @@ -109,7 +109,7 @@ img.fill(0xFF000000 | bgColor); uint32_t* bits = (uint32_t*)img.bits(); int pitch = img.bytesPerLine() / sizeof(uint32_t); - double dSat = 1.0 / rad; + //double dSat = 1.0 / rad; for (int i = 0; i < iter; i++) { double hue = double(i) / iter; @@ -123,6 +123,7 @@ bits[int(y)*pitch + int(x)] = rgbFromHsvF(hue, sat, 1.0, 1.0); x -= c; y -= s; + // Enable this if wanting to vary the saturation out from the center //sat -= dSat; } } diff --git a/DocSVG.cpp b/DocSVG.cpp index f2e28ed..fcb3128 100644 --- a/DocSVG.cpp +++ b/DocSVG.cpp @@ -72,7 +72,7 @@ { SVGStyle style = { 0, 0, 0.0 }; std::vector list = split(a_str, ';'); - for (int i = 0; i < list.size(); ++i) + for (size_t i = 0; i < list.size(); ++i) { std::vector kvp = split(list[i], ':'); std::string s = kvp[0]; diff --git a/ColorPicker.cpp b/ColorPicker.cpp index 3278ae3..ef5d272 100644 --- a/ColorPicker.cpp +++ b/ColorPicker.cpp @@ -84,10 +84,10 @@ const qreal f = h - i; const qreal v2 = v * USHRT_MAX; uint8_t components[4] = { - qRound(v2 * (qreal(1.0) - s)) >> 8, - qRound(v2) >> 8, - qRound(v2 * (qreal(1.0) - (s * f))) >> 8, - qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8 + uint8_t(qRound(v2 * (qreal(1.0) - s)) >> 8), + uint8_t(qRound(v2) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * f))) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8) }; const int indexTable[10] = { 1, 2, 0, 0, 3, 1, 1, 2, 0, 0 }; return 0xff000000 | (components[indexTable[i]] << 16) | (components[indexTable[i + 4]] << 8) | components[indexTable[i + 2]]; @@ -109,7 +109,7 @@ img.fill(0xFF000000 | bgColor); uint32_t* bits = (uint32_t*)img.bits(); int pitch = img.bytesPerLine() / sizeof(uint32_t); - double dSat = 1.0 / rad; + //double dSat = 1.0 / rad; for (int i = 0; i < iter; i++) { double hue = double(i) / iter; @@ -123,6 +123,7 @@ bits[int(y)*pitch + int(x)] = rgbFromHsvF(hue, sat, 1.0, 1.0); x -= c; y -= s; + // Enable this if wanting to vary the saturation out from the center //sat -= dSat; } } diff --git a/DocSVG.cpp b/DocSVG.cpp index f2e28ed..fcb3128 100644 --- a/DocSVG.cpp +++ b/DocSVG.cpp @@ -72,7 +72,7 @@ { SVGStyle style = { 0, 0, 0.0 }; std::vector list = split(a_str, ';'); - for (int i = 0; i < list.size(); ++i) + for (size_t i = 0; i < list.size(); ++i) { std::vector kvp = split(list[i], ':'); std::string s = kvp[0]; diff --git a/DocSVG.h b/DocSVG.h index d8e20e2..83cedad 100644 --- a/DocSVG.h +++ b/DocSVG.h @@ -226,8 +226,8 @@ void DumpOperations() { - for (int p = 0; p < paths.size(); ++p) - for (int i = 0; i < paths[p].operations.size(); i++) + for (size_t p = 0; p < paths.size(); ++p) + for (size_t i = 0; i < paths[p].operations.size(); i++) paths[p].operations[i].dump(); } @@ -243,7 +243,7 @@ */ HPDF_Page_EndText(page); - for (int p = 0; p < paths.size(); ++p) + for (size_t p = 0; p < paths.size(); ++p) { uint32_t fCol = paths[p].style.fillColor; uint32_t sCol = paths[p].style.strokeColor; @@ -264,7 +264,7 @@ pathStartPos[0] = curPos[0]; pathStartPos[1] = curPos[1]; SVGOperation::PathOperation prevOp = SVGOperation::BadOperation; - for (int i = 0; i < operations.size(); i++) { + for (size_t i = 0; i < operations.size(); i++) { SVGOperation op = operations[i]; op.scale(m_scale); op.output(page, curPos, false, prevOp, pathStartPos); @@ -323,7 +323,6 @@ operations.push_back(currentOp); currentOp.m_type = SVGOperation::MoveToAbs; int val = 0; - int i = 0; const char* pathPtr = a_pathData; while (*pathPtr) { char* end = 0; diff --git a/ColorPicker.cpp b/ColorPicker.cpp index 3278ae3..ef5d272 100644 --- a/ColorPicker.cpp +++ b/ColorPicker.cpp @@ -84,10 +84,10 @@ const qreal f = h - i; const qreal v2 = v * USHRT_MAX; uint8_t components[4] = { - qRound(v2 * (qreal(1.0) - s)) >> 8, - qRound(v2) >> 8, - qRound(v2 * (qreal(1.0) - (s * f))) >> 8, - qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8 + uint8_t(qRound(v2 * (qreal(1.0) - s)) >> 8), + uint8_t(qRound(v2) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * f))) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8) }; const int indexTable[10] = { 1, 2, 0, 0, 3, 1, 1, 2, 0, 0 }; return 0xff000000 | (components[indexTable[i]] << 16) | (components[indexTable[i + 4]] << 8) | components[indexTable[i + 2]]; @@ -109,7 +109,7 @@ img.fill(0xFF000000 | bgColor); uint32_t* bits = (uint32_t*)img.bits(); int pitch = img.bytesPerLine() / sizeof(uint32_t); - double dSat = 1.0 / rad; + //double dSat = 1.0 / rad; for (int i = 0; i < iter; i++) { double hue = double(i) / iter; @@ -123,6 +123,7 @@ bits[int(y)*pitch + int(x)] = rgbFromHsvF(hue, sat, 1.0, 1.0); x -= c; y -= s; + // Enable this if wanting to vary the saturation out from the center //sat -= dSat; } } diff --git a/DocSVG.cpp b/DocSVG.cpp index f2e28ed..fcb3128 100644 --- a/DocSVG.cpp +++ b/DocSVG.cpp @@ -72,7 +72,7 @@ { SVGStyle style = { 0, 0, 0.0 }; std::vector list = split(a_str, ';'); - for (int i = 0; i < list.size(); ++i) + for (size_t i = 0; i < list.size(); ++i) { std::vector kvp = split(list[i], ':'); std::string s = kvp[0]; diff --git a/DocSVG.h b/DocSVG.h index d8e20e2..83cedad 100644 --- a/DocSVG.h +++ b/DocSVG.h @@ -226,8 +226,8 @@ void DumpOperations() { - for (int p = 0; p < paths.size(); ++p) - for (int i = 0; i < paths[p].operations.size(); i++) + for (size_t p = 0; p < paths.size(); ++p) + for (size_t i = 0; i < paths[p].operations.size(); i++) paths[p].operations[i].dump(); } @@ -243,7 +243,7 @@ */ HPDF_Page_EndText(page); - for (int p = 0; p < paths.size(); ++p) + for (size_t p = 0; p < paths.size(); ++p) { uint32_t fCol = paths[p].style.fillColor; uint32_t sCol = paths[p].style.strokeColor; @@ -264,7 +264,7 @@ pathStartPos[0] = curPos[0]; pathStartPos[1] = curPos[1]; SVGOperation::PathOperation prevOp = SVGOperation::BadOperation; - for (int i = 0; i < operations.size(); i++) { + for (size_t i = 0; i < operations.size(); i++) { SVGOperation op = operations[i]; op.scale(m_scale); op.output(page, curPos, false, prevOp, pathStartPos); @@ -323,7 +323,6 @@ operations.push_back(currentOp); currentOp.m_type = SVGOperation::MoveToAbs; int val = 0; - int i = 0; const char* pathPtr = a_pathData; while (*pathPtr) { char* end = 0; diff --git a/DocTemplate.cpp b/DocTemplate.cpp index 7defbcc..0da27e8 100644 --- a/DocTemplate.cpp +++ b/DocTemplate.cpp @@ -144,7 +144,7 @@ { std::vector ret; std::vector strs = split(str, ','); - for (int i = 0; i < strs.size(); i+=2) + for (size_t i = 0; i < strs.size(); i+=2) { Point pnt = { 0, 0 }; pnt.x = (float)atof(trim(strs[i + 0]).c_str()); @@ -393,7 +393,7 @@ void DocTemplate::Apply(DocOutputPage& page) { - for (int i = 0; i < m_items.size(); ++i) + for (size_t i = 0; i < m_items.size(); ++i) { if (m_items[i].m_type == DIT_Label) { diff --git a/ColorPicker.cpp b/ColorPicker.cpp index 3278ae3..ef5d272 100644 --- a/ColorPicker.cpp +++ b/ColorPicker.cpp @@ -84,10 +84,10 @@ const qreal f = h - i; const qreal v2 = v * USHRT_MAX; uint8_t components[4] = { - qRound(v2 * (qreal(1.0) - s)) >> 8, - qRound(v2) >> 8, - qRound(v2 * (qreal(1.0) - (s * f))) >> 8, - qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8 + uint8_t(qRound(v2 * (qreal(1.0) - s)) >> 8), + uint8_t(qRound(v2) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * f))) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8) }; const int indexTable[10] = { 1, 2, 0, 0, 3, 1, 1, 2, 0, 0 }; return 0xff000000 | (components[indexTable[i]] << 16) | (components[indexTable[i + 4]] << 8) | components[indexTable[i + 2]]; @@ -109,7 +109,7 @@ img.fill(0xFF000000 | bgColor); uint32_t* bits = (uint32_t*)img.bits(); int pitch = img.bytesPerLine() / sizeof(uint32_t); - double dSat = 1.0 / rad; + //double dSat = 1.0 / rad; for (int i = 0; i < iter; i++) { double hue = double(i) / iter; @@ -123,6 +123,7 @@ bits[int(y)*pitch + int(x)] = rgbFromHsvF(hue, sat, 1.0, 1.0); x -= c; y -= s; + // Enable this if wanting to vary the saturation out from the center //sat -= dSat; } } diff --git a/DocSVG.cpp b/DocSVG.cpp index f2e28ed..fcb3128 100644 --- a/DocSVG.cpp +++ b/DocSVG.cpp @@ -72,7 +72,7 @@ { SVGStyle style = { 0, 0, 0.0 }; std::vector list = split(a_str, ';'); - for (int i = 0; i < list.size(); ++i) + for (size_t i = 0; i < list.size(); ++i) { std::vector kvp = split(list[i], ':'); std::string s = kvp[0]; diff --git a/DocSVG.h b/DocSVG.h index d8e20e2..83cedad 100644 --- a/DocSVG.h +++ b/DocSVG.h @@ -226,8 +226,8 @@ void DumpOperations() { - for (int p = 0; p < paths.size(); ++p) - for (int i = 0; i < paths[p].operations.size(); i++) + for (size_t p = 0; p < paths.size(); ++p) + for (size_t i = 0; i < paths[p].operations.size(); i++) paths[p].operations[i].dump(); } @@ -243,7 +243,7 @@ */ HPDF_Page_EndText(page); - for (int p = 0; p < paths.size(); ++p) + for (size_t p = 0; p < paths.size(); ++p) { uint32_t fCol = paths[p].style.fillColor; uint32_t sCol = paths[p].style.strokeColor; @@ -264,7 +264,7 @@ pathStartPos[0] = curPos[0]; pathStartPos[1] = curPos[1]; SVGOperation::PathOperation prevOp = SVGOperation::BadOperation; - for (int i = 0; i < operations.size(); i++) { + for (size_t i = 0; i < operations.size(); i++) { SVGOperation op = operations[i]; op.scale(m_scale); op.output(page, curPos, false, prevOp, pathStartPos); @@ -323,7 +323,6 @@ operations.push_back(currentOp); currentOp.m_type = SVGOperation::MoveToAbs; int val = 0; - int i = 0; const char* pathPtr = a_pathData; while (*pathPtr) { char* end = 0; diff --git a/DocTemplate.cpp b/DocTemplate.cpp index 7defbcc..0da27e8 100644 --- a/DocTemplate.cpp +++ b/DocTemplate.cpp @@ -144,7 +144,7 @@ { std::vector ret; std::vector strs = split(str, ','); - for (int i = 0; i < strs.size(); i+=2) + for (size_t i = 0; i < strs.size(); i+=2) { Point pnt = { 0, 0 }; pnt.x = (float)atof(trim(strs[i + 0]).c_str()); @@ -393,7 +393,7 @@ void DocTemplate::Apply(DocOutputPage& page) { - for (int i = 0; i < m_items.size(); ++i) + for (size_t i = 0; i < m_items.size(); ++i) { if (m_items[i].m_type == DIT_Label) { diff --git a/Framework/Macros.h b/Framework/Macros.h index 6ca8c86..3688192 100644 --- a/Framework/Macros.h +++ b/Framework/Macros.h @@ -71,7 +71,13 @@ // This macro checks the pre-condition is met, if it doesn't then returns the error result and executes the provided cleanup code // See also 'finally'. Probably during pre-condition checking, there shouldn't be any cleanup yet as no work should be done at this stage. //#define YQ_API_PRECONDITION_CLEANUP(condition,result,cleanup) do { if (!(condition)) { cleanup; YQ_API_LEAVE(result); } } while (0,0) -#define YQ_API_PRECONDITION(condition,result) do { if (!(condition)) { YQ_API_LEAVE(result, #condition); } } while (0,0)//YQ_API_PRECONDITION_CLEANUP(condition,result, ((void)0)) +#ifdef __MINGW32__ +#define YQ_SCOPED_MACRO(macro) do { macro } while (0,0) +#else +#define YQ_SCOPED_MACRO(macro) do { macro } while (0) +#endif +#define YQ_API_PRECONDITION(condition,result) YQ_SCOPED_MACRO( if (!(condition)) { YQ_API_LEAVE(result, #condition); } ) +//YQ_API_PRECONDITION_CLEANUP(condition,result, ((void)0)) #define YQ_API_PRECONDITION_NULL(...) YQ_NULL_CHECK_IMPL_N(__VA_ARGS__) // Can redirect to the user heap manager routines if provided diff --git a/ColorPicker.cpp b/ColorPicker.cpp index 3278ae3..ef5d272 100644 --- a/ColorPicker.cpp +++ b/ColorPicker.cpp @@ -84,10 +84,10 @@ const qreal f = h - i; const qreal v2 = v * USHRT_MAX; uint8_t components[4] = { - qRound(v2 * (qreal(1.0) - s)) >> 8, - qRound(v2) >> 8, - qRound(v2 * (qreal(1.0) - (s * f))) >> 8, - qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8 + uint8_t(qRound(v2 * (qreal(1.0) - s)) >> 8), + uint8_t(qRound(v2) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * f))) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8) }; const int indexTable[10] = { 1, 2, 0, 0, 3, 1, 1, 2, 0, 0 }; return 0xff000000 | (components[indexTable[i]] << 16) | (components[indexTable[i + 4]] << 8) | components[indexTable[i + 2]]; @@ -109,7 +109,7 @@ img.fill(0xFF000000 | bgColor); uint32_t* bits = (uint32_t*)img.bits(); int pitch = img.bytesPerLine() / sizeof(uint32_t); - double dSat = 1.0 / rad; + //double dSat = 1.0 / rad; for (int i = 0; i < iter; i++) { double hue = double(i) / iter; @@ -123,6 +123,7 @@ bits[int(y)*pitch + int(x)] = rgbFromHsvF(hue, sat, 1.0, 1.0); x -= c; y -= s; + // Enable this if wanting to vary the saturation out from the center //sat -= dSat; } } diff --git a/DocSVG.cpp b/DocSVG.cpp index f2e28ed..fcb3128 100644 --- a/DocSVG.cpp +++ b/DocSVG.cpp @@ -72,7 +72,7 @@ { SVGStyle style = { 0, 0, 0.0 }; std::vector list = split(a_str, ';'); - for (int i = 0; i < list.size(); ++i) + for (size_t i = 0; i < list.size(); ++i) { std::vector kvp = split(list[i], ':'); std::string s = kvp[0]; diff --git a/DocSVG.h b/DocSVG.h index d8e20e2..83cedad 100644 --- a/DocSVG.h +++ b/DocSVG.h @@ -226,8 +226,8 @@ void DumpOperations() { - for (int p = 0; p < paths.size(); ++p) - for (int i = 0; i < paths[p].operations.size(); i++) + for (size_t p = 0; p < paths.size(); ++p) + for (size_t i = 0; i < paths[p].operations.size(); i++) paths[p].operations[i].dump(); } @@ -243,7 +243,7 @@ */ HPDF_Page_EndText(page); - for (int p = 0; p < paths.size(); ++p) + for (size_t p = 0; p < paths.size(); ++p) { uint32_t fCol = paths[p].style.fillColor; uint32_t sCol = paths[p].style.strokeColor; @@ -264,7 +264,7 @@ pathStartPos[0] = curPos[0]; pathStartPos[1] = curPos[1]; SVGOperation::PathOperation prevOp = SVGOperation::BadOperation; - for (int i = 0; i < operations.size(); i++) { + for (size_t i = 0; i < operations.size(); i++) { SVGOperation op = operations[i]; op.scale(m_scale); op.output(page, curPos, false, prevOp, pathStartPos); @@ -323,7 +323,6 @@ operations.push_back(currentOp); currentOp.m_type = SVGOperation::MoveToAbs; int val = 0; - int i = 0; const char* pathPtr = a_pathData; while (*pathPtr) { char* end = 0; diff --git a/DocTemplate.cpp b/DocTemplate.cpp index 7defbcc..0da27e8 100644 --- a/DocTemplate.cpp +++ b/DocTemplate.cpp @@ -144,7 +144,7 @@ { std::vector ret; std::vector strs = split(str, ','); - for (int i = 0; i < strs.size(); i+=2) + for (size_t i = 0; i < strs.size(); i+=2) { Point pnt = { 0, 0 }; pnt.x = (float)atof(trim(strs[i + 0]).c_str()); @@ -393,7 +393,7 @@ void DocTemplate::Apply(DocOutputPage& page) { - for (int i = 0; i < m_items.size(); ++i) + for (size_t i = 0; i < m_items.size(); ++i) { if (m_items[i].m_type == DIT_Label) { diff --git a/Framework/Macros.h b/Framework/Macros.h index 6ca8c86..3688192 100644 --- a/Framework/Macros.h +++ b/Framework/Macros.h @@ -71,7 +71,13 @@ // This macro checks the pre-condition is met, if it doesn't then returns the error result and executes the provided cleanup code // See also 'finally'. Probably during pre-condition checking, there shouldn't be any cleanup yet as no work should be done at this stage. //#define YQ_API_PRECONDITION_CLEANUP(condition,result,cleanup) do { if (!(condition)) { cleanup; YQ_API_LEAVE(result); } } while (0,0) -#define YQ_API_PRECONDITION(condition,result) do { if (!(condition)) { YQ_API_LEAVE(result, #condition); } } while (0,0)//YQ_API_PRECONDITION_CLEANUP(condition,result, ((void)0)) +#ifdef __MINGW32__ +#define YQ_SCOPED_MACRO(macro) do { macro } while (0,0) +#else +#define YQ_SCOPED_MACRO(macro) do { macro } while (0) +#endif +#define YQ_API_PRECONDITION(condition,result) YQ_SCOPED_MACRO( if (!(condition)) { YQ_API_LEAVE(result, #condition); } ) +//YQ_API_PRECONDITION_CLEANUP(condition,result, ((void)0)) #define YQ_API_PRECONDITION_NULL(...) YQ_NULL_CHECK_IMPL_N(__VA_ARGS__) // Can redirect to the user heap manager routines if provided diff --git a/Framework/SystemInfomation.cpp b/Framework/SystemInfomation.cpp index 3f09248..6e38e8e 100644 --- a/Framework/SystemInfomation.cpp +++ b/Framework/SystemInfomation.cpp @@ -113,7 +113,7 @@ const char* humanUnitStrings[] = { " bytes", " KB", " MB", " GB", " TB" }; int ramUnit = 0; uint64_t ramSize = a_info.m_ramSize; - while (ramSize > 1024 && ramUnit < (YQ_ARRAY_SIZE(humanUnitStrings)-1)) + while (ramSize > 1024 && ramUnit < int(YQ_ARRAY_SIZE(humanUnitStrings)-1)) ramUnit++, ramSize /= 1000; a_info.m_ramSizeStr = std::to_string(ramSize) + humanUnitStrings[ramUnit]; diff --git a/ColorPicker.cpp b/ColorPicker.cpp index 3278ae3..ef5d272 100644 --- a/ColorPicker.cpp +++ b/ColorPicker.cpp @@ -84,10 +84,10 @@ const qreal f = h - i; const qreal v2 = v * USHRT_MAX; uint8_t components[4] = { - qRound(v2 * (qreal(1.0) - s)) >> 8, - qRound(v2) >> 8, - qRound(v2 * (qreal(1.0) - (s * f))) >> 8, - qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8 + uint8_t(qRound(v2 * (qreal(1.0) - s)) >> 8), + uint8_t(qRound(v2) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * f))) >> 8), + uint8_t(qRound(v2 * (qreal(1.0) - (s * (qreal(1.0) - f)))) >> 8) }; const int indexTable[10] = { 1, 2, 0, 0, 3, 1, 1, 2, 0, 0 }; return 0xff000000 | (components[indexTable[i]] << 16) | (components[indexTable[i + 4]] << 8) | components[indexTable[i + 2]]; @@ -109,7 +109,7 @@ img.fill(0xFF000000 | bgColor); uint32_t* bits = (uint32_t*)img.bits(); int pitch = img.bytesPerLine() / sizeof(uint32_t); - double dSat = 1.0 / rad; + //double dSat = 1.0 / rad; for (int i = 0; i < iter; i++) { double hue = double(i) / iter; @@ -123,6 +123,7 @@ bits[int(y)*pitch + int(x)] = rgbFromHsvF(hue, sat, 1.0, 1.0); x -= c; y -= s; + // Enable this if wanting to vary the saturation out from the center //sat -= dSat; } } diff --git a/DocSVG.cpp b/DocSVG.cpp index f2e28ed..fcb3128 100644 --- a/DocSVG.cpp +++ b/DocSVG.cpp @@ -72,7 +72,7 @@ { SVGStyle style = { 0, 0, 0.0 }; std::vector list = split(a_str, ';'); - for (int i = 0; i < list.size(); ++i) + for (size_t i = 0; i < list.size(); ++i) { std::vector kvp = split(list[i], ':'); std::string s = kvp[0]; diff --git a/DocSVG.h b/DocSVG.h index d8e20e2..83cedad 100644 --- a/DocSVG.h +++ b/DocSVG.h @@ -226,8 +226,8 @@ void DumpOperations() { - for (int p = 0; p < paths.size(); ++p) - for (int i = 0; i < paths[p].operations.size(); i++) + for (size_t p = 0; p < paths.size(); ++p) + for (size_t i = 0; i < paths[p].operations.size(); i++) paths[p].operations[i].dump(); } @@ -243,7 +243,7 @@ */ HPDF_Page_EndText(page); - for (int p = 0; p < paths.size(); ++p) + for (size_t p = 0; p < paths.size(); ++p) { uint32_t fCol = paths[p].style.fillColor; uint32_t sCol = paths[p].style.strokeColor; @@ -264,7 +264,7 @@ pathStartPos[0] = curPos[0]; pathStartPos[1] = curPos[1]; SVGOperation::PathOperation prevOp = SVGOperation::BadOperation; - for (int i = 0; i < operations.size(); i++) { + for (size_t i = 0; i < operations.size(); i++) { SVGOperation op = operations[i]; op.scale(m_scale); op.output(page, curPos, false, prevOp, pathStartPos); @@ -323,7 +323,6 @@ operations.push_back(currentOp); currentOp.m_type = SVGOperation::MoveToAbs; int val = 0; - int i = 0; const char* pathPtr = a_pathData; while (*pathPtr) { char* end = 0; diff --git a/DocTemplate.cpp b/DocTemplate.cpp index 7defbcc..0da27e8 100644 --- a/DocTemplate.cpp +++ b/DocTemplate.cpp @@ -144,7 +144,7 @@ { std::vector ret; std::vector strs = split(str, ','); - for (int i = 0; i < strs.size(); i+=2) + for (size_t i = 0; i < strs.size(); i+=2) { Point pnt = { 0, 0 }; pnt.x = (float)atof(trim(strs[i + 0]).c_str()); @@ -393,7 +393,7 @@ void DocTemplate::Apply(DocOutputPage& page) { - for (int i = 0; i < m_items.size(); ++i) + for (size_t i = 0; i < m_items.size(); ++i) { if (m_items[i].m_type == DIT_Label) { diff --git a/Framework/Macros.h b/Framework/Macros.h index 6ca8c86..3688192 100644 --- a/Framework/Macros.h +++ b/Framework/Macros.h @@ -71,7 +71,13 @@ // This macro checks the pre-condition is met, if it doesn't then returns the error result and executes the provided cleanup code // See also 'finally'. Probably during pre-condition checking, there shouldn't be any cleanup yet as no work should be done at this stage. //#define YQ_API_PRECONDITION_CLEANUP(condition,result,cleanup) do { if (!(condition)) { cleanup; YQ_API_LEAVE(result); } } while (0,0) -#define YQ_API_PRECONDITION(condition,result) do { if (!(condition)) { YQ_API_LEAVE(result, #condition); } } while (0,0)//YQ_API_PRECONDITION_CLEANUP(condition,result, ((void)0)) +#ifdef __MINGW32__ +#define YQ_SCOPED_MACRO(macro) do { macro } while (0,0) +#else +#define YQ_SCOPED_MACRO(macro) do { macro } while (0) +#endif +#define YQ_API_PRECONDITION(condition,result) YQ_SCOPED_MACRO( if (!(condition)) { YQ_API_LEAVE(result, #condition); } ) +//YQ_API_PRECONDITION_CLEANUP(condition,result, ((void)0)) #define YQ_API_PRECONDITION_NULL(...) YQ_NULL_CHECK_IMPL_N(__VA_ARGS__) // Can redirect to the user heap manager routines if provided diff --git a/Framework/SystemInfomation.cpp b/Framework/SystemInfomation.cpp index 3f09248..6e38e8e 100644 --- a/Framework/SystemInfomation.cpp +++ b/Framework/SystemInfomation.cpp @@ -113,7 +113,7 @@ const char* humanUnitStrings[] = { " bytes", " KB", " MB", " GB", " TB" }; int ramUnit = 0; uint64_t ramSize = a_info.m_ramSize; - while (ramSize > 1024 && ramUnit < (YQ_ARRAY_SIZE(humanUnitStrings)-1)) + while (ramSize > 1024 && ramUnit < int(YQ_ARRAY_SIZE(humanUnitStrings)-1)) ramUnit++, ramSize /= 1000; a_info.m_ramSizeStr = std::to_string(ramSize) + humanUnitStrings[ramUnit]; diff --git a/Framework/Utilities.cpp b/Framework/Utilities.cpp index 1e6acb9..13becb9 100644 --- a/Framework/Utilities.cpp +++ b/Framework/Utilities.cpp @@ -29,8 +29,8 @@ OutputDebugStringA(a_string); #else // ANSI C / POSIX porting code - fprintf(stderr, a_string); - fprintf(stderr, "\n"); + fputs(a_string, stderr); + //fputs("\n", stderr); #endif } @@ -97,10 +97,12 @@ _freea(message); #else char* message = 0; - vasprintf(&message, a_format, args); - if (g_currentModule.m_messageLogger) - g_currentModule.m_messageLogger->logMessage(a_logLevel, loc.c_str(), message); - free(message); + if (vasprintf(&message, a_format, args) != -1) + { + if (g_currentModule.m_messageLogger) + g_currentModule.m_messageLogger->logMessage(a_logLevel, loc.c_str(), message); + free(message); + } #endif va_end(args); } @@ -121,10 +123,12 @@ _freea(message); #else char* message = 0; - vasprintf(&message, a_format, args); - if (g_currentModule.m_errorHandler) - g_currentModule.m_errorHandler->handleError(a_result, loc.c_str(), message); - free(message); + if (vasprintf(&message, a_format, args) != -1) + { + if (g_currentModule.m_errorHandler) + g_currentModule.m_errorHandler->handleError(a_result, loc.c_str(), message); + free(message); + } #endif va_end(args); }